From 413f525c933e0beba498b486afc3a81b84951989 Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Mon, 14 Sep 2020 09:35:10 +0200 Subject: [PATCH] Fixed so examples do not crash in release mode --- examples/binds.rs | 4 +++- examples/cfg.rs | 4 +++- examples/hardware.rs | 4 +++- examples/idle.rs | 4 +++- examples/resource.rs | 4 +++- examples/t-cfg-resources.rs | 4 +++- examples/t-cfg.rs | 4 +++- examples/t-idle-main.rs | 4 +++- examples/t-late-not-send.rs | 4 +++- examples/t-resource.rs | 4 +++- examples/t-schedule.rs | 4 +++- examples/t-spawn.rs | 4 +++- examples/types.rs | 4 +++- 13 files changed, 39 insertions(+), 13 deletions(-) diff --git a/examples/binds.rs b/examples/binds.rs index faf315f471..82bf89640f 100644 --- a/examples/binds.rs +++ b/examples/binds.rs @@ -27,7 +27,9 @@ const APP: () = { debug::exit(debug::EXIT_SUCCESS); - loop {} + loop { + cortex_m::asm::nop(); + } } #[task(binds = UART0)] diff --git a/examples/cfg.rs b/examples/cfg.rs index 02b39e349b..8eeeb2a93a 100644 --- a/examples/cfg.rs +++ b/examples/cfg.rs @@ -28,7 +28,9 @@ const APP: () = { fn idle(_: idle::Context) -> ! { debug::exit(debug::EXIT_SUCCESS); - loop {} + loop { + cortex_m::asm::nop(); + } } #[task(capacity = 2, resources = [count], spawn = [log])] diff --git a/examples/hardware.rs b/examples/hardware.rs index 9f1c664ea8..8105a7420d 100644 --- a/examples/hardware.rs +++ b/examples/hardware.rs @@ -30,7 +30,9 @@ const APP: () = { debug::exit(debug::EXIT_SUCCESS); - loop {} + loop { + cortex_m::asm::nop(); + } } #[task(binds = UART0)] diff --git a/examples/idle.rs b/examples/idle.rs index c09af92200..3d28dac8a7 100644 --- a/examples/idle.rs +++ b/examples/idle.rs @@ -26,6 +26,8 @@ const APP: () = { debug::exit(debug::EXIT_SUCCESS); - loop {} + loop { + cortex_m::asm::nop(); + } } }; diff --git a/examples/resource.rs b/examples/resource.rs index ded97f8ed4..2361fd0033 100644 --- a/examples/resource.rs +++ b/examples/resource.rs @@ -31,7 +31,9 @@ const APP: () = { // error: no `resources` field in `idle::Context` // _cx.resources.shared += 1; - loop {} + loop { + cortex_m::asm::nop(); + } } // `shared` can be accessed from this context diff --git a/examples/t-cfg-resources.rs b/examples/t-cfg-resources.rs index eb00fe5923..4f7fd635a7 100644 --- a/examples/t-cfg-resources.rs +++ b/examples/t-cfg-resources.rs @@ -31,6 +31,8 @@ const APP: () = { #[idle] fn idle(_cx: idle::Context) -> ! { - loop {} + loop { + cortex_m::asm::nop(); + } } }; diff --git a/examples/t-cfg.rs b/examples/t-cfg.rs index 52e6d1c9d3..b6c9e47207 100644 --- a/examples/t-cfg.rs +++ b/examples/t-cfg.rs @@ -24,7 +24,9 @@ const APP: () = { #[cfg(never)] static mut BAR: u32 = 0; - loop {} + loop { + cortex_m::asm::nop(); + } } #[task(resources = [foo], schedule = [quux], spawn = [quux])] diff --git a/examples/t-idle-main.rs b/examples/t-idle-main.rs index 94a3317452..051a9ee812 100644 --- a/examples/t-idle-main.rs +++ b/examples/t-idle-main.rs @@ -14,6 +14,8 @@ const APP: () = { #[idle] fn main(_: main::Context) -> ! { debug::exit(debug::EXIT_SUCCESS); - loop {} + loop { + cortex_m::asm::nop(); + } } }; diff --git a/examples/t-late-not-send.rs b/examples/t-late-not-send.rs index c464e73b64..d2a9b63ce9 100644 --- a/examples/t-late-not-send.rs +++ b/examples/t-late-not-send.rs @@ -31,6 +31,8 @@ const APP: () = { #[idle(resources = [x, y])] fn idle(_: idle::Context) -> ! { - loop {} + loop { + cortex_m::asm::nop(); + } } }; diff --git a/examples/t-resource.rs b/examples/t-resource.rs index 53665dc933..81ba18563f 100644 --- a/examples/t-resource.rs +++ b/examples/t-resource.rs @@ -58,7 +58,9 @@ const APP: () = { // `&` if read-only let _: &u32 = c.resources.s3; - loop {} + loop { + cortex_m::asm::nop(); + } } #[task(binds = UART0, resources = [o3, s1, s2, &s3])] diff --git a/examples/t-schedule.rs b/examples/t-schedule.rs index 4a23182273..3854aad36b 100644 --- a/examples/t-schedule.rs +++ b/examples/t-schedule.rs @@ -23,7 +23,9 @@ const APP: () = { let _: Result<(), u32> = c.schedule.bar(Instant::now() + 50.cycles(), 0); let _: Result<(), (u32, u32)> = c.schedule.baz(Instant::now() + 60.cycles(), 0, 1); - loop {} + loop { + cortex_m::asm::nop(); + } } #[task(binds = SVCall, schedule = [foo, bar, baz])] diff --git a/examples/t-spawn.rs b/examples/t-spawn.rs index 2d941b1567..35831ccf9d 100644 --- a/examples/t-spawn.rs +++ b/examples/t-spawn.rs @@ -22,7 +22,9 @@ const APP: () = { let _: Result<(), u32> = c.spawn.bar(0); let _: Result<(), (u32, u32)> = c.spawn.baz(0, 1); - loop {} + loop { + cortex_m::asm::nop(); + } } #[task(binds = SVCall, spawn = [foo, bar, baz])] diff --git a/examples/types.rs b/examples/types.rs index e14ab0c811..5233f868b1 100644 --- a/examples/types.rs +++ b/examples/types.rs @@ -32,7 +32,9 @@ const APP: () = { let _: idle::Schedule = cx.schedule; let _: idle::Spawn = cx.spawn; - loop {} + loop { + cortex_m::asm::nop(); + } } #[task(binds = UART0, resources = [shared], schedule = [foo], spawn = [foo])]