From 5c9df20ed198ad2db24b44c56a823380325a2e4c Mon Sep 17 00:00:00 2001 From: paul nehlich Date: Tue, 25 Jun 2024 12:12:09 +0200 Subject: [PATCH 1/4] Should build now, sorry --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bcffc80..6b5b4f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ set (LWIP_INCLUDE_DIRS "${LWIP_DIR}/src/include" "${BSP_PATH}/lwip" ) -include(${LWIP_DIR}/src/Filelists.cmake) +#include(${LWIP_DIR}/src/Filelists.cmake) set(lwip_SRCS ${lwipcore_SRCS} ${lwipcore4_SRCS} From c9a81c025fee962f540f116dc2de7a5bae14a39e Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Tue, 25 Jun 2024 13:19:19 +0200 Subject: [PATCH 2/4] removed unused fsfw submodule file --- fsfw | 1 - 1 file changed, 1 deletion(-) delete mode 160000 fsfw diff --git a/fsfw b/fsfw deleted file mode 160000 index 8b9a468..0000000 --- a/fsfw +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8b9a468893a49d100ad5a543656c3864e0be8203 From a7336c7f758875c88b17f7f6cd4530a0e74a9fed Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Tue, 25 Jun 2024 13:19:31 +0200 Subject: [PATCH 3/4] handling failed freeRTOS assertion as panic --- mission/main.c | 9 +++++++++ mission_rust/src/lib.rs | 23 ++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/mission/main.c b/mission/main.c index 243036e..c420bbf 100644 --- a/mission/main.c +++ b/mission/main.c @@ -241,6 +241,7 @@ void vApplicationMallocFailedHook(void) { timers, and semaphores. The size of the FreeRTOS heap is set by the configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */ taskDISABLE_INTERRUPTS(); + //TODO panic for (;;) ; } @@ -254,6 +255,7 @@ void vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName) { configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is called if a stack overflow is detected. */ taskDISABLE_INTERRUPTS(); + //TODO panic for (;;) ; } @@ -277,7 +279,14 @@ void vApplicationIdleHook(void) { } /*-----------------------------------------------------------*/ +void rust_assert_called(const char *pcFile, unsigned long ulLine); + + void vAssertCalled(const char *pcFile, unsigned long ulLine) { + + rust_assert_called(pcFile, ulLine); + + volatile unsigned long ul = 0; (void)pcFile; diff --git a/mission_rust/src/lib.rs b/mission_rust/src/lib.rs index 514ad7a..2a0d92f 100644 --- a/mission_rust/src/lib.rs +++ b/mission_rust/src/lib.rs @@ -21,8 +21,10 @@ fn panic(panic: &PanicInfo<'_>) -> ! { osal::stop_it(); } // TODO: Make this unicode-safe - sif!("In Task \""); + sifln!(""); + sif!("in task \""); unsafe { + //TODO is from_ptr safe enough? let task_name = core::ffi::CStr::from_ptr(osal::get_task_name()); let task_name_utf8 = core::str::from_utf8(task_name.to_bytes()); match task_name_utf8 { @@ -41,6 +43,25 @@ fn panic(panic: &PanicInfo<'_>) -> ! { loop {} } +#[no_mangle] +extern "C" fn rust_assert_called(ptr: *const core::ffi::c_char, line: core::ffi::c_ulong) { + let file_name = unsafe { + //TODO is from_ptr safe enough? + let file_name = core::ffi::CStr::from_ptr(ptr); + let file_name_utf8 = core::str::from_utf8(file_name.to_bytes()); + match file_name_utf8 { + Ok(string) => { + string + } + Err(_) => { + "Schei� Encoding" + } + } + }; + + panic!("assertion failed at {file_name}:{}", line); +} + #[no_mangle] extern "C" fn rust_main() { sifln!("Rust startup 🚀"); From 5707c9f8ae39f510e4dd922ef0630762f4900cd4 Mon Sep 17 00:00:00 2001 From: paul nehlich Date: Wed, 26 Jun 2024 16:23:02 +0200 Subject: [PATCH 4/4] Docker Tutorial updated (by Andy, just pasting it here) --- BUILD_WITH_DOCKER.md | 45 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/BUILD_WITH_DOCKER.md b/BUILD_WITH_DOCKER.md index f447fc2..79387fa 100644 --- a/BUILD_WITH_DOCKER.md +++ b/BUILD_WITH_DOCKER.md @@ -1,7 +1,7 @@ -## Prerequisits for build with Docker -##### Info +## Prerequisites for building with Docker +##### Please Note IRS wireguard VPN can cause network issues with docker. ##### Install Docker @@ -9,6 +9,11 @@ If you are using macOS or Windows, please use this tutorial: - https://www.docker.com/get-started/ On Linux simply use your package manager to install ```docker``` and prepare everything using these commands, to avoid permission denied errors: +On Arch Linux this would look like +```sh +sudo apt-get install docker # Ubuntu +sudo packman -Syy docker # Arch +``` ```sh sudo systemctl start docker @@ -16,9 +21,9 @@ sudo groupadd docker sudo usermod -aG docker $USER sudo reboot ``` +Congratulations, you installed docker. Please proceed. - -## FSBL +## First Stage Boot Loader (FSBL) FSBL is the First Stage Boot Loader and prepares the CPU and FPGA configuration for booting up the Second Stage Bootloader and finally the flight software. @@ -27,7 +32,7 @@ FSBL is the First Stage Boot Loader and prepares the CPU and FPGA configuration ```sh cd docker/compile_fsbl/ git clone https://github.com/Xilinx/embeddedsw/ -docker build -t compile_fsbl . +docker build -t compile_fsbl . # Legacy builder is deprecated and will be removed in future release. TODO ``` ##### To build the FSBL, run the following command in the `docker/compile-fsbl` directory: @@ -35,14 +40,23 @@ docker build -t compile_fsbl . docker run -v ./embeddedsw:/fsbl compile_fsbl /bin/bash -c "cd lib/sw_apps/zynq_fsbl/src && make BOARD=zed SHELL=/bin/bash" ``` +## Requirements [TBC]: +```sh +sudo apt-get install cdoxygen graphviz make arm-none-eabi-gcc # Ubuntu +sudo packman -Syy cmake adoxygen graphviz rm-none-eabi-gcc # Arch +``` +1. `doxygen` - tool to generate documentation for C++, C, ... +2. `graphviz` - graph visualisation +3. `cmake` - cross-platform build system +4. `arm-none-eabi-gcc` - precompiled GNU toolchain for certain ARM processors including GCC and GNU Debugger (GDB) -If you want, copy the fsbl.elf to the docker/compile_fsbl directory for easier access: +If you want, copy the `fsbl.elf` to the `docker/compile_fsbl` directory for easier access: ```sh cp embeddedsw/lib/sw_apps/zynq_fsbl/src/fsbl.elf . ``` ## Steps -1. Configure doxygen: +1. Configure `doxygen`: ## mission_rust @@ -50,6 +64,23 @@ cp embeddedsw/lib/sw_apps/zynq_fsbl/src/fsbl.elf . ```sh export DOT_PATH=/usr/local/bin ``` +2. Satisfy Rust requirements +```sh +cd ../mission_rust +cargo update +rustup toolchain install nightly +rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu +rustup override set nightly +cargo build -Z build-std +cd docker/compile_mission/ +docker build -t compile_mission . +``` + +3. Configure the ROMEO OBSW repository in `.../obsw/` +##### To build the mission_rust, run the following command in the `docker/compile_mission` directory: +```sh +docker run -v $(pwd)/../../mission_rust:/mission_rust compile_mission /bin/bash -c "cargo build -Z build-std" +``` ## obsw