From d07294980a74659a38692af3ad957c703dba1187 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 29 Dec 2020 15:04:08 +0100 Subject: [PATCH 1/2] reamde update --- README.md | 88 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index f4d5c5f5..0dd496c5 100644 --- a/README.md +++ b/README.md @@ -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 → Zynq-7000:
@@ -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. ```` -- 2.43.0 From ffe22036c6765e9a4716975351323e7edd68f676 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 29 Dec 2020 18:06:52 +0100 Subject: [PATCH 2/2] suppressed warning flags --- CMakeLists.txt | 5 +++- bsp_rpi/CMakeLists.txt | 1 + bsp_rpi/boardtest/CMakeLists.txt | 7 ++++++ bsp_rpi/boardtest/SpiTest.cpp | 43 ++++++++++++++++++++++++++++++++ bsp_rpi/boardtest/SpiTest.h | 31 +++++++++++++++++++++++ fsfw | 2 +- libcsp/include/CMakeLists.txt | 2 -- 7 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 bsp_rpi/boardtest/CMakeLists.txt create mode 100644 bsp_rpi/boardtest/SpiTest.cpp create mode 100644 bsp_rpi/boardtest/SpiTest.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 1786f1af..e0b00d30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/bsp_rpi/CMakeLists.txt b/bsp_rpi/CMakeLists.txt index 8dd8e6f1..7885ca28 100644 --- a/bsp_rpi/CMakeLists.txt +++ b/bsp_rpi/CMakeLists.txt @@ -5,6 +5,7 @@ target_sources(${TARGET_NAME} PUBLIC ) add_subdirectory(boardconfig) +add_subdirectory(boardtest) diff --git a/bsp_rpi/boardtest/CMakeLists.txt b/bsp_rpi/boardtest/CMakeLists.txt new file mode 100644 index 00000000..768fc52f --- /dev/null +++ b/bsp_rpi/boardtest/CMakeLists.txt @@ -0,0 +1,7 @@ +target_sources(${TARGET_NAME} PRIVATE + SpiTest.cpp +) + + + + diff --git a/bsp_rpi/boardtest/SpiTest.cpp b/bsp_rpi/boardtest/SpiTest.cpp new file mode 100644 index 00000000..91939714 --- /dev/null +++ b/bsp_rpi/boardtest/SpiTest.cpp @@ -0,0 +1,43 @@ +#include "SpiTest.h" + +#include + +#include +#include +#include + +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; +} \ No newline at end of file diff --git a/bsp_rpi/boardtest/SpiTest.h b/bsp_rpi/boardtest/SpiTest.h new file mode 100644 index 00000000..9bdb8f25 --- /dev/null +++ b/bsp_rpi/boardtest/SpiTest.h @@ -0,0 +1,31 @@ +#ifndef BSP_LINUX_TEST_SPITEST_H_ +#define BSP_LINUX_TEST_SPITEST_H_ + +#include +#include +#include +#include + +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_ */ diff --git a/fsfw b/fsfw index 8ef6283b..1ac2479b 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 8ef6283bf4f5cf5d12131c48365a753825fea637 +Subproject commit 1ac2479b28c1114b0876123e0db4155abfbf06fe diff --git a/libcsp/include/CMakeLists.txt b/libcsp/include/CMakeLists.txt index cc80ebb5..196e26f3 100644 --- a/libcsp/include/CMakeLists.txt +++ b/libcsp/include/CMakeLists.txt @@ -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 -- 2.43.0