Merge pull request 'Update' (#12) from mueller/master into develop

Reviewed-on: eive/eive_obsw#12
This commit is contained in:
Jakob Meier 2020-12-29 18:11:11 +01:00
commit ac01d54804
8 changed files with 138 additions and 41 deletions

View File

@ -19,6 +19,8 @@ if(NOT OS_FSFW)
set(OS_FSFW host CACHE STRING "OS for the FSFW.")
endif()
set_property(CACHE OS_FSFW PROPERTY STRINGS host linux)
# Perform steps like loading toolchain files where applicable.
include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
pre_project_config()
@ -44,6 +46,8 @@ set(FSFW_PATH fsfw)
set(MISSION_PATH mission)
set(CSPLIB_PATH libcsp)
set(WARNING_SHADOW_LOCAL FALSE)
# Analyse different OS and architecture/target options, determine BSP_PATH,
# display information about compiler etc.
include (${CMAKE_SCRIPT_PATH}/HardwareOsPreConfig.cmake)
@ -110,7 +114,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNING_FLAGS
-Wall
-Wextra
-Wshadow=local
-Wimplicit-fallthrough=1
-Wno-unused-parameter
-Wno-psabi

View File

@ -4,7 +4,7 @@
Target systems:
* OBC
* OBC with Linux OS
* Xiphos Q7S
* Based on Zynq-7020 SoC (xc7z020clg484-2)
* Dual-core ARM Cortex-A9
@ -12,16 +12,19 @@ Target systems:
* 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
* 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
* Linux OS
* Built with Yocto 2.5
* Linux OS built with Yocto 2.5
* Linux Kernel https://github.com/XiphosSystemsCorp/linux-xlnx.git
* Host System
* Generic software components which are not dependant on hardware can also
be run. All host code is contained in the hosted folder
* Tested for Linux (Ubuntu 20.04) and Windows 10
* Raspberry Pi
* EIVE OBC can be built for Raspberry Pi as well (either directly on Raspberry Pi or by installing a cross compiler)
The steps in the primary README are related to the main OBC target Q7S.
## Setting up development environment
* 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.
Install the Vivado Design Suite - HLx Editions - 2018.2 Full Product Installation instead of the updates. It is recommended to use the installer
* Install settings. In the Devices selection, it is sufficient to pick SoC &rarr; Zynq-7000: <br>
@ -133,65 +136,76 @@ git submodule update
## Debugging the software via Flatsat PC
Open SSH connection to flatsat PC:
````
```sh
ssh eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5
````
```
To access the console of the Q7S run the following:
```sh
picocom -b 115200 /dev/ttyUSB0
```
To debug an application, first make sure a static IP address is assigned to the Q7S. Run ifconfig on the Q7S serial console.
````
```sh
ifconfig
````
```
Set IP address and netmask with
````
```sh
ifconfig eth0 192.168.133.10
ifconfig eth0 netmask 255.255.255.0
````
```
To launch application from Xilinx SDK setup port fowarding on the localhost.
````
```sh
ssh -L 1534:192.168.133.10:1534 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5
````
```
This forwards any requests to localhost:1534 to the port 1534 of the Q7S with the IP address 192.168.133.10.
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.
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.
## Launching an application after boot
Load the root partiton from the flash memory (there are to nor-flash memories and each flash holds two xdi images).
Note: It is not possible to modify the current loaded root partition.
1. Disable write protection of the desired root partition
````
writeprotect 0 0 0 # unlocks nominal image on nor-flash 0
````
```sh
writeprotect 0 0 0 # unlocks nominal image on nor-flash 0
```
2. Mount the root partition
````
xsc_mount_copy 0 0 # Mounts the nominal image from nor-flash 0
````
```sh
xsc_mount_copy 0 0 # Mounts the nominal image from nor-flash 0
```
3. Copy the executable to /bin/usr
4. Make sure the permissions to execute the application are set
````
chmod +x application
````
```sh
chmod +x application
```
5. Create systemd service in /lib/systemd/system. The following shows an example service.
````
cat > example.service
[Unit]
Description=Example Service
StartLimitIntervalSec=0
```sh
cat > example.service
[Unit]
Description=Example Service
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/application
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/application
[Install]
WantedBy=multi-user.target
````
[Install]
WantedBy=multi-user.target
```
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.
````

View File

@ -5,6 +5,7 @@ target_sources(${TARGET_NAME} PUBLIC
)
add_subdirectory(boardconfig)
add_subdirectory(boardtest)

View File

@ -0,0 +1,7 @@
target_sources(${TARGET_NAME} PRIVATE
SpiTest.cpp
)

View File

@ -0,0 +1,43 @@
#include "SpiTest.h"
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <wiringPi.h>
SpiTest::SpiTest(object_id_t objectId): SystemObject(objectId) {
wiringPiSetupGpio();
int spiFd = open(spiDeviceName.c_str(), O_RDWR);
if (spiFd < 0){
sif::error << "Could not open SPI device!" << std::endl;
}
spiMode = SPI_MODE_3;
int ret = ioctl(spiFd, SPI_IOC_WR_MODE, &spiMode);
if(ret < 0) {
sif::error << "Could not set write mode!" << std::endl;
}
/* Datenrate setzen */
ret = ioctl(spiFd, SPI_IOC_WR_MAX_SPEED_HZ, &spiSpeed);
if(ret < 0) {
sif::error << "Could not SPI speed!" << std::endl;
}
}
ReturnValue_t SpiTest::performOperation(uint8_t opCode) {
if(oneShot) {
}
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t SpiTest::initialize() {
//transferHandle.rx_buf = reinterpret_cast<__u64>(receiveBuffer);
//transferHandle.tx_buf = reinterpret_cast<__u64>(sendBuffer);
//transferHandle.speed_hz = 976000;
//transferHandle.len = 2;
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -0,0 +1,31 @@
#ifndef BSP_LINUX_TEST_SPITEST_H_
#define BSP_LINUX_TEST_SPITEST_H_
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/tasks/ExecutableObjectIF.h>
#include <linux/spi/spidev.h>
#include <string>
class SpiTest: public ExecutableObjectIF, SystemObject {
public:
SpiTest(object_id_t objectId);
ReturnValue_t performOperation(uint8_t opCode) override;
ReturnValue_t initialize() override;
private:
const std::string spiDeviceName = "/dev/spidev0.0";
int spiFd = 0;
uint8_t spiMode = SPI_MODE_3;
uint32_t spiSpeed = 976000;
uint8_t sendBuffer[32];
uint8_t receiveBuffer[32];
struct spi_ioc_transfer transferHandle;
bool oneShot = true;
};
#endif /* BSP_LINUX_TEST_SPITEST_H_ */

2
fsfw

@ -1 +1 @@
Subproject commit 8ef6283bf4f5cf5d12131c48365a753825fea637
Subproject commit 1ac2479b28c1114b0876123e0db4155abfbf06fe

View File

@ -1,7 +1,5 @@
target_include_directories(${LIB_CSP_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/csp
${CMAKE_CURRENT_SOURCE_DIR}/csp/crypto
)
target_include_directories(${LIB_CSP_NAME} INTERFACE