From 67cccbd4819c4d874780a6b388d7f10c1c8031b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 21:09:44 +0000 Subject: [PATCH 1/6] Update cortex-m-semihosting requirement from 0.3.3 to 0.5.0 Updates the requirements on [cortex-m-semihosting](https://github.com/rust-embedded/cortex-m) to permit the latest version. - [Release notes](https://github.com/rust-embedded/cortex-m/releases) - [Changelog](https://github.com/rust-embedded/cortex-m/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-embedded/cortex-m/compare/c-m-sh-v0.3.5...v0.5.0) --- updated-dependencies: - dependency-name: cortex-m-semihosting dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 61f8e56eb2..b5529e2dac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ version_check = "0.9" [dev-dependencies] lm3s6965 = "0.1.3" -cortex-m-semihosting = "0.3.3" +cortex-m-semihosting = "0.5.0" systick-monotonic = "1.0.0" [dev-dependencies.panic-semihosting] From 1fe587c5160b9e99bbb67644318cb9e5c9c56b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Wed, 11 Jan 2023 21:33:44 +0100 Subject: [PATCH 2/6] Remove unwrap() from hprintln!() sd 'hprintln(.*).unwrap\(\)' 'hprintln' (fd -e rs .) --- examples/binds.rs | 4 ++-- examples/capacity.rs | 4 ++-- examples/complex.rs | 2 +- examples/destructure.rs | 4 ++-- examples/extern_binds.rs | 4 ++-- examples/extern_spawn.rs | 2 +- examples/generics.rs | 6 +++--- examples/hardware.rs | 4 ++-- examples/idle-wfi.rs | 4 ++-- examples/idle.rs | 4 ++-- examples/init.rs | 2 +- examples/locals.rs | 6 +++--- examples/lock-free.rs | 4 ++-- examples/lock.rs | 10 +++++----- examples/message.rs | 6 +++--- examples/message_passing.rs | 2 +- examples/multilock.rs | 2 +- examples/only-shared-access.rs | 4 ++-- examples/pool.rs | 4 ++-- examples/preempt.rs | 10 +++++----- examples/ramfunc.rs | 2 +- examples/resource-user-struct.rs | 4 ++-- examples/shared.rs | 2 +- examples/spawn.rs | 4 ++-- examples/static.rs | 2 +- examples/task.rs | 10 +++++----- 26 files changed, 56 insertions(+), 56 deletions(-) diff --git a/examples/binds.rs b/examples/binds.rs index 56565cbec9..04b8fad19e 100644 --- a/examples/binds.rs +++ b/examples/binds.rs @@ -23,14 +23,14 @@ mod app { fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { rtic::pend(Interrupt::UART0); - hprintln!("init").unwrap(); + hprintln!("init"); (Shared {}, Local {}, init::Monotonics()) } #[idle] fn idle(_: idle::Context) -> ! { - hprintln!("idle").unwrap(); + hprintln!("idle"); rtic::pend(Interrupt::UART0); diff --git a/examples/capacity.rs b/examples/capacity.rs index a617269869..e625249af8 100644 --- a/examples/capacity.rs +++ b/examples/capacity.rs @@ -37,12 +37,12 @@ mod app { #[task(capacity = 4)] fn foo(_: foo::Context, x: u32) { - hprintln!("foo({})", x).unwrap(); + hprintln!("foo({})", x); } #[task] fn bar(_: bar::Context) { - hprintln!("bar").unwrap(); + hprintln!("bar"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/complex.rs b/examples/complex.rs index e5cf6dbea3..653198746b 100644 --- a/examples/complex.rs +++ b/examples/complex.rs @@ -25,7 +25,7 @@ mod app { #[init] fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { - hprintln!("init").unwrap(); + hprintln!("init"); ( Shared { diff --git a/examples/destructure.rs b/examples/destructure.rs index 6019c225cc..fd577a6c9c 100644 --- a/examples/destructure.rs +++ b/examples/destructure.rs @@ -42,7 +42,7 @@ mod app { let b = cx.shared.b; let c = cx.shared.c; - hprintln!("foo: a = {}, b = {}, c = {}", a, b, c).unwrap(); + hprintln!("foo: a = {}, b = {}, c = {}", a, b, c); } // De-structure-ing syntax @@ -50,6 +50,6 @@ mod app { fn bar(cx: bar::Context) { let bar::SharedResources { a, b, c } = cx.shared; - hprintln!("bar: a = {}, b = {}, c = {}", a, b, c).unwrap(); + hprintln!("bar: a = {}, b = {}, c = {}", a, b, c); } } diff --git a/examples/extern_binds.rs b/examples/extern_binds.rs index 4dc6633c5d..b6df2fb257 100644 --- a/examples/extern_binds.rs +++ b/examples/extern_binds.rs @@ -29,14 +29,14 @@ mod app { fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { rtic::pend(Interrupt::UART0); - hprintln!("init").unwrap(); + hprintln!("init"); (Shared {}, Local {}, init::Monotonics()) } #[idle] fn idle(_: idle::Context) -> ! { - hprintln!("idle").unwrap(); + hprintln!("idle"); rtic::pend(Interrupt::UART0); diff --git a/examples/extern_spawn.rs b/examples/extern_spawn.rs index 7f9b5a5f9b..2eec2dbc49 100644 --- a/examples/extern_spawn.rs +++ b/examples/extern_spawn.rs @@ -10,7 +10,7 @@ use panic_semihosting as _; // Free function implementing the spawnable task `foo`. fn foo(_c: app::foo::Context, x: i32, y: u32) { - hprintln!("foo {}, {}", x, y).unwrap(); + hprintln!("foo {}, {}", x, y); if x == 2 { debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/generics.rs b/examples/generics.rs index 72b861ba91..f9a6aacfc8 100644 --- a/examples/generics.rs +++ b/examples/generics.rs @@ -32,7 +32,7 @@ mod app { #[task(binds = UART0, shared = [shared], local = [state: u32 = 0])] fn uart0(c: uart0::Context) { - hprintln!("UART0(STATE = {})", *c.local.state).unwrap(); + hprintln!("UART0(STATE = {})", *c.local.state); // second argument has type `shared::shared` super::advance(c.local.state, c.shared.shared); @@ -44,7 +44,7 @@ mod app { #[task(binds = UART1, priority = 2, shared = [shared], local = [state: u32 = 0])] fn uart1(c: uart1::Context) { - hprintln!("UART1(STATE = {})", *c.local.state).unwrap(); + hprintln!("UART1(STATE = {})", *c.local.state); // second argument has type `shared::shared` super::advance(c.local.state, c.shared.shared); @@ -61,5 +61,5 @@ fn advance(state: &mut u32, mut shared: impl Mutex) { (old, *shared) }); - hprintln!("shared: {} -> {}", old, new).unwrap(); + hprintln!("shared: {} -> {}", old, new); } diff --git a/examples/hardware.rs b/examples/hardware.rs index 60632247fb..22cf5d928d 100644 --- a/examples/hardware.rs +++ b/examples/hardware.rs @@ -24,7 +24,7 @@ mod app { // `init` returns because interrupts are disabled rtic::pend(Interrupt::UART0); // equivalent to NVIC::pend - hprintln!("init").unwrap(); + hprintln!("init"); (Shared {}, Local {}, init::Monotonics()) } @@ -33,7 +33,7 @@ mod app { fn idle(_: idle::Context) -> ! { // interrupts are enabled again; the `UART0` handler runs at this point - hprintln!("idle").unwrap(); + hprintln!("idle"); rtic::pend(Interrupt::UART0); diff --git a/examples/idle-wfi.rs b/examples/idle-wfi.rs index 4a8a8dee2b..42fd7b49e0 100644 --- a/examples/idle-wfi.rs +++ b/examples/idle-wfi.rs @@ -19,7 +19,7 @@ mod app { #[init] fn init(mut cx: init::Context) -> (Shared, Local, init::Monotonics) { - hprintln!("init").unwrap(); + hprintln!("init"); // Set the ARM SLEEPONEXIT bit to go to sleep after handling interrupts // See https://developer.arm.com/docs/100737/0100/power-management/sleep-mode/sleep-on-exit-bit @@ -33,7 +33,7 @@ mod app { // Locals in idle have lifetime 'static let _x: &'static mut u32 = cx.local.x; - hprintln!("idle").unwrap(); + hprintln!("idle"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator diff --git a/examples/idle.rs b/examples/idle.rs index 55d6b15352..ad04fd68e4 100644 --- a/examples/idle.rs +++ b/examples/idle.rs @@ -19,7 +19,7 @@ mod app { #[init] fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { - hprintln!("init").unwrap(); + hprintln!("init"); (Shared {}, Local {}, init::Monotonics()) } @@ -29,7 +29,7 @@ mod app { // Locals in idle have lifetime 'static let _x: &'static mut u32 = cx.local.x; - hprintln!("idle").unwrap(); + hprintln!("idle"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator diff --git a/examples/init.rs b/examples/init.rs index b8a5bc5b98..7a10149692 100644 --- a/examples/init.rs +++ b/examples/init.rs @@ -32,7 +32,7 @@ mod app { // to indicate that this is a critical seciton let _cs_token: bare_metal::CriticalSection = cx.cs; - hprintln!("init").unwrap(); + hprintln!("init"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator diff --git a/examples/locals.rs b/examples/locals.rs index aa5d0fee30..1889775316 100644 --- a/examples/locals.rs +++ b/examples/locals.rs @@ -45,7 +45,7 @@ mod app { let local_to_idle = cx.local.local_to_idle; *local_to_idle += 1; - hprintln!("idle: local_to_idle = {}", local_to_idle).unwrap(); + hprintln!("idle: local_to_idle = {}", local_to_idle); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator @@ -69,7 +69,7 @@ mod app { // error: no `local_to_bar` field in `foo::LocalResources` // cx.local.local_to_bar += 1; - hprintln!("foo: local_to_foo = {}", local_to_foo).unwrap(); + hprintln!("foo: local_to_foo = {}", local_to_foo); } // `local_to_bar` can only be accessed from this context @@ -81,6 +81,6 @@ mod app { // error: no `local_to_foo` field in `bar::LocalResources` // cx.local.local_to_foo += 1; - hprintln!("bar: local_to_bar = {}", local_to_bar).unwrap(); + hprintln!("bar: local_to_bar = {}", local_to_bar); } } diff --git a/examples/lock-free.rs b/examples/lock-free.rs index ea6ff1bf37..32853e44ed 100644 --- a/examples/lock-free.rs +++ b/examples/lock-free.rs @@ -33,7 +33,7 @@ mod app { *c.shared.counter += 1; // <- no lock API required let counter = *c.shared.counter; - hprintln!(" foo = {}", counter).unwrap(); + hprintln!(" foo = {}", counter); } #[task(shared = [counter])] // <- same priority @@ -42,7 +42,7 @@ mod app { *c.shared.counter += 1; // <- no lock API required let counter = *c.shared.counter; - hprintln!(" bar = {}", counter).unwrap(); + hprintln!(" bar = {}", counter); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/lock.rs b/examples/lock.rs index f1a16968ce..16f3b33812 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -29,7 +29,7 @@ mod app { // when omitted priority is assumed to be `1` #[task(shared = [shared])] fn foo(mut c: foo::Context) { - hprintln!("A").unwrap(); + hprintln!("A"); // the lower priority task requires a critical section to access the data c.shared.shared.lock(|shared| { @@ -39,7 +39,7 @@ mod app { // bar will *not* run right now due to the critical section bar::spawn().unwrap(); - hprintln!("B - shared = {}", *shared).unwrap(); + hprintln!("B - shared = {}", *shared); // baz does not contend for `shared` so it's allowed to run now baz::spawn().unwrap(); @@ -47,7 +47,7 @@ mod app { // critical section is over: bar can now start - hprintln!("E").unwrap(); + hprintln!("E"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } @@ -61,11 +61,11 @@ mod app { *shared }); - hprintln!("D - shared = {}", shared).unwrap(); + hprintln!("D - shared = {}", shared); } #[task(priority = 3)] fn baz(_: baz::Context) { - hprintln!("C").unwrap(); + hprintln!("C"); } } diff --git a/examples/message.rs b/examples/message.rs index 76c5675aaa..a5c89199ee 100644 --- a/examples/message.rs +++ b/examples/message.rs @@ -26,7 +26,7 @@ mod app { #[task(local = [count: u32 = 0])] fn foo(cx: foo::Context) { - hprintln!("foo").unwrap(); + hprintln!("foo"); bar::spawn(*cx.local.count).unwrap(); *cx.local.count += 1; @@ -34,14 +34,14 @@ mod app { #[task] fn bar(_: bar::Context, x: u32) { - hprintln!("bar({})", x).unwrap(); + hprintln!("bar({})", x); baz::spawn(x + 1, x + 2).unwrap(); } #[task] fn baz(_: baz::Context, x: u32, y: u32) { - hprintln!("baz({}, {})", x, y).unwrap(); + hprintln!("baz({}, {})", x, y); if x + y > 4 { debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator diff --git a/examples/message_passing.rs b/examples/message_passing.rs index ffa9537127..13e3b98de3 100644 --- a/examples/message_passing.rs +++ b/examples/message_passing.rs @@ -29,7 +29,7 @@ mod app { #[task(capacity = 3)] fn foo(_c: foo::Context, x: i32, y: u32) { - hprintln!("foo {}, {}", x, y).unwrap(); + hprintln!("foo {}, {}", x, y); if x == 2 { debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/multilock.rs b/examples/multilock.rs index d99bae695e..83df8d7d4e 100644 --- a/examples/multilock.rs +++ b/examples/multilock.rs @@ -48,7 +48,7 @@ mod app { *s2 += 1; *s3 += 1; - hprintln!("Multiple locks, s1: {}, s2: {}, s3: {}", *s1, *s2, *s3).unwrap(); + hprintln!("Multiple locks, s1: {}, s2: {}, s3: {}", *s1, *s2, *s3); }); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator diff --git a/examples/only-shared-access.rs b/examples/only-shared-access.rs index 8b0a77ef8c..c9826d09b0 100644 --- a/examples/only-shared-access.rs +++ b/examples/only-shared-access.rs @@ -30,13 +30,13 @@ mod app { #[task(shared = [&key])] fn foo(cx: foo::Context) { let key: &u32 = cx.shared.key; - hprintln!("foo(key = {:#x})", key).unwrap(); + hprintln!("foo(key = {:#x})", key); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } #[task(priority = 2, shared = [&key])] fn bar(cx: bar::Context) { - hprintln!("bar(key = {:#x})", cx.shared.key).unwrap(); + hprintln!("bar(key = {:#x})", cx.shared.key); } } diff --git a/examples/pool.rs b/examples/pool.rs index d59bd91607..5014e216d3 100644 --- a/examples/pool.rs +++ b/examples/pool.rs @@ -56,7 +56,7 @@ mod app { #[task] fn foo(_: foo::Context, x: Box

) { - hprintln!("foo({:?})", x.as_ptr()).unwrap(); + hprintln!("foo({:?})", x.as_ptr()); // explicitly return the block to the pool drop(x); @@ -66,7 +66,7 @@ mod app { #[task(priority = 2)] fn bar(_: bar::Context, x: Box

) { - hprintln!("bar({:?})", x.as_ptr()).unwrap(); + hprintln!("bar({:?})", x.as_ptr()); // this is done automatically so we can omit the call to `drop` // drop(x); diff --git a/examples/preempt.rs b/examples/preempt.rs index d0c8cc7d3f..3c7f242990 100644 --- a/examples/preempt.rs +++ b/examples/preempt.rs @@ -25,21 +25,21 @@ mod app { #[task(priority = 1)] fn foo(_: foo::Context) { - hprintln!("foo - start").unwrap(); + hprintln!("foo - start"); baz::spawn().unwrap(); - hprintln!("foo - end").unwrap(); + hprintln!("foo - end"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } #[task(priority = 2)] fn bar(_: bar::Context) { - hprintln!(" bar").unwrap(); + hprintln!(" bar"); } #[task(priority = 2)] fn baz(_: baz::Context) { - hprintln!(" baz - start").unwrap(); + hprintln!(" baz - start"); bar::spawn().unwrap(); - hprintln!(" baz - end").unwrap(); + hprintln!(" baz - end"); } } diff --git a/examples/ramfunc.rs b/examples/ramfunc.rs index b3b8012c38..049af18fbe 100644 --- a/examples/ramfunc.rs +++ b/examples/ramfunc.rs @@ -33,7 +33,7 @@ mod app { #[inline(never)] #[task] fn foo(_: foo::Context) { - hprintln!("foo").unwrap(); + hprintln!("foo"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/resource-user-struct.rs b/examples/resource-user-struct.rs index ae1918d05d..39a5b16c8a 100644 --- a/examples/resource-user-struct.rs +++ b/examples/resource-user-struct.rs @@ -55,7 +55,7 @@ mod app { *shared }); - hprintln!("UART0: shared = {}", shared).unwrap(); + hprintln!("UART0: shared = {}", shared); } // `shared` can be accessed from this context @@ -66,6 +66,6 @@ mod app { *shared }); - hprintln!("UART1: shared = {}", shared).unwrap(); + hprintln!("UART1: shared = {}", shared); } } diff --git a/examples/shared.rs b/examples/shared.rs index d87dca5263..58d64e4191 100644 --- a/examples/shared.rs +++ b/examples/shared.rs @@ -34,7 +34,7 @@ mod app { fn idle(mut c: idle::Context) -> ! { loop { if let Some(byte) = c.shared.c.lock(|c| c.dequeue()) { - hprintln!("received message: {}", byte).unwrap(); + hprintln!("received message: {}", byte); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } else { diff --git a/examples/spawn.rs b/examples/spawn.rs index 2db1ab8a28..75b7f85fe8 100644 --- a/examples/spawn.rs +++ b/examples/spawn.rs @@ -19,7 +19,7 @@ mod app { #[init] fn init(_: init::Context) -> (Shared, Local, init::Monotonics) { - hprintln!("init").unwrap(); + hprintln!("init"); foo::spawn().unwrap(); (Shared {}, Local {}, init::Monotonics()) @@ -27,7 +27,7 @@ mod app { #[task] fn foo(_: foo::Context) { - hprintln!("foo").unwrap(); + hprintln!("foo"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/static.rs b/examples/static.rs index c9aa6046b5..abeb9c525a 100644 --- a/examples/static.rs +++ b/examples/static.rs @@ -37,7 +37,7 @@ mod app { loop { // Lock-free access to the same underlying queue! if let Some(data) = c.local.c.dequeue() { - hprintln!("received message: {}", data).unwrap(); + hprintln!("received message: {}", data); // Run foo until data if data == 3 { diff --git a/examples/task.rs b/examples/task.rs index 2c53aa2359..d24fca6261 100644 --- a/examples/task.rs +++ b/examples/task.rs @@ -26,31 +26,31 @@ mod app { #[task] fn foo(_: foo::Context) { - hprintln!("foo - start").unwrap(); + hprintln!("foo - start"); // spawns `bar` onto the task scheduler // `foo` and `bar` have the same priority so `bar` will not run until // after `foo` terminates bar::spawn().unwrap(); - hprintln!("foo - middle").unwrap(); + hprintln!("foo - middle"); // spawns `baz` onto the task scheduler // `baz` has higher priority than `foo` so it immediately preempts `foo` baz::spawn().unwrap(); - hprintln!("foo - end").unwrap(); + hprintln!("foo - end"); } #[task] fn bar(_: bar::Context) { - hprintln!("bar").unwrap(); + hprintln!("bar"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } #[task(priority = 2)] fn baz(_: baz::Context) { - hprintln!("baz").unwrap(); + hprintln!("baz"); } } From c370c0b21f054fa224680b95df63ca3d59f33ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Wed, 11 Jan 2023 21:40:33 +0100 Subject: [PATCH 3/6] Remove ok() from hprintln!() sd 'hprintln(.*).ok\(\)' 'hprintln' (fd -e rs .) --- examples/cancel-reschedule.rs | 8 +++---- examples/common.rs | 6 ++--- examples/complex.rs | 42 +++++++++++++++++------------------ examples/extern_binds.rs | 2 +- examples/periodic-at.rs | 2 +- examples/periodic-at2.rs | 4 ++-- examples/periodic.rs | 2 +- examples/schedule.rs | 8 +++---- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/examples/cancel-reschedule.rs b/examples/cancel-reschedule.rs index a38a9c4eae..7ab437f272 100644 --- a/examples/cancel-reschedule.rs +++ b/examples/cancel-reschedule.rs @@ -28,7 +28,7 @@ mod app { // Initialize the monotonic (SysTick rate in QEMU is 12 MHz) let mono = Systick::new(systick, 12_000_000); - hprintln!("init").ok(); + hprintln!("init"); // Schedule `foo` to run 1 second in the future foo::spawn_after(1.secs()).unwrap(); @@ -42,7 +42,7 @@ mod app { #[task] fn foo(_: foo::Context) { - hprintln!("foo").ok(); + hprintln!("foo"); // Schedule `bar` to run 2 seconds in the future (1 second after foo runs) let spawn_handle = baz::spawn_after(2.secs()).unwrap(); @@ -51,7 +51,7 @@ mod app { #[task] fn bar(_: bar::Context, baz_handle: baz::SpawnHandle, do_reschedule: bool) { - hprintln!("bar").ok(); + hprintln!("bar"); if do_reschedule { // Reschedule baz 2 seconds from now, instead of the original 1 second @@ -67,7 +67,7 @@ mod app { #[task] fn baz(_: baz::Context) { - hprintln!("baz").ok(); + hprintln!("baz"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } } diff --git a/examples/common.rs b/examples/common.rs index 1fe671e61a..7dcc5421a9 100644 --- a/examples/common.rs +++ b/examples/common.rs @@ -73,7 +73,7 @@ mod app { // This task is only spawned once in `init`, hence this task will run // only once - hprintln!("foo").ok(); + hprintln!("foo"); } // Software task, also not bound to a hardware interrupt @@ -81,7 +81,7 @@ mod app { // The resources `s1` and `s2` are shared between all other tasks. #[task(shared = [s1, s2], local = [l2])] fn bar(_: bar::Context) { - hprintln!("bar").ok(); + hprintln!("bar"); // Run `bar` once per second bar::spawn_after(1.secs()).unwrap(); @@ -97,6 +97,6 @@ mod app { // Note that RTIC does NOT clear the interrupt flag, this is up to the // user - hprintln!("UART0 interrupt!").ok(); + hprintln!("UART0 interrupt!"); } } diff --git a/examples/complex.rs b/examples/complex.rs index 653198746b..742f9c7dc4 100644 --- a/examples/complex.rs +++ b/examples/complex.rs @@ -40,31 +40,31 @@ mod app { #[idle(shared = [s2, s3])] fn idle(mut cx: idle::Context) -> ! { - hprintln!("idle p0 started").ok(); + hprintln!("idle p0 started"); rtic::pend(Interrupt::GPIOC); cx.shared.s3.lock(|s| { - hprintln!("idle enter lock s3 {}", s).ok(); - hprintln!("idle pend t0").ok(); + hprintln!("idle enter lock s3 {}", s); + hprintln!("idle pend t0"); rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 3 - hprintln!("idle pend t1").ok(); + hprintln!("idle pend t1"); rtic::pend(Interrupt::GPIOB); // t1 p3, with shared ceiling 3 - hprintln!("idle pend t2").ok(); + hprintln!("idle pend t2"); rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing - hprintln!("idle still in lock s3 {}", s).ok(); + hprintln!("idle still in lock s3 {}", s); }); - hprintln!("\nback in idle").ok(); + hprintln!("\nback in idle"); cx.shared.s2.lock(|s| { - hprintln!("enter lock s2 {}", s).ok(); - hprintln!("idle pend t0").ok(); + hprintln!("enter lock s2 {}", s); + hprintln!("idle pend t0"); rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2 - hprintln!("idle pend t1").ok(); + hprintln!("idle pend t1"); rtic::pend(Interrupt::GPIOB); // t1 p3, no sharing - hprintln!("idle pend t2").ok(); + hprintln!("idle pend t2"); rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing - hprintln!("idle still in lock s2 {}", s).ok(); + hprintln!("idle still in lock s2 {}", s); }); - hprintln!("\nidle exit").ok(); + hprintln!("\nidle exit"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator @@ -84,7 +84,7 @@ mod app { if *cx.local.times > 1 { "s" } else { "" } ) .ok(); - hprintln!("t0 p2 exit").ok(); + hprintln!("t0 p2 exit"); } #[task(binds = GPIOB, priority = 3, local = [times: u32 = 0], shared = [s3, s4])] @@ -100,15 +100,15 @@ mod app { .ok(); cx.shared.s4.lock(|s| { - hprintln!("t1 enter lock s4 {}", s).ok(); - hprintln!("t1 pend t0").ok(); + hprintln!("t1 enter lock s4 {}", s); + hprintln!("t1 pend t0"); rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2 - hprintln!("t1 pend t2").ok(); + hprintln!("t1 pend t2"); rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing - hprintln!("t1 still in lock s4 {}", s).ok(); + hprintln!("t1 still in lock s4 {}", s); }); - hprintln!("t1 p3 exit").ok(); + hprintln!("t1 p3 exit"); } #[task(binds = GPIOC, priority = 4, local = [times: u32 = 0], shared = [s4])] @@ -124,9 +124,9 @@ mod app { .unwrap(); cx.shared.s4.lock(|s| { - hprintln!("enter lock s4 {}", s).ok(); + hprintln!("enter lock s4 {}", s); *s += 1; }); - hprintln!("t3 p4 exit").ok(); + hprintln!("t3 p4 exit"); } } diff --git a/examples/extern_binds.rs b/examples/extern_binds.rs index b6df2fb257..e445f4ecca 100644 --- a/examples/extern_binds.rs +++ b/examples/extern_binds.rs @@ -10,7 +10,7 @@ use panic_semihosting as _; // Free function implementing the interrupt bound task `foo`. fn foo(_: app::foo::Context) { - hprintln!("foo called").ok(); + hprintln!("foo called"); } #[rtic::app(device = lm3s6965)] diff --git a/examples/periodic-at.rs b/examples/periodic-at.rs index f9fd995fb0..1116210248 100644 --- a/examples/periodic-at.rs +++ b/examples/periodic-at.rs @@ -35,7 +35,7 @@ mod app { #[task(local = [cnt: u32 = 0])] fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) { - hprintln!("foo {:?}", instant).ok(); + hprintln!("foo {:?}", instant); *cx.local.cnt += 1; if *cx.local.cnt == 4 { diff --git a/examples/periodic-at2.rs b/examples/periodic-at2.rs index 879f709c65..35ebb52f5b 100644 --- a/examples/periodic-at2.rs +++ b/examples/periodic-at2.rs @@ -36,7 +36,7 @@ mod app { // Using the explicit type of the timer implementation #[task(local = [cnt: u32 = 0])] fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) { - hprintln!("foo {:?}", instant).ok(); + hprintln!("foo {:?}", instant); *cx.local.cnt += 1; if *cx.local.cnt == 4 { @@ -52,7 +52,7 @@ mod app { // This remains agnostic to the timer implementation #[task(local = [cnt: u32 = 0])] fn bar(_cx: bar::Context, instant: ::Instant) { - hprintln!("bar {:?}", instant).ok(); + hprintln!("bar {:?}", instant); // Spawn a new message with 1s offset to spawned time let next_instant = instant + 1.secs(); diff --git a/examples/periodic.rs b/examples/periodic.rs index 40c69257e7..5d66735c28 100644 --- a/examples/periodic.rs +++ b/examples/periodic.rs @@ -35,7 +35,7 @@ mod app { #[task(local = [cnt: u32 = 0])] fn foo(cx: foo::Context) { - hprintln!("foo").ok(); + hprintln!("foo"); *cx.local.cnt += 1; if *cx.local.cnt == 4 { diff --git a/examples/schedule.rs b/examples/schedule.rs index 5bad5a30ad..58e73dad18 100644 --- a/examples/schedule.rs +++ b/examples/schedule.rs @@ -28,7 +28,7 @@ mod app { // Initialize the monotonic (SysTick rate in QEMU is 12 MHz) let mono = Systick::new(systick, 12_000_000); - hprintln!("init").ok(); + hprintln!("init"); // Schedule `foo` to run 1 second in the future foo::spawn_after(1.secs()).unwrap(); @@ -42,7 +42,7 @@ mod app { #[task] fn foo(_: foo::Context) { - hprintln!("foo").ok(); + hprintln!("foo"); // Schedule `bar` to run 2 seconds in the future (1 second after foo runs) bar::spawn_after(1.secs()).unwrap(); @@ -50,7 +50,7 @@ mod app { #[task] fn bar(_: bar::Context) { - hprintln!("bar").ok(); + hprintln!("bar"); // Schedule `baz` to run 1 seconds from now, but with a specific time instant. baz::spawn_at(monotonics::now() + 1.secs()).unwrap(); @@ -58,7 +58,7 @@ mod app { #[task] fn baz(_: baz::Context) { - hprintln!("baz").ok(); + hprintln!("baz"); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } } From 050313d62d84dd9f537bbc578213f18cd7640d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Wed, 11 Jan 2023 21:48:21 +0100 Subject: [PATCH 4/6] Missed hprintln with multiline --- examples/binds.rs | 3 +-- examples/cfg-whole-task.rs | 3 +-- examples/complex.rs | 9 +++------ examples/hardware.rs | 3 +-- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/examples/binds.rs b/examples/binds.rs index 04b8fad19e..db5bd96f1a 100644 --- a/examples/binds.rs +++ b/examples/binds.rs @@ -49,7 +49,6 @@ mod app { "foo called {} time{}", *cx.local.times, if *cx.local.times > 1 { "s" } else { "" } - ) - .unwrap(); + ); } } diff --git a/examples/cfg-whole-task.rs b/examples/cfg-whole-task.rs index f41866db47..90fb9ccc9b 100644 --- a/examples/cfg-whole-task.rs +++ b/examples/cfg-whole-task.rs @@ -88,7 +88,6 @@ mod app { "foo has been called {} time{}", n, if n == 1 { "" } else { "s" } - ) - .ok(); + ); } } diff --git a/examples/complex.rs b/examples/complex.rs index 742f9c7dc4..2be71d22fb 100644 --- a/examples/complex.rs +++ b/examples/complex.rs @@ -82,8 +82,7 @@ mod app { "t0 p2 called {} time{}", *cx.local.times, if *cx.local.times > 1 { "s" } else { "" } - ) - .ok(); + ); hprintln!("t0 p2 exit"); } @@ -96,8 +95,7 @@ mod app { "t1 p3 called {} time{}", *cx.local.times, if *cx.local.times > 1 { "s" } else { "" } - ) - .ok(); + ); cx.shared.s4.lock(|s| { hprintln!("t1 enter lock s4 {}", s); @@ -120,8 +118,7 @@ mod app { "t2 p4 called {} time{}", *cx.local.times, if *cx.local.times > 1 { "s" } else { "" } - ) - .unwrap(); + ); cx.shared.s4.lock(|s| { hprintln!("enter lock s4 {}", s); diff --git a/examples/hardware.rs b/examples/hardware.rs index 22cf5d928d..8f29455969 100644 --- a/examples/hardware.rs +++ b/examples/hardware.rs @@ -53,7 +53,6 @@ mod app { "UART0 called {} time{}", *cx.local.times, if *cx.local.times > 1 { "s" } else { "" } - ) - .unwrap(); + ); } } From 9764121cc1cdd6a7c27e86fa8d65bb6d2d48dc27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Sat, 14 Jan 2023 11:24:51 +0100 Subject: [PATCH 5/6] Upgrade of semihosting changed timing New semihosting 0.5 does not use error handling, returns directly and as semihosting is generally slow this led to missing print statements. Workaround is to add NOP, which seems sufficient to let it flush the buffers --- examples/binds.rs | 5 +++-- examples/extern_binds.rs | 5 +++-- examples/generics.rs | 3 +++ examples/hardware.rs | 5 +++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/binds.rs b/examples/binds.rs index db5bd96f1a..601f245a0c 100644 --- a/examples/binds.rs +++ b/examples/binds.rs @@ -34,10 +34,11 @@ mod app { rtic::pend(Interrupt::UART0); - debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator - loop { + // Exit moved after nop to ensure that rtic::pend gets + // to run before exiting cortex_m::asm::nop(); + debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } } diff --git a/examples/extern_binds.rs b/examples/extern_binds.rs index e445f4ecca..c2186cb7fb 100644 --- a/examples/extern_binds.rs +++ b/examples/extern_binds.rs @@ -40,10 +40,11 @@ mod app { rtic::pend(Interrupt::UART0); - debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator - loop { cortex_m::asm::nop(); + // Exit moved after nop to ensure that rtic::pend gets + // to run before exiting + debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } } diff --git a/examples/generics.rs b/examples/generics.rs index f9a6aacfc8..6243d562e8 100644 --- a/examples/generics.rs +++ b/examples/generics.rs @@ -39,6 +39,9 @@ mod app { rtic::pend(Interrupt::UART1); + // Exit moved after nop to ensure that rtic::pend gets + // to run before exiting + cortex_m::asm::nop(); debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } diff --git a/examples/hardware.rs b/examples/hardware.rs index 8f29455969..590bf6ab66 100644 --- a/examples/hardware.rs +++ b/examples/hardware.rs @@ -37,10 +37,11 @@ mod app { rtic::pend(Interrupt::UART0); - debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator - loop { + // Exit moved after nop to ensure that rtic::pend gets + // to run before exiting cortex_m::asm::nop(); + debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator } } From de3056eb3dd98f0859949fd32647cc90663f43e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Tj=C3=A4der?= Date: Sat, 14 Jan 2023 22:00:14 +0100 Subject: [PATCH 6/6] Add to CHANGELOG dev-dependency cortex-m-semihosting upgraded --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78a725380a..612b8076fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top! ### Changed +- Updated dev-dependency cortex-m-semihosting to v0.5 - CI: Updated to setup-python@v4 - CI: Updated to checkout@v3 - Tuned redirect message for rtic.rs/meeting