diff options
author | 2020-10-15 16:01:07 +0000 | |
---|---|---|
committer | 2020-10-15 16:01:07 +0000 | |
commit | 1cda9eaeccbfd9b008bfa40b54b127a2bfa5324e (patch) | |
tree | a17b4ec23f91483649f928021303ebf234727326 /examples/task-local-minimal.rs | |
parent | ee0885063d5b1cc4eddd3918ff425796f6213464 (diff) | |
parent | 37ee3a47afbbbf57751243d6d32aaac78073780c (diff) | |
download | rtic-1cda9eaeccbfd9b008bfa40b54b127a2bfa5324e.tar.gz rtic-1cda9eaeccbfd9b008bfa40b54b127a2bfa5324e.tar.zst rtic-1cda9eaeccbfd9b008bfa40b54b127a2bfa5324e.zip |
Merge #371
371: task_local and lock_free r=korken89 a=AfoHT
Getting this going to test with GHA
For further discussion see https://github.com/rtic-rs/rfcs/issues/30
Co-authored-by: Per <Per Lindgren>
Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
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(); + } + } +} |