eive-obsw/README.md

625 lines
20 KiB
Markdown
Raw Normal View History

2020-09-30 17:17:01 +02:00
# <a id="top"></a> <a name="linux"></a> EIVE On-Board Software
2020-11-07 16:48:30 +01:00
## General information
2020-11-20 18:35:42 +01:00
Target systems:
2020-12-29 15:04:08 +01:00
* OBC with Linux OS
2020-11-07 16:48:30 +01:00
* Xiphos Q7S
* Based on Zynq-7020 SoC (xc7z020clg484-2)
* Dual-core ARM Cortex-A9
* 766 MHz
* Artix-7 FPGA (85K pogrammable logic cells)
* Datasheet at https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S&fileid=340648
2020-11-15 10:53:23 +01:00
* Also a lot of informatin about the Q7S can be found on the xiphos trac platform: https://trac.xiphos.com/trac/eive-q7/wiki/Q7RevB
2020-12-29 15:04:08 +01:00
* Linux OS built with Yocto 2.5
2020-11-07 16:48:30 +01:00
* Linux Kernel https://github.com/XiphosSystemsCorp/linux-xlnx.git
2020-11-20 18:35:42 +01:00
* Host System
* Generic software components which are not dependant on hardware can also
2020-12-29 22:20:38 +01:00
be run on a host system. All host code is contained in the `bsp_hosted` folder
2020-11-20 18:35:42 +01:00
* Tested for Linux (Ubuntu 20.04) and Windows 10
2020-12-29 15:04:08 +01:00
* Raspberry Pi
* EIVE OBC can be built for Raspberry Pi as well (either directly on Raspberry Pi or by installing a cross compiler)
2020-11-07 16:48:30 +01:00
2020-12-29 15:04:08 +01:00
The steps in the primary README are related to the main OBC target Q7S.
2020-12-29 22:20:38 +01:00
The CMake build system can be used to generate build systems as well (see helper scripts in `cmake/scripts`:
2021-02-14 14:41:44 +01:00
- Linux (Raspberry Pi): See special section below.
2020-12-29 22:20:38 +01:00
- Linux Host: Uses the `bsp_hosted` BSP folder and the CMake Unix Makefiles generator.
- Windows Host: Uses the `bsp_hosted` BSP folder, the CMake MinGW Makefiles generator and MSYS2.
2020-09-30 17:17:01 +02:00
2020-11-07 16:48:30 +01:00
## Setting up development environment
2020-12-29 15:04:08 +01:00
2020-12-29 22:20:38 +01:00
### Installing Vivado the the Xilinx development tools
2020-12-30 10:10:15 +01:00
It's also possible to perform debugging with a normal Eclipse installation by installing
2021-05-24 01:54:03 +02:00
the TCF plugin and downloading the cross-compiler as specified in the section below.
2020-12-30 10:10:15 +01:00
2020-11-25 12:47:46 +01:00
* Install Vivado 2018.2 and Xilinx SDK from https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools/archive.html.
2020-12-29 22:20:38 +01:00
Install the Vivado Design Suite - HLx Editions - 2018.2 Full Product Installation instead of the updates. It is recommended to use the installer.
2020-11-25 12:50:32 +01:00
* Install settings. In the Devices selection, it is sufficient to pick SoC &rarr; Zynq-7000: <br>
2020-12-29 22:20:38 +01:00
2020-12-29 22:21:39 +01:00
<img src="./doc/img/vivado-edition.png" width="50%"> <br>
2020-12-29 22:23:12 +01:00
2020-12-29 22:21:39 +01:00
<img src="./doc/img/vivado-hl-design.png" width="50%"> <br>
2020-12-29 22:23:12 +01:00
2020-12-29 22:24:38 +01:00
<img src="./doc/img/xilinx-install.PNG" width="50%"> <br>
2020-12-29 22:20:38 +01:00
2020-11-07 16:48:30 +01:00
* For supported OS refer to https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug973-vivado-release-notes-install-license.pdf
2020-12-29 22:20:38 +01:00
* Add path of linux cross-compiler to permanent environment variables (`.profile` file in Linux):
2020-12-30 10:10:15 +01:00
`<XilinxInstallation>\SDK\2018.2\gnu\aarch32\nt\gcc-arm-linux-gnueabi\bin`
2020-12-29 22:20:38 +01:00
or set up path each time before debugging.
2020-11-20 18:39:38 +01:00
2021-05-24 01:54:03 +02:00
### Installing toolchain without Vivado
You can download the toolchain
[from the cloud](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S/Toolchain&fileid=422486).
If `wget` is available (e.g. MinGW64), you can use the following command to download the
toolchain for Windows
```sh
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/Q3zeFicebpibiBT/download/gcc-arm-linux-gnueabi-win.zip
```
or the following command for Linux (could be useful for CI/CD)
```sh
2021-05-24 14:08:55 +02:00
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/5bDHLF4spqn2zJT/download/gcc-arm-linux-gnueabi.tar.gz
2021-05-24 01:54:03 +02:00
```
2020-12-29 22:20:38 +01:00
### Installing CMake and MSYS2 on Windows
2020-11-20 18:39:38 +01:00
2020-12-29 22:20:38 +01:00
1. Install [MSYS2](https://www.msys2.org/) and [CMake](https://cmake.org/download/) first.
2020-11-20 18:39:38 +01:00
2020-12-29 22:20:38 +01:00
2. Open the MinGW64 console. It is recommended to set up aliases in `.bashrc` to navigate to the
software repository quickly
3. Run the following commands in MinGW64
2020-09-30 17:17:01 +02:00
2020-12-29 22:20:38 +01:00
```sh
pacman -Syuuu
```
It is recommended to install the full base development toolchain
```sh
pacman -S base-devel
```
It is also possible to only install required packages
```sh
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-make mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb python3
```
### Installing CMake on Linux
1. Run the following command
```sh
sudo apt-get install cmake
````
2021-02-14 14:48:24 +01:00
## Getting the Q7S system root
It is necessary to copy the Q7S system root to your local development machine for libraries
2021-05-24 01:49:17 +02:00
like `libgpio`. You can find the system root for download here
[here](https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S/Toolchain&fileid=422486).
Download it and unzip it somewhere in the Xilinx installation folder.
You can use the following command if `wget` can be used or for CI/CD:
```
2021-05-24 14:08:55 +02:00
wget https://eive-cloud.irs.uni-stuttgart.de/index.php/s/aBjpbMAFCEP7prF/download/cortexa9hf-neon-xiphos-linux-gnueabi.tar.gz
2021-05-24 01:49:17 +02:00
```
2021-02-14 14:48:24 +01:00
Then, create a new environmental variables `Q7S_SYSROOT` and set it to the local system root path.
2020-12-29 22:20:38 +01:00
## Building the software with CMake
When using Windows, run theses steps in MSYS2.
2020-09-30 17:17:01 +02:00
1. Clone the repository with
2020-12-30 10:10:15 +01:00
2020-12-29 22:20:38 +01:00
```sh
git clone https://egit.irs.uni-stuttgart.de/eive/eive_obsw.git
```
2020-09-30 17:17:01 +02:00
2. Update all the submodules
2020-12-29 22:20:38 +01:00
```sh
git submodule init
git submodule sync
git submodule update
```
3. Ensure that the cross-compiler is working with `arm-linux-gnueabihf-gcc --version`.
It is recommended to run the shell script `win_path_helper_xilinx_tools.sh` in `cmake/scripts/Q7S`
or to set up the [PATH and the CROSS_COMPILE variable permanently](https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path)
in the `.profile` file.
4. Run the CMake configuration to create the build system in a `Debug` folder.
Navigate into the `eive_obsw` folder first.
```sh
2020-12-29 22:29:02 +01:00
cd cmake/scripts/Q7S
2020-12-29 22:20:38 +01:00
./create_cmake_debug.sh
cd ../../..
```
This will invoke a Python script which in turn invokes CMake with the correct
arguments to configure CMake for Q7S cross-compilation.
5. Build the software with
```sh
cd Debug
cmake --build . -j
```
2020-12-30 10:10:15 +01:00
## Setting up default Eclipse for Q7S projects - TCF agent
The [TCF agent](https://wiki.eclipse.org/TCF) can be used to perform remote debugging on the Q7S.
1. Install the TCF agent plugin in Eclipse from the [releases](https://www.eclipse.org/tcf/downloads.php). Go to Help &rarr; Install New Software and use the download page, for example https://download.eclipse.org/tools/tcf/releases/1.6/1.6.2/ to search for the plugin and install it.
2020-12-30 10:37:01 +01:00
2. Go to Window &rarr; Perspective &rarr; Open Perspective and open the **Target Explorer Perspective**.
2021-03-20 16:09:11 +01:00
Here, the Q7S should show up if the local port forwarding was set up as explained previously. Please note that you have to connect to `localhost` and port `1534` with port forwaring set up.
2020-12-30 10:37:01 +01:00
2020-12-30 10:10:15 +01:00
3. A launch configuration was provided, but it might be necessary to adapt it for your own needs. Alternatively:
- Create a new **TCF Remote Application** by pressing the cogs button at the top or going to Run &rarr; Debug Configurations &rarr; Remote Application and creating a new one there.
2020-12-30 10:37:01 +01:00
- Set up the correct image in the main tab (it might be necessary to send the image to the Q7S manually once) and file transfer properties
2020-12-30 10:10:15 +01:00
- It is also recommended to link the correct Eclipse project.
After that, comfortable remote debugging should be possible with the Debug button.
2021-02-14 14:41:44 +01:00
A build configuration and a shell helper script has been provided to set up the path variables and
build the Q7S binary on Windows, but a launch configuration needs to be newly created because the
IP address and path settings differ from machine to machine.
2020-12-30 10:10:15 +01:00
2020-12-29 22:20:38 +01:00
## Building in Xilinx SDK 2018.2
1. Open Xilinx SDK 2018.2
2. Import project
2020-11-07 16:48:30 +01:00
* File &rarr; Import &rarr; C/C++ &rarr; Existing Code as Makefile Project
2020-12-29 22:20:38 +01:00
3. Set build command. Replace \<target\> with either debug or release.
2020-11-25 12:58:34 +01:00
* When on Linux right click project &rarr; Properties &rarr; C/C++ Build &rarr; Set build command to `make <target> -j`
2020-11-07 16:48:30 +01:00
* -j causes the compiler to use all available cores
2020-11-25 12:58:34 +01:00
* The target is used to either compile the debug or the optimized release build.
* On windows create a make target additionally (Windows &rarr; Show View &rarr; Make Target)
2020-11-15 10:53:23 +01:00
* Right click eive_obsw &rarr; New
2020-11-07 16:48:30 +01:00
* Target name: all
* Uncheck "Same as the target name"
* Uncheck "Use builder settings"
2020-12-29 22:20:38 +01:00
* As build command type: `cmake --build .`
* In the Behaviour tab, you can enable build acceleration
4. Run build command by double clicking the created target or by right clicking
2020-11-25 12:58:34 +01:00
the project folder and selecting Build Project.
2020-09-30 17:17:01 +02:00
2020-12-30 14:34:25 +01:00
## TCF-Agent
2020-12-29 22:20:38 +01:00
2020-12-30 14:34:25 +01:00
1. On reboot, some steps have to be taken on the Q7S. Set static IP address and netmask
```sh
2020-11-20 18:50:09 +01:00
ifconfig eth0 192.168.133.10
ifconfig eth0 netmask 255.255.255.0
```
2020-11-20 18:46:06 +01:00
2020-12-30 14:34:25 +01:00
2. `tcfagent` application should run automatically but this can be checked with
```sh
systemctl status tcfagent
```
2020-11-20 18:48:04 +01:00
2020-12-30 14:34:25 +01:00
3. If the agent is not running, check whether `agent` is located inside `usr/bin`.
You can run it manually there. To perform auto-start on boot, have a look at the start-up
application section.
2020-09-30 17:17:01 +02:00
2020-11-20 18:41:49 +01:00
## Debugging the software via Flatsat PC
2020-12-30 09:39:34 +01:00
2020-11-15 10:53:23 +01:00
Open SSH connection to flatsat PC:
2020-12-29 15:04:08 +01:00
2021-04-24 23:17:45 +02:00
```sh
ssh eive@flatsat.eive.absatvirt.lw
```
or
2020-12-29 15:04:08 +01:00
```sh
2020-11-15 10:53:23 +01:00
ssh eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5
2020-12-29 15:04:08 +01:00
```
2020-12-30 09:39:34 +01:00
or
```sh
ssh eive@192.168.199.227
```
2021-03-04 18:29:28 +01:00
If the static IP address of the Q7S has already been set,
you can access it with ssh
```sh
ssh root@192.168.133.10
```
If this has not been done yet, you can access the serial
console of the Q7S like this to set it
2020-11-25 12:48:56 +01:00
```sh
picocom -b 115200 /dev/ttyUSB0
```
2020-12-29 15:04:08 +01:00
2020-12-30 14:34:25 +01:00
If the serial port is blocked for some reason, you can kill
the process using it with `q7s_kill`.
2020-12-30 09:39:34 +01:00
You can use `AltGr` + `X` to exit the picocom session.
2020-11-15 10:53:23 +01:00
To debug an application, first make sure a static IP address is assigned to the Q7S. Run ifconfig on the Q7S serial console.
2020-12-29 15:04:08 +01:00
```sh
2020-11-15 10:53:23 +01:00
ifconfig
2020-12-29 15:04:08 +01:00
```
2020-11-15 10:53:23 +01:00
Set IP address and netmask with
2020-12-29 15:04:08 +01:00
```sh
2020-11-15 10:53:23 +01:00
ifconfig eth0 192.168.133.10
ifconfig eth0 netmask 255.255.255.0
2020-12-29 15:04:08 +01:00
```
2020-12-30 09:39:34 +01:00
To launch application from Xilinx SDK setup port fowarding on the development machine
(not on the flatsat!)
2020-12-29 15:04:08 +01:00
```sh
2021-03-20 16:09:11 +01:00
ssh -L 1534:192.168.133.10:1534 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 -t bash
2020-12-29 15:04:08 +01:00
```
2020-11-15 10:53:23 +01:00
2020-12-29 15:04:08 +01:00
This forwards any requests to localhost:1534 to the port 1534 of the Q7S with the IP address 192.168.133.10.
2020-12-30 10:37:01 +01:00
This needs to be done every time, so it is recommended to create an alias to do this quickly.
2020-11-15 10:53:23 +01:00
2020-12-29 15:04:08 +01:00
Note: When now setting up a debug session in the Xilinx SDK, the host must be set to localhost instead of the IP address of the Q7S.
2020-11-15 10:53:23 +01:00
2020-12-30 10:37:01 +01:00
## Transfering files via SCP
2020-12-30 14:34:25 +01:00
To transfer files from the local machine to the Q7S, use port forwarding
2020-12-30 10:37:01 +01:00
2020-12-30 14:34:25 +01:00
```sh
ssh -L 1535:192.168.133.10:22 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5
```
2020-12-30 10:37:01 +01:00
2021-05-02 13:48:39 +02:00
An `example` file can be copied like this
2020-12-30 14:34:25 +01:00
```sh
scp -P 1535 example root@localhost:/tmp
```
2021-03-23 09:09:50 +01:00
Copying a file from Q7S to flatsat PC
````
scp -P 22 root@192.168.133.10:/tmp/kernel-config /tmp
````
2021-04-11 12:04:13 +02:00
From a windows machine files can be copied with putty tools (note: use IPv4 address)
2021-03-23 09:09:50 +01:00
````
pscp -scp -P 22 eive@192.168.199.227:</directory-to-example-file/>/example-file </windows-machine-path/>
````
2020-12-30 14:34:25 +01:00
## Launching an application at start-up
2020-12-30 10:22:52 +01:00
2020-11-15 10:53:23 +01:00
Load the root partiton from the flash memory (there are to nor-flash memories and each flash holds two xdi images).
2020-12-30 10:22:52 +01:00
Note: It is not possible to modify the currently loaded root partition, e.g. creating directories. To do this,
the parition needs to be mounted.
2020-11-15 10:53:23 +01:00
1. Disable write protection of the desired root partition
2020-12-29 15:04:08 +01:00
```sh
writeprotect 0 0 0 # unlocks nominal image on nor-flash 0
```
2020-11-15 10:53:23 +01:00
2. Mount the root partition
2020-12-29 15:04:08 +01:00
```sh
xsc_mount_copy 0 0 # Mounts the nominal image from nor-flash 0
```
2020-12-30 10:22:52 +01:00
The mounted partition will be located inside the `/tmp` folder
2020-12-30 14:34:25 +01:00
3. Copy the executable to `/usr/bin`
2020-11-15 10:53:23 +01:00
4. Make sure the permissions to execute the application are set
2020-12-29 15:04:08 +01:00
```sh
chmod +x application
```
2020-11-15 10:53:23 +01:00
5. Create systemd service in /lib/systemd/system. The following shows an example service.
2020-12-29 15:04:08 +01:00
```sh
cat > example.service
[Unit]
Description=Example Service
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/application
[Install]
WantedBy=multi-user.target
```
2020-11-15 10:53:23 +01:00
6. Enable the service. This is normally done with systemctl enable. However, this is not possible when the service is
created for a mounted root partition. Therefore create a symlink as follows.
2020-12-30 10:22:52 +01:00
```sh
ln -s '/tmp/the-mounted-xdi-image/lib/systemd/system/example.service' '/tmp/the-mounted-xdi-image/etc/systemd/system/multi-user.target.wants/example.service'
```
2020-11-15 10:53:23 +01:00
7. The modified root partition is written back when the partion is locked again.
2020-12-30 10:22:52 +01:00
```sh
writeprotect 0 0 1
```
2020-11-15 10:53:23 +01:00
8. Now verify the application start by booting from the modified image
2020-12-30 10:22:52 +01:00
```sh
xsc_boot_copy 0 0
````
2020-11-15 10:53:23 +01:00
9. After booting verify if the service is running
2020-12-30 10:22:52 +01:00
```sh
systemctl status example
```
2020-11-15 10:53:23 +01:00
More detailed information about the used q7s commands can be found in the Q7S user manual.
2020-11-25 09:19:51 +01:00
### Bringing up CAN
2020-12-30 14:34:25 +01:00
```sh
ip link set can0 down
ip link set can0 type can loopback off
ip link set can0 up type can bitrate 1000000
```
2020-11-25 09:19:51 +01:00
Following command sends 8 bytes to device with id 99 (for petalinux)
````
cansend can0 -i99 99 88 77 11 33 11 22 99
````
For Q7S use this:
````
cansend can0 5A1#11.22.33.44.55.66.77.88
````
Turn loopback mode on:
````
ip link set can0 type can bitrate 1000000 loopback on
````
Reading data from CAN:
2020-11-15 10:53:23 +01:00
````
2020-11-25 09:19:51 +01:00
candump can0
2020-11-15 10:53:23 +01:00
````
2020-11-20 18:41:49 +01:00
## Setting up UNIX environment for real-time functionalities
2020-09-30 17:17:01 +02:00
Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities
used by the UNIX pthread module are restricted, which will lead to permission errors when creating these tasks
and configuring real-time properites like scheduling priorities.
To solve this issues, try following steps:
1. Edit the /etc/security/limits.conf
file and add following lines at the end:
```sh
<username> hard rtprio 99
<username> soft rtprio 99
```
The soft limit can also be set in the console with `ulimit -Sr` if the hard
limit has been increased, but it is recommended to add it to the file as well for convenience.
If adding the second line is not desired for security reasons,
the soft limit needs to be set for each session. If using an IDE like eclipse
in that case, the IDE needs to be started from the console after setting
the soft limit higher there. After adding the two lines to the file,
the computer needs to be restarted.
It is also recommended to perform the following change so that the unlockRealtime
script does not need to be run anymore each time. The following steps
raise the maximum allowed message queue length to a higher number permanently, which is
required for some framework components. The recommended values for the new message
length is 130.
2. Edit the /etc/sysctl.conf file
```sh
sudo nano /etc/sysctl.conf
```
Append at end:
```sh
fs/mqueue/msg_max = <newMsgMaxLen>
```
Apply changes with:
```sh
sudo sysctl -p
```
A possible solution which only persists for the current session is
```sh
echo <newMsgMax> | sudo tee /proc/sys/fs/mqueue/msg_max
```
or running the `unlockRealtime` script.
3. Run the shell script inside the linux folder
```sh
./unlockRealtime
```
This script executes the `sudo setcap 'cap_sys_nice=eip' \<application\>`
command on the binaries, increases the soft real time limit of the current
session and increases the maximum number of message queues by setting
`/proc/sys/fs/mqueue/msg_max`.
All changes are only applied for the current session (read 2. and 3. for
a permanent solution). If running the script before executing the binary does
not help or an warning is issue that the soft real time value is invalid,
the hard real-time limit of the system might not be high enough (see step 1).
2020-09-16 15:21:42 +02:00
2020-11-20 18:41:49 +01:00
## Flight Software Framework (FSFW)
2020-10-30 13:12:17 +01:00
An EIVE fork of the FSFW is submodules into this repository.
To add the master upstream branch and merge changes and updates from it
into the fork, run the following command in the fsfw folder first:
```sh
git remote add upstream https://egit.irs.uni-stuttgart.de/fsfw/fsfw.git
2020-10-30 13:14:27 +01:00
git remote update --prune
2020-10-30 13:12:17 +01:00
```
After that, an update can be merged by running
```sh
git merge upstream/master
```
Alternatively, changes from other upstreams (forks) and branches can be merged like that in
2020-10-30 13:14:27 +01:00
the same way.
2020-11-28 13:41:30 +01:00
## PCDU
2020-12-29 22:20:38 +01:00
2020-11-28 13:41:30 +01:00
Connect to serial console of P60 Dock
````
picocom -b 500000 /dev/ttyUSBx
````
General information
````
cmp ident
````
List parameter table:
x values: 1,2 or 4
````
2021-01-23 17:22:40 +01:00
param list x
2020-11-28 13:41:30 +01:00
````
Table 4 lists HK parameters
Changing parameters
First switch to table where parameter shall be changed (here table id is 1)
````
p60-dock # param mem 1
p60-dock # param set out_en[0] 1
p60-dock # param get out_en[0]
GET out_en[0] = 1
````
2020-11-28 13:41:30 +01:00
2020-12-30 14:34:25 +01:00
## Debugging the software (when workstation is directly conncected to Q7S)
1. Assign static IP address to Q7S
* Open serial console of Q7S (Accessible via the micro-USB of the PIM, see also Q7S user maunal chapter 10.3)
* Baudrate 115200
* Login to Q7S:
* user: root
* pw: root
2. Connect Q7S to workstation via ethernet
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
```
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
8. Click New
9. Give connection a name
10. Set Host to static IP address of Q7S. e.g. 192.168.133.10
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
2021-02-12 14:18:34 +01:00
## Libgpiod
2021-02-14 13:24:13 +01:00
2021-02-12 14:18:34 +01:00
Detect all gpio device files:
````
gpiodetect
````
Get info about a specific gpio group:
````
gpioinfo <name of gpio group>
````
The following sets the gpio 18 from gpio group gpiochip7 to high level.
````
gpioset gpiochip7 18=1
````
Setting the gpio to low.
````
gpioset gpiochip7 18=0
````
Show options for setting gpios.
````
gpioset -h
````
To get the state of a gpio:
````
gpioget <gpiogroup> <offset>
````
Example to get state:
gpioget gpiochip7 14
2021-02-14 14:41:44 +01:00
## Running the EIVE OBSW on a Raspberry Pi
2021-02-14 14:43:25 +01:00
Special section for running the EIVE OBSW on the Raspberry Pi.
The Raspberry Pi build uses the `bsp_rpi` BSP folder, and a very similar cross-compiler.
2021-02-14 14:41:44 +01:00
For running the software on a Raspberry Pi, it is recommended to follow the steps specified in
[the fsfw example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/mueller/master/doc/README-rpi.md#top)
and using the TCF agent to have a similar set-up process also required for the Q7S.
2021-02-14 14:43:25 +01:00
You should run the following command first on your Raspberry Pi
2021-02-14 14:41:44 +01:00
```sh
sudo apt-get install gpiod libgpiod-dev
```
2021-02-14 14:43:25 +01:00
to install the required GPIO libraries before cloning the system root folder.
2021-02-14 14:41:44 +01:00
## Special notes on Eclipse
When using Eclipse, there are two special build variables in the project properties
&rarr; C/C++ Build &rarr; Build Variables called `Q7S_SYSROOT` or `RPI_SYSROOT`. You can set
the sysroot path in those variables to get any additional includes like `gpiod.h` in the
2021-04-12 10:16:59 +02:00
Eclipse indexer.
## Xilinx UARTLIE
Get info about ttyUL* devices
````
cat /proc/tty/driver
````
2021-04-24 12:46:08 +02:00
## I2C
Getting information about I2C device
````
ls /sys/class/i2c-dev/i2c-0/device/device/driver
````
This shows the memory mapping of /dev/i2c-0
## Useful Q7S Linux Commands
Rebooting currently running image:
````
xsc_boot_copy -r
2021-05-24 14:08:55 +02:00
````