Fixed so examples do not crash in release mode

This commit is contained in:
Emil Fresk 2020-09-14 09:35:10 +02:00
parent c5e6d1fa49
commit 413f525c93
13 changed files with 39 additions and 13 deletions

View file

@ -27,7 +27,9 @@ const APP: () = {
debug::exit(debug::EXIT_SUCCESS); debug::exit(debug::EXIT_SUCCESS);
loop {} loop {
cortex_m::asm::nop();
}
} }
#[task(binds = UART0)] #[task(binds = UART0)]

View file

@ -28,7 +28,9 @@ const APP: () = {
fn idle(_: idle::Context) -> ! { fn idle(_: idle::Context) -> ! {
debug::exit(debug::EXIT_SUCCESS); debug::exit(debug::EXIT_SUCCESS);
loop {} loop {
cortex_m::asm::nop();
}
} }
#[task(capacity = 2, resources = [count], spawn = [log])] #[task(capacity = 2, resources = [count], spawn = [log])]

View file

@ -30,7 +30,9 @@ const APP: () = {
debug::exit(debug::EXIT_SUCCESS); debug::exit(debug::EXIT_SUCCESS);
loop {} loop {
cortex_m::asm::nop();
}
} }
#[task(binds = UART0)] #[task(binds = UART0)]

View file

@ -26,6 +26,8 @@ const APP: () = {
debug::exit(debug::EXIT_SUCCESS); debug::exit(debug::EXIT_SUCCESS);
loop {} loop {
cortex_m::asm::nop();
}
} }
}; };

View file

@ -31,7 +31,9 @@ const APP: () = {
// error: no `resources` field in `idle::Context` // error: no `resources` field in `idle::Context`
// _cx.resources.shared += 1; // _cx.resources.shared += 1;
loop {} loop {
cortex_m::asm::nop();
}
} }
// `shared` can be accessed from this context // `shared` can be accessed from this context

View file

@ -31,6 +31,8 @@ const APP: () = {
#[idle] #[idle]
fn idle(_cx: idle::Context) -> ! { fn idle(_cx: idle::Context) -> ! {
loop {} loop {
cortex_m::asm::nop();
}
} }
}; };

View file

@ -24,7 +24,9 @@ const APP: () = {
#[cfg(never)] #[cfg(never)]
static mut BAR: u32 = 0; static mut BAR: u32 = 0;
loop {} loop {
cortex_m::asm::nop();
}
} }
#[task(resources = [foo], schedule = [quux], spawn = [quux])] #[task(resources = [foo], schedule = [quux], spawn = [quux])]

View file

@ -14,6 +14,8 @@ const APP: () = {
#[idle] #[idle]
fn main(_: main::Context) -> ! { fn main(_: main::Context) -> ! {
debug::exit(debug::EXIT_SUCCESS); debug::exit(debug::EXIT_SUCCESS);
loop {} loop {
cortex_m::asm::nop();
}
} }
}; };

View file

@ -31,6 +31,8 @@ const APP: () = {
#[idle(resources = [x, y])] #[idle(resources = [x, y])]
fn idle(_: idle::Context) -> ! { fn idle(_: idle::Context) -> ! {
loop {} loop {
cortex_m::asm::nop();
}
} }
}; };

View file

@ -58,7 +58,9 @@ const APP: () = {
// `&` if read-only // `&` if read-only
let _: &u32 = c.resources.s3; let _: &u32 = c.resources.s3;
loop {} loop {
cortex_m::asm::nop();
}
} }
#[task(binds = UART0, resources = [o3, s1, s2, &s3])] #[task(binds = UART0, resources = [o3, s1, s2, &s3])]

View file

@ -23,7 +23,9 @@ const APP: () = {
let _: Result<(), u32> = c.schedule.bar(Instant::now() + 50.cycles(), 0); let _: Result<(), u32> = c.schedule.bar(Instant::now() + 50.cycles(), 0);
let _: Result<(), (u32, u32)> = c.schedule.baz(Instant::now() + 60.cycles(), 0, 1); 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])] #[task(binds = SVCall, schedule = [foo, bar, baz])]

View file

@ -22,7 +22,9 @@ const APP: () = {
let _: Result<(), u32> = c.spawn.bar(0); let _: Result<(), u32> = c.spawn.bar(0);
let _: Result<(), (u32, u32)> = c.spawn.baz(0, 1); let _: Result<(), (u32, u32)> = c.spawn.baz(0, 1);
loop {} loop {
cortex_m::asm::nop();
}
} }
#[task(binds = SVCall, spawn = [foo, bar, baz])] #[task(binds = SVCall, spawn = [foo, bar, baz])]

View file

@ -32,7 +32,9 @@ const APP: () = {
let _: idle::Schedule = cx.schedule; let _: idle::Schedule = cx.schedule;
let _: idle::Spawn = cx.spawn; let _: idle::Spawn = cx.spawn;
loop {} loop {
cortex_m::asm::nop();
}
} }
#[task(binds = UART0, resources = [shared], schedule = [foo], spawn = [foo])] #[task(binds = UART0, resources = [shared], schedule = [foo], spawn = [foo])]