aboutsummaryrefslogtreecommitdiff
path: root/examples/local_minimal.rs
diff options
context:
space:
mode:
authorGravatar Per <Per Lindgren> 2020-03-04 15:06:03 +0100
committerGravatar Henrik Tjäder <henrik@tjaders.com> 2020-10-15 15:56:20 +0000
commit6eafcf10e944fb5875c086631dde7fad6f0a7b3b (patch)
tree93b9f9abaa346c8813cf63af7d36c2ef9fb6cee8 /examples/local_minimal.rs
parentf5cf64e35c85f45e8ddefda7c8957a262bd028f6 (diff)
downloadrtic-6eafcf10e944fb5875c086631dde7fad6f0a7b3b.tar.gz
rtic-6eafcf10e944fb5875c086631dde7fad6f0a7b3b.tar.zst
rtic-6eafcf10e944fb5875c086631dde7fad6f0a7b3b.zip
task_local and lock_free analysis (take 1)
Diffstat (limited to 'examples/local_minimal.rs')
-rw-r--r--examples/local_minimal.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/local_minimal.rs b/examples/local_minimal.rs
new file mode 100644
index 00000000..13531c5e
--- /dev/null
+++ b/examples/local_minimal.rs
@@ -0,0 +1,30 @@
+//! examples/local_minimal.rs
+#![deny(unsafe_code)]
+#![deny(warnings)]
+#![no_main]
+#![no_std]
+
+use cortex_m_semihosting::{debug, hprintln};
+use panic_semihosting as _;
+
+#[rtfm::app(device = lm3s6965)]
+const APP: () = {
+ 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 {}
+ }
+};