aboutsummaryrefslogtreecommitdiff
path: root/examples/init.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/init.rs')
-rw-r--r--examples/init.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/examples/init.rs b/examples/init.rs
index be6cfe3e..6ac284a1 100644
--- a/examples/init.rs
+++ b/examples/init.rs
@@ -5,28 +5,32 @@
#![no_main]
#![no_std]
-extern crate panic_semihosting;
-
use cortex_m_semihosting::{debug, hprintln};
-use rtfm::app;
+use panic_semihosting as _;
-#[app(device = lm3s6965)]
-const APP: () = {
+#[rtic::app(device = lm3s6965, peripherals = true)]
+mod app {
#[init]
- fn init() {
+ fn init(cx: init::Context) -> init::LateResources {
static mut X: u32 = 0;
// Cortex-M peripherals
- let _core: rtfm::Peripherals = core;
+ let _core: cortex_m::Peripherals = cx.core;
// Device specific peripherals
- let _device: lm3s6965::Peripherals = device;
+ let _device: lm3s6965::Peripherals = cx.device;
// Safe access to local `static mut` variable
let _x: &'static mut u32 = X;
+ // Access to the critical section token,
+ // to indicate that this is a critical seciton
+ let _cs_token: bare_metal::CriticalSection = cx.cs;
+
hprintln!("init").unwrap();
debug::exit(debug::EXIT_SUCCESS);
+
+ init::LateResources {}
}
-};
+}