From c7657f7b1eae2f4b40b6a406dffef12d3355b33a Mon Sep 17 00:00:00 2001 From: Jayachandran Dharuman Date: Sun, 23 Feb 2025 20:29:45 +0100 Subject: [PATCH 1/3] Updated FreeRTOS-Rust Linux setup instruction information in README doc --- freertos-rust-examples/README.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/freertos-rust-examples/README.md b/freertos-rust-examples/README.md index 6343bc7..b447f5c 100644 --- a/freertos-rust-examples/README.md +++ b/freertos-rust-examples/README.md @@ -2,7 +2,7 @@ ## Setup -We need to use nightly toolchain to support all examples. +We need to use nightly toolchain to support all examples. Even if some might run with the stable toolchain as well. **GNU Toolchain** is required for debugging some examples (e.g. windows): @@ -46,7 +46,7 @@ To see all errors use: ### Run Windows Demo -You need to build with nightly GNU to allow debugging. +You need to build with nightly GNU to allow debugging. The target must be `x86_64-pc-windows-msvc` for the FreeRTOS `MSVC-MingW` port. Prepare the build with: @@ -60,14 +60,22 @@ Run the build ### Run Linux Demo - Prepare the build with: - rustup default x86_64-unknown-linux-gnu + rustup default nightly + rustup toolchain install nightly rustup target add x86_64-unknown-linux-gnu - + rustup component add llvm-tools-preview + cargo install cargo-binutils + + sudo apt install gcc g++ make + Run the build + cargo build --package freertos-rust-examples --example linux --target x86_64-unknown-linux-gnu + +Run the example + cargo run --package freertos-rust-examples --example linux --target x86_64-unknown-linux-gnu ### Run STM32 Cortex-M3 Demo @@ -126,21 +134,21 @@ Create the Toolchain under: `File | Settings | Build, Execution, Deployment | To * Name: `arm-none-eabi` * Debugger: `/path/to/arm-none-eabi-gdb.exe` -Build: +Build: * Name: `build-nrf9160-example` * Programm: `cargo` * Arguments: `build --package freertos-rust-examples --example nrf9160 --target thumbv8m.main-none-eabihf` * Working directory: `$ProjectFileDir$` -Clean: +Clean: * Name: `clean` * Programm: `cargo` * Arguments: `clean` * Working directory: `$ProjectFileDir$` -Setup a Run Configuration: +Setup a Run Configuration: * Executable: `target\thumbv8m.main-none-eabihf\debug\examples\nrf9160` (only selectable after first build!) * Download executable: `Always` From 73a993c234e5fde00b31b6002089af39a93782f7 Mon Sep 17 00:00:00 2001 From: Jayachandran Dharuman Date: Sun, 23 Feb 2025 20:49:19 +0100 Subject: [PATCH 2/3] Removed mut keyword from Freertos hook set_on_assert() callback register --- freertos-rust/src/hooks.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freertos-rust/src/hooks.rs b/freertos-rust/src/hooks.rs index d4ccdac..fb6ae91 100644 --- a/freertos-rust/src/hooks.rs +++ b/freertos-rust/src/hooks.rs @@ -11,11 +11,11 @@ pub struct FreeRtosHooks { } impl FreeRtosHooks { - pub fn set_on_assert(&mut self, c: Callback) -> Result<(), Callback> { + pub fn set_on_assert(&self, c: Callback) -> Result<(), Callback> { self.on_assert.set(c) } - fn do_on_assert(&self) { + pub fn do_on_assert(&self) { if let Some (cb) = self.on_assert.get() { cb() } From 2dad63b0303e4557f02404472cc81ee208caffc3 Mon Sep 17 00:00:00 2001 From: Jayachandran Dharuman Date: Sun, 13 Apr 2025 22:31:38 +0200 Subject: [PATCH 3/3] Reverted the changes --- freertos-rust/src/hooks.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freertos-rust/src/hooks.rs b/freertos-rust/src/hooks.rs index fb6ae91..d4ccdac 100644 --- a/freertos-rust/src/hooks.rs +++ b/freertos-rust/src/hooks.rs @@ -11,11 +11,11 @@ pub struct FreeRtosHooks { } impl FreeRtosHooks { - pub fn set_on_assert(&self, c: Callback) -> Result<(), Callback> { + pub fn set_on_assert(&mut self, c: Callback) -> Result<(), Callback> { self.on_assert.set(c) } - pub fn do_on_assert(&self) { + fn do_on_assert(&self) { if let Some (cb) = self.on_assert.get() { cb() }