diff options
author | 2020-10-15 18:27:48 +0200 | |
---|---|---|
committer | 2020-10-15 18:27:48 +0200 | |
commit | 6808cc7cdf1512a7b10dd43f268f430a676c606e (patch) | |
tree | 67c0eadf6d8a98a2691b816d46a5103d159d6bbc /examples/task-local-minimal.rs | |
parent | c5b5ea60e826a7b95bd04055a722ecdc332df1d0 (diff) | |
parent | f9303cef1cf5b2d57d26e7667289fbdccf959ea8 (diff) | |
download | rtic-6808cc7cdf1512a7b10dd43f268f430a676c606e.tar.gz rtic-6808cc7cdf1512a7b10dd43f268f430a676c606e.tar.zst rtic-6808cc7cdf1512a7b10dd43f268f430a676c606e.zip |
Merge branch 'master' into spawn_experiment
Diffstat (limited to 'examples/task-local-minimal.rs')
-rw-r--r-- | examples/task-local-minimal.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/task-local-minimal.rs b/examples/task-local-minimal.rs new file mode 100644 index 00000000..fd5ac68a --- /dev/null +++ b/examples/task-local-minimal.rs @@ -0,0 +1,33 @@ +//! examples/task-local_minimal.rs +#![deny(unsafe_code)] +#![deny(warnings)] +#![no_main] +#![no_std] + +use cortex_m_semihosting::{debug, hprintln}; +use panic_semihosting as _; + +#[rtic::app(device = lm3s6965)] +mod app { + #[resources] + struct Resources { + // A local (move), late resource + #[task_local] + l: u32, + } + + #[init] + fn init(_: init::Context) -> init::LateResources { + init::LateResources { l: 42 } + } + + // l is task_local + #[idle(resources =[l])] + fn idle(cx: idle::Context) -> ! { + hprintln!("IDLE:l = {}", cx.resources.l).unwrap(); + debug::exit(debug::EXIT_SUCCESS); + loop { + cortex_m::asm::nop(); + } + } +} |