Merge pull request 'Add yocto helper scripts' (#248) from mueller/yocto-helper-scripts into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #248
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
This commit is contained in:
Jakob Meier 2022-05-10 18:45:54 +02:00
commit de0872072f
13 changed files with 180 additions and 45 deletions

View File

@ -12,6 +12,18 @@ list yields a list of all related PRs for each release.
# [v1.12.0]
## Added
- Adds a yocto helper script which is able to install the release build binaries
(OBSW and Watchdog) into the `q7s-yocto` repository as long as the `q7s-package`
or `q7s-yocto` repo was cloned in the same directory the EIVE OBSW repo.
This makes updating the root filesystem a lot easier. It also creates and installs a
version file.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/248
- Create the generic image by default for the Q7S build. The unique binary with the
username appended at the end is created as a side-product now
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/248
## Changed
- Build unittest as default side product of hosted builds

View File

@ -275,11 +275,8 @@ add_library(${LIB_EIVE_MISSION})
# Add main executable
add_executable(${OBSW_NAME})
if(EIVE_CREATE_UNIQUE_OBSW_BIN)
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME}-$ENV{USERNAME})
else()
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
endif()
set(OBSW_BIN_NAME ${CMAKE_PROJECT_NAME})
set_target_properties(${OBSW_NAME} PROPERTIES OUTPUT_NAME ${OBSW_BIN_NAME})
# Watchdog

View File

@ -70,8 +70,9 @@ prerequisites.
## Building the OBSW and flashing it on the Q7S
1. ARM cross-compiler installed, either as part of [Vivado 2018.2 installation](#vivado) or
as a [separate download](#arm-toolchain)
2. [Q7S sysroot](#sysroot) on local development machine
as a [separate download](#arm-toolchain). The Xiphos SDK also installs a cross-compiler,
but its version is currently too old to compile the OBSW (7.3.0).
2. [Q7S sysroot](#sysroot) on local development machine. It is installed by the Xiphos SDK
3. Recommended: Eclipse or [Vivado 2018.2 SDK](#vivado) for OBSW development
3. [TCF agent](https://wiki.eclipse.org/TCF) running on Q7S
@ -88,7 +89,7 @@ When using Windows, run theses steps in MSYS2.
1. Clone the repository with
```sh
git clone https://egit.irs.uni-stuttgart.de/eive/eive_obsw.git
git clone https://egit.irs.uni-stuttgart.de/eive/eive-obsw.git
```
2. Update all the submodules
@ -151,6 +152,53 @@ When using Windows, run theses steps in MSYS2.
cmake --build . -j
```
## Build for the Q7S target root filesystem with `yocto`
The EIVE root filesystem will contain the EIVE OBSW and the Watchdog component.
It is currently generated with `yocto`, but the tool can not compile the primary
OBSW due to toolchain version incompatibility. Therefore, the OBSW components
are currently compiled using the toolchain specified in this README (e.g. installed by Vivado).
However, it is still possible to install the two components using yocto. A few helper files were
provided to make this process easier. The following steps can be used to install the OBSW
components and a version file to the yocto sources for the generation of the complete EIVE root
file system image. The steps here are shown for Ubuntu, you can use the according Windows
helper scripts as well.
1. Copy the `q7s-env.sh` script to the same layer as the `eive-obsw`.
```sh
cp scripts/q7s-env.sh ..
cd ..
./q7s-env.sh
q7s-make-release.sh
```
2. Compile the OBSW components in release mode
```sh
cd cmake-build-release-q7s
cmake --build . -j
```
3. Make sure the [`q7s-yocto`](https://egit.irs.uni-stuttgart.de/eive/q7s-yocto)
repository or the [`q7s-package`](https://egit.irs.uni-stuttgart.de/eive/q7s-package.git)
repository and its `q7s-yocto` submodule were cloned in the same directory layer as
the `eive-obsw`.
4. Run the install script to install the files into `q7s-yocto`.
```sh
install-obsw-yocto.sh
```
5. Navigate into the `q7s-yocto` repo and review the changes. You can then add and push those
changes.
6. You can now rebuild the root filesystem with the updated OBSW using `yocto`. This probably needs
to be done on another machine or in a VM. The [`q7s-yocto`](https://egit.irs.uni-stuttgart.de/eive/q7s-yocto)
repository contains details on how to best do this.
## Building in Xilinx SDK 2018.2
1. Open Xilinx SDK 2018.2
@ -661,35 +709,7 @@ Thus the replies are received with a larger delay compared to a direct TCP conne
3. Make sure the netmask of the ehternet interface of the workstation matches the netmask of the Q7S
* When IP address is set to 192.168.133.10 and the netmask is 255.255.255.0, an example IP address for the workstation
is 192.168.133.2
4. Run tcf-agent on Q7S
* Tcf-agent is not yet integrated in the rootfs of the Q7S. Therefore build tcf-agent manually
```sh
git clone git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git
cd org.eclipse.tcf.agent/agent
make CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld MACHINE=arm NO_SSL=1 NO_UUID=1
```
* Transfer executable agent from org.eclipse.tcf.agent/agent/obj/GNU/Linux/arm/Debug to /tmp of Q7S
```sh
cd obj/GNU/Linux/arm/Debug
scp agent root@192.168.133.10:/tmp
```
* On Q7S
```sh
cd /tmp
chmod +x agent
```
* Run agent
```sh
./agent
```
4. Make sure th `tcf-agent` is running by checking `systemctl status tcf-agent`
5. In Xilinx SDK 2018.2 right click on project &rarr; Debug As &rarr; Debug Configurations
6. Right click Xilinx C/C++ applicaton (System Debugger) &rarr; New &rarr;
7. Set Debug Type to Linux Application Debug and Connectin to Linux Agent
@ -699,8 +719,8 @@ Thus the replies are received with a larger delay compared to a direct TCP conne
11. Test connection (This ensures the TCF Agent is running on the Q7S)
12. Select Application tab
* Project Name: eive_obsw
* Local File Path: Path to eiveobsw-linux.elf (in `_bin\linux\devel`)
* Remote File Path: `/tmp/eive_obsw.elf`
* Local File Path: Path to OBSW application image with debug symbols (non-stripped)
* Remote File Path: `/tmp/<OBSW NAME>`
# <a id="file-transfer"></a> Transfering Files to the Q7S
@ -726,7 +746,8 @@ From a windows machine files can be copied with putty tools (note: use IPv4 addr
pscp -scp -P 22 eive@192.168.199.227:</directory-to-example-file/>/example-file </windows-machine-path/>
````
More detailed information about the used q7s commands can be found in the Q7S user manual.
A helper script named `q7s-cp.py` can be used together with the `q7s-port.sh`
script to make this process easier.
# <a id="q7s"></a> Q7S OBC

View File

@ -33,6 +33,10 @@ add_compile_options(
set(STRIPPED_OBSW_NAME ${OBSW_BIN_NAME}-stripped)
set(STRIPPED_WATCHDOG_NAME eive-watchdog-stripped)
if(EIVE_CREATE_UNIQUE_OBSW_BIN)
set(UNIQUE_OBSW_BIN_NAME ${OBSW_BIN_NAME}-$ENV{USERNAME})
endif()
add_custom_command(
TARGET ${OBSW_NAME}
POST_BUILD
@ -41,6 +45,16 @@ add_custom_command(
COMMENT "Generating stripped executable ${STRIPPED_OBSW_NAME}.."
)
if(UNIQUE_OBSW_BIN_NAME)
add_custom_command(
TARGET ${OBSW_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/${OBSW_BIN_NAME}
${CMAKE_CURRENT_BINARY_DIR}/${UNIQUE_OBSW_BIN_NAME}
COMMENT "Generating unique EIVE OBSW binary ${UNIQUE_OBSW_BIN_NAME}")
endif()
add_custom_command(
TARGET ${WATCHDOG_NAME}
POST_BUILD

View File

@ -20,7 +20,7 @@ else
cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}"
fi
if [[ -z "${EIVE_Q7S_EM}" ]]; then
if [ ! -z "${EIVE_Q7S_EM}" ]; then
build_defs="EIVE_Q7S_EM=ON"
fi

View File

@ -20,7 +20,7 @@ else
cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}"
fi
if [[ -z "${EIVE_Q7S_EM}" ]]; then
if [ ! -z "${EIVE_Q7S_EM}" ]; then
build_defs="EIVE_Q7S_EM=ON"
fi

View File

@ -20,7 +20,7 @@ else
cfg_script_name="${EIVE_OBSW_ROOT}/cmake/scripts/${cfg_script_name}"
fi
if [[ -z "${EIVE_Q7S_EM}" ]]; then
if [ ! -z "${EIVE_Q7S_EM}" ]; then
build_defs="EIVE_Q7S_EM=ON"
fi

87
scripts/install-obsw-yocto.sh Executable file
View File

@ -0,0 +1,87 @@
#!/bin/bash
# This is a helper script to install the compiles EIVE OBSW files
# into the yocto repository to re-generate the mission root filesystem
init_dir=$(pwd)
build_dir=cmake-build-release-q7s
obsw_root=""
q7s_yocto_dir="q7s-yocto"
q7s_package_path="q7s-package/${q7s_yocto_dir}"
obsw_version_filename="obsw_version.txt"
yocto_obsw_path="yocto/meta-eive/recipes-core/eive-obsw/files"
yocto_watchdog_path="yocto/meta-eive/recipes-support/eive-obsw-watchdog/files"
obsw_bin_name="eive-obsw"
watchdog_bin_name="eive-watchdog"
obsw_target_name="eive-obsw"
watchdog_target_name="eive-watchdog"
if [ ! -z ${EIVE_OBSW_ROOT} ]; then
cd ${EIVE_OBSW_ROOT}
obsw_root=$(pwd)
elif [ -d ${build_dir} ]; then
obsw_root=${build_dir}
:
elif [ -d ../${build_dir} ]; then
cd ..
obsw_root=$(pwd)
else
echo "-E- No way into the EIVE OBSW Root folder found. Exiting"
exit 1
fi
yocto_root=""
if [ -d ../${q7s_package_path} ]; then
cd ../${q7s_package_path}
yocto_root=$(pwd)
elif [ -d ../${q7s_yocto_dir} ]; then
cd ../${q7s_yocto_dir}
yocto_root=$(pwd)
fi
if [ -z ${yocto_root} ]; then
echo "-E- No yocto directory found. Exiting"
exit 1
fi
cd ${obsw_root}
version_cmd="git describe --tags --always --exclude docker_*"
echo "-I- Running ${version_cmd} to retrieve OBSW version and store it into ${obsw_version_filename}"
version_tag=$(${version_cmd})
echo "-I- Detected version tag ${version_tag}"
echo ${version_tag} > ${obsw_version_filename}
if [ ! -d ${build_dir} ]; then
echo "No Q7S Release binary folder ${build_dir} found. Exiting"
exit 1
fi
if [ ! -f ${build_dir}/${obsw_bin_name} ]; then
echo "-W- No EIVE OBSW binary found to intall to yocto"
else
cp_cmd="cp $(pwd)/${build_dir}/${obsw_bin_name} ${yocto_root}/${yocto_obsw_path}/${obsw_target_name}"
echo "-I- Executing: ${cp_cmd}"
eval ${cp_cmd}
cp_ver_cmd="cp $(pwd)/${obsw_version_filename} ${yocto_root}/${yocto_obsw_path}"
echo "-I- Executing: ${cp_ver_cmd}"
eval ${cp_ver_cmd}
echo "-I- Installed EIVE OBSW into yocto repository successfully"
fi
if [ ! -f ${build_dir}/${watchdog_bin_name} ]; then
echo "-W- No EIVE Watchdog found to intall to yocto"
else
cp_cmd="cp $(pwd)/${build_dir}/${watchdog_bin_name} ${yocto_root}/${yocto_watchdog_path}/${watchdog_target_name}"
echo "-I- Executing: ${cp_cmd}"
eval ${cp_cmd}
cp_ver_cmd="cp $(pwd)/${obsw_version_filename} ${yocto_root}/${yocto_watchdog_path}"
echo "-I- Executing: ${cp_ver_cmd}"
eval ${cp_ver_cmd}
echo "-I- Installed EIVE watchdog into yocto repository successfully"
fi
if [ -f $(pwd)/${obsw_version_filename} ]; then
rm $(pwd)/${obsw_version_filename}
fi
cd ${init_dir}

View File

@ -16,6 +16,7 @@ if [[ -d "eive-obsw" ]]; then
export EIVE_OBSW_ROOT="$(pwd)/eive-obsw"
echo "Adding $(pwd)/eive-obsw/cmake/scripts/q7s helper script path to PATH"
export PATH=$PATH:"$(pwd)/eive-obsw/cmake/scripts/q7s"
export PATH=$PATH:"$(pwd)/eive-obsw/scripts"
cd "eive-obsw"
fi
export CONSOLE_PREFIX="[Q7S ENV]"

View File

@ -16,6 +16,7 @@ if [[ -d "eive-obsw" ]]; then
export EIVE_OBSW_ROOT="$(pwd)/eive-obsw"
echo "Adding $(pwd)/eive-obsw/cmake/scripts/q7s helper script path to PATH"
export PATH=$PATH:"$(pwd)/eive-obsw/cmake/scripts/q7s"
export PATH=$PATH:"$(pwd)/eive-obsw/scripts"
cd "eive-obsw"
fi
export CONSOLE_PREFIX="[Q7S ENV]"

View File

@ -54,5 +54,6 @@ if [ -d "eive-obsw" ]; then
export EIVE_OBSW_ROOT="$(pwd)/eive-obsw"
echo "Adding $(pwd)/eive-obsw/cmake/scripts/q7s helper script path to PATH"
export PATH=$PATH:"$(pwd)/eive-obsw/cmake/scripts/q7s"
export PATH=$PATH:"$(pwd)/eive-obsw/scripts"
cd "eive-obsw"
fi

View File

@ -54,5 +54,6 @@ if [ -d "eive-obsw" ]; then
export EIVE_OBSW_ROOT="$(pwd)/eive-obsw"
echo "Adding $(pwd)/eive-obsw/cmake/scripts/q7s helper script path to PATH"
export PATH=$PATH:"$(pwd)/eive-obsw/cmake/scripts/q7s"
export PATH=$PATH:"$(pwd)/eive-obsw/scripts"
cd "eive-obsw"
fi

2
tmtc

@ -1 +1 @@
Subproject commit 1e25b08e40db28103b91814f7de5a47dae5b9e76
Subproject commit c5862579348974882e23d39d0a6d9b2844159b99