diff --git a/Cargo.toml b/Cargo.toml index 3729038775..550141f67c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,10 +18,6 @@ version = "0.6.0-alpha.0" [lib] name = "rtic" -[[example]] -name = "baseline" -required-features = ["__v7"] - [[example]] name = "periodic" required-features = ["__v7"] diff --git a/examples/baseline.rs b/examples/baseline.rs deleted file mode 100644 index 17278748d5..0000000000 --- a/examples/baseline.rs +++ /dev/null @@ -1,50 +0,0 @@ -//! examples/baseline.rs - -#![deny(unsafe_code)] -#![deny(warnings)] -#![no_main] -#![no_std] - -use panic_semihosting as _; - -// NOTE: does NOT properly work on QEMU -#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])] -mod app { - use cortex_m_semihosting::{debug, hprintln}; - use lm3s6965::Interrupt; - - #[init] - fn init(cx: init::Context) -> init::LateResources { - // omitted: initialization of `CYCCNT` - - hprintln!("init(baseline = {:?})", cx.start).unwrap(); - - // `foo` inherits the baseline of `init`: `Instant(0)` - foo::spawn().unwrap(); - - init::LateResources {} - } - - #[task] - fn foo(cx: foo::Context) { - static mut ONCE: bool = true; - - hprintln!("foo(baseline = {:?})", cx.scheduled).unwrap(); - - if *ONCE { - *ONCE = false; - - rtic::pend(Interrupt::UART0); - } else { - debug::exit(debug::EXIT_SUCCESS); - } - } - - #[task(binds = UART0)] - fn uart0(cx: uart0::Context) { - hprintln!("UART0(baseline = {:?})", cx.start).unwrap(); - - // `foo` inherits the baseline of `UART0`: its `start` time - foo::spawn().unwrap(); - } -} diff --git a/examples/big-struct-opt.rs b/examples/big-struct-opt.rs index 85ec5e6144..dc6e72f78d 100644 --- a/examples/big-struct-opt.rs +++ b/examples/big-struct-opt.rs @@ -31,7 +31,7 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { let big_struct = unsafe { static mut BIG_STRUCT: MaybeUninit = MaybeUninit::uninit(); @@ -40,9 +40,12 @@ mod app { &mut *BIG_STRUCT.as_mut_ptr() }; - init::LateResources { - // assign the reference so we can use the resource - big_struct, - } + ( + init::LateResources { + // assign the reference so we can use the resource + big_struct, + }, + init::Monotonics(), + ) } } diff --git a/examples/binds.rs b/examples/binds.rs index f681aa5724..9cbe299486 100644 --- a/examples/binds.rs +++ b/examples/binds.rs @@ -14,12 +14,12 @@ mod app { use lm3s6965::Interrupt; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::UART0); hprintln!("init").unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[idle] diff --git a/examples/capacity.rs b/examples/capacity.rs index b25a758446..06bd921ebc 100644 --- a/examples/capacity.rs +++ b/examples/capacity.rs @@ -13,10 +13,10 @@ mod app { use lm3s6965::Interrupt; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::UART0); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task(binds = UART0)] diff --git a/examples/cfg-whole-task.rs b/examples/cfg-whole-task.rs index b19c280c9b..47c3530e17 100644 --- a/examples/cfg-whole-task.rs +++ b/examples/cfg-whole-task.rs @@ -24,11 +24,11 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { foo::spawn().unwrap(); foo::spawn().unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[idle] diff --git a/examples/cfg.rs b/examples/cfg.rs index d3f2cea126..43c2593cea 100644 --- a/examples/cfg.rs +++ b/examples/cfg.rs @@ -21,11 +21,11 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { foo::spawn().unwrap(); foo::spawn().unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[idle] diff --git a/examples/destructure.rs b/examples/destructure.rs index d843978b4f..d085e4bf3f 100644 --- a/examples/destructure.rs +++ b/examples/destructure.rs @@ -24,11 +24,11 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::UART0); rtic::pend(Interrupt::UART1); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } // Direct destructure diff --git a/examples/double_schedule.rs b/examples/double_schedule.rs index 32477efe9b..77a8e38e91 100644 --- a/examples/double_schedule.rs +++ b/examples/double_schedule.rs @@ -7,20 +7,13 @@ use panic_semihosting as _; -#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])] +#[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { - use rtic::cyccnt::U32Ext; - - #[resources] - struct Resources { - nothing: (), - } - #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { task1::spawn().ok(); - init::LateResources { nothing: () } + (init::LateResources {}, init::Monotonics()) } #[task] diff --git a/examples/extern_binds.rs b/examples/extern_binds.rs index 632f4ca02b..3c8786ddb6 100644 --- a/examples/extern_binds.rs +++ b/examples/extern_binds.rs @@ -20,12 +20,12 @@ mod app { use lm3s6965::Interrupt; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::UART0); hprintln!("init").unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[idle] diff --git a/examples/extern_spawn.rs b/examples/extern_spawn.rs index 1be3d51295..275ac53996 100644 --- a/examples/extern_spawn.rs +++ b/examples/extern_spawn.rs @@ -22,10 +22,10 @@ mod app { use crate::foo; #[init] - fn init(_c: init::Context) -> init::LateResources { + fn init(_c: init::Context) -> (init::LateResources, init::Monotonics) { foo::spawn(1, 2).unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } extern "Rust" { diff --git a/examples/generics.rs b/examples/generics.rs index f3829a0634..eabfff7ece 100644 --- a/examples/generics.rs +++ b/examples/generics.rs @@ -21,11 +21,11 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::UART0); rtic::pend(Interrupt::UART1); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task(binds = UART0, resources = [shared])] diff --git a/examples/hardware.rs b/examples/hardware.rs index 99e8da2ec6..3cf988073f 100644 --- a/examples/hardware.rs +++ b/examples/hardware.rs @@ -13,14 +13,14 @@ mod app { use lm3s6965::Interrupt; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { // Pends the UART0 interrupt but its handler won't run until *after* // `init` returns because interrupts are disabled rtic::pend(Interrupt::UART0); // equivalent to NVIC::pend hprintln!("init").unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[idle] diff --git a/examples/idle.rs b/examples/idle.rs index 1aac56c28f..db03dc708a 100644 --- a/examples/idle.rs +++ b/examples/idle.rs @@ -12,10 +12,10 @@ mod app { use cortex_m_semihosting::{debug, hprintln}; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { hprintln!("init").unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[idle] diff --git a/examples/init.rs b/examples/init.rs index ca67a2b783..9de7958147 100644 --- a/examples/init.rs +++ b/examples/init.rs @@ -12,7 +12,7 @@ mod app { use cortex_m_semihosting::{debug, hprintln}; #[init] - fn init(cx: init::Context) -> init::LateResources { + fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) { static mut X: u32 = 0; // Cortex-M peripherals @@ -32,6 +32,6 @@ mod app { debug::exit(debug::EXIT_SUCCESS); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } } diff --git a/examples/late.rs b/examples/late.rs index d4efaba367..e65b6e6971 100644 --- a/examples/late.rs +++ b/examples/late.rs @@ -25,13 +25,13 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { static mut Q: Queue = Queue(i::Queue::new()); let (p, c) = Q.split(); // Initialization of late resources - init::LateResources { p, c } + (init::LateResources { p, c }, init::Monotonics()) } #[idle(resources = [c])] diff --git a/examples/lock.rs b/examples/lock.rs index 2fbf760833..75d47d24fe 100644 --- a/examples/lock.rs +++ b/examples/lock.rs @@ -19,10 +19,10 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::GPIOA); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } // when omitted priority is assumed to be `1` diff --git a/examples/message.rs b/examples/message.rs index 4c5d8997b0..722e73a710 100644 --- a/examples/message.rs +++ b/examples/message.rs @@ -12,10 +12,10 @@ mod app { use cortex_m_semihosting::{debug, hprintln}; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { foo::spawn(/* no message */).unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task] diff --git a/examples/multilock.rs b/examples/multilock.rs index a6985dfa0c..ad9d72ab59 100644 --- a/examples/multilock.rs +++ b/examples/multilock.rs @@ -25,10 +25,10 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::GPIOA); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } // when omitted priority is assumed to be `1` diff --git a/examples/not-sync.rs b/examples/not-sync.rs index 21c316ae14..8189da51bf 100644 --- a/examples/not-sync.rs +++ b/examples/not-sync.rs @@ -25,10 +25,10 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { debug::exit(debug::EXIT_SUCCESS); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task(resources = [&shared])] diff --git a/examples/only-shared-access.rs b/examples/only-shared-access.rs index 8d42fd4ddd..2c6ad4c4be 100644 --- a/examples/only-shared-access.rs +++ b/examples/only-shared-access.rs @@ -18,11 +18,11 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::UART0); rtic::pend(Interrupt::UART1); - init::LateResources { key: 0xdeadbeef } + (init::LateResources { key: 0xdeadbeef }, init::Monotonics()) } #[task(binds = UART0, resources = [&key])] diff --git a/examples/periodic.rs b/examples/periodic.rs index 3ff9c907cb..29fa6bd999 100644 --- a/examples/periodic.rs +++ b/examples/periodic.rs @@ -8,7 +8,7 @@ use panic_semihosting as _; // NOTE: does NOT work on QEMU! -#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])] +#[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { use cortex_m_semihosting::hprintln; use rtic::cyccnt::{Instant, U32Ext}; @@ -16,12 +16,12 @@ mod app { const PERIOD: u32 = 8_000_000; #[init] - fn init(cx: init::Context) -> init::LateResources { + fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) { // omitted: initialization of `CYCCNT` foo::schedule(cx.start + PERIOD.cycles()).unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task] diff --git a/examples/peripherals-taken.rs b/examples/peripherals-taken.rs index 98f06b08a2..6b4a282b8f 100644 --- a/examples/peripherals-taken.rs +++ b/examples/peripherals-taken.rs @@ -10,10 +10,10 @@ mod app { use cortex_m_semihosting::debug; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { assert!(cortex_m::Peripherals::take().is_none()); debug::exit(debug::EXIT_SUCCESS); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } } diff --git a/examples/pool.rs b/examples/pool.rs index eaad9c09d6..44405b4911 100644 --- a/examples/pool.rs +++ b/examples/pool.rs @@ -25,7 +25,7 @@ mod app { use super::P; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { static mut MEMORY: [u8; 512] = [0; 512]; // Increase the capacity of the memory pool by ~4 @@ -33,7 +33,7 @@ mod app { rtic::pend(Interrupt::I2C0); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task(binds = I2C0, priority = 2)] diff --git a/examples/preempt.rs b/examples/preempt.rs index ee75c46f18..14b3a0a682 100644 --- a/examples/preempt.rs +++ b/examples/preempt.rs @@ -12,10 +12,10 @@ mod app { use lm3s6965::Interrupt; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::GPIOA); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task(binds = GPIOA, priority = 1)] diff --git a/examples/ramfunc.rs b/examples/ramfunc.rs index b5aa17b949..d9c8143fbc 100644 --- a/examples/ramfunc.rs +++ b/examples/ramfunc.rs @@ -19,10 +19,10 @@ mod app { use cortex_m_semihosting::{debug, hprintln}; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { foo::spawn().unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[inline(never)] diff --git a/examples/resource-user-struct.rs b/examples/resource-user-struct.rs index a550bb2a38..6ad540b0f9 100644 --- a/examples/resource-user-struct.rs +++ b/examples/resource-user-struct.rs @@ -27,11 +27,11 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::UART0); rtic::pend(Interrupt::UART1); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } // `shared` cannot be accessed from this context diff --git a/examples/resource.rs b/examples/resource.rs index 60aa52b098..c8c57bf57a 100644 --- a/examples/resource.rs +++ b/examples/resource.rs @@ -20,11 +20,11 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::UART0); rtic::pend(Interrupt::UART1); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } // `shared` cannot be accessed from this context diff --git a/examples/schedule.rs b/examples/schedule.rs index 5f73c5003f..6f6f8cb60b 100644 --- a/examples/schedule.rs +++ b/examples/schedule.rs @@ -8,14 +8,14 @@ use panic_halt as _; // NOTE: does NOT work on QEMU! -#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])] +#[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { use cortex_m::peripheral::DWT; use cortex_m_semihosting::hprintln; use rtic::cyccnt::{Instant, U32Ext as _}; #[init()] - fn init(mut cx: init::Context) -> init::LateResources { + fn init(mut cx: init::Context) -> (init::LateResources, init::Monotonics) { // Initialize (enable) the monotonic timer (CYCCNT) cx.core.DCB.enable_trace(); // required on Cortex-M7 devices that software lock the DWT (e.g. STM32F7) @@ -34,7 +34,7 @@ mod app { // Schedule `bar` to run 4e6 cycles in the future bar::schedule(now + 4_000_000.cycles()).unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task] diff --git a/examples/spawn.rs b/examples/spawn.rs index 449fcfb9ae..987ebf7d45 100644 --- a/examples/spawn.rs +++ b/examples/spawn.rs @@ -12,10 +12,10 @@ mod app { use cortex_m_semihosting::{debug, hprintln}; #[init] - fn init(_c: init::Context) -> init::LateResources { + fn init(_c: init::Context) -> (init::LateResources, init::Monotonics) { foo::spawn(1, 2).unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task()] diff --git a/examples/spawn2.rs b/examples/spawn2.rs index c485b92278..be113f7966 100644 --- a/examples/spawn2.rs +++ b/examples/spawn2.rs @@ -12,10 +12,10 @@ mod app { use cortex_m_semihosting::{debug, hprintln}; #[init] - fn init(_c: init::Context) -> init::LateResources { + fn init(_c: init::Context) -> (init::LateResources, init::Monotonics) { foo::spawn(1, 2).unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task] diff --git a/examples/static.rs b/examples/static.rs index 7626c71276..cbbc539962 100644 --- a/examples/static.rs +++ b/examples/static.rs @@ -26,13 +26,13 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { static mut Q: Queue = Queue(i::Queue::new()); let (p, c) = Q.split(); // Initialization of late resources - init::LateResources { p, c } + (init::LateResources { p, c }, init::Monotonics()) } #[idle(resources = [c])] diff --git a/examples/t-binds.rs b/examples/t-binds.rs index 8d52f58a3f..60afa35ebe 100644 --- a/examples/t-binds.rs +++ b/examples/t-binds.rs @@ -10,8 +10,8 @@ use panic_halt as _; #[rtic::app(device = lm3s6965)] mod app { #[init] - fn init(_: init::Context) -> init::LateResources { - init::LateResources {} + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { + (init::LateResources {}, init::Monotonics()) } // Cortex-M exception diff --git a/examples/t-cfg-resources.rs b/examples/t-cfg-resources.rs index 61eb4c7b10..990b01ff8e 100644 --- a/examples/t-cfg-resources.rs +++ b/examples/t-cfg-resources.rs @@ -18,13 +18,16 @@ mod app { dummy: (), // dummy such that we have at least one late resource } #[init] - fn init(_: init::Context) -> init::LateResources { - init::LateResources { - // The feature needs to be applied everywhere x is defined or used - #[cfg(feature = "feature_x")] - x: 0, - dummy: (), // dummy such that we have at least one late resource - } + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { + ( + init::LateResources { + // The feature needs to be applied everywhere x is defined or used + #[cfg(feature = "feature_x")] + x: 0, + dummy: (), // dummy such that we have at least one late resource + }, + init::Monotonics(), + ) } #[idle] diff --git a/examples/t-cfg.rs b/examples/t-cfg.rs index 5bcef0af84..ff06ee8eee 100644 --- a/examples/t-cfg.rs +++ b/examples/t-cfg.rs @@ -5,7 +5,7 @@ use panic_halt as _; -#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0, QEI0])] +#[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0])] mod app { #[resources] struct Resources { @@ -15,11 +15,11 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { #[cfg(never)] static mut BAR: u32 = 0; - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[idle] diff --git a/examples/t-htask-main.rs b/examples/t-htask-main.rs index 57076eca49..2d480d0bbb 100644 --- a/examples/t-htask-main.rs +++ b/examples/t-htask-main.rs @@ -10,10 +10,10 @@ mod app { use cortex_m_semihosting::debug; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(lm3s6965::Interrupt::UART0); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task(binds = UART0)] diff --git a/examples/t-idle-main.rs b/examples/t-idle-main.rs index 42dac904e2..891896fa8b 100644 --- a/examples/t-idle-main.rs +++ b/examples/t-idle-main.rs @@ -10,8 +10,8 @@ mod app { use cortex_m_semihosting::debug; #[init] - fn init(_: init::Context) -> init::LateResources { - init::LateResources {} + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { + (init::LateResources {}, init::Monotonics()) } #[idle] diff --git a/examples/t-init-main.rs b/examples/t-init-main.rs index 0456e874c0..b77a7df8bd 100644 --- a/examples/t-init-main.rs +++ b/examples/t-init-main.rs @@ -10,9 +10,9 @@ mod app { use cortex_m_semihosting::debug; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { debug::exit(debug::EXIT_SUCCESS); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } } diff --git a/examples/t-late-not-send.rs b/examples/t-late-not-send.rs index ce3bcbac68..dae0aa99ec 100644 --- a/examples/t-late-not-send.rs +++ b/examples/t-late-not-send.rs @@ -24,10 +24,13 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { - init::LateResources { - x: NotSend { _0: PhantomData }, - } + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { + ( + init::LateResources { + x: NotSend { _0: PhantomData }, + }, + init::Monotonics(), + ) } #[idle(resources = [x, y])] diff --git a/examples/t-resource.rs b/examples/t-resource.rs index 0a9f3bad5b..164ea841b9 100644 --- a/examples/t-resource.rs +++ b/examples/t-resource.rs @@ -32,8 +32,8 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { - init::LateResources {} + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { + (init::LateResources {}, init::Monotonics()) } #[idle(resources = [o2, &o4, s1, &s3])] diff --git a/examples/t-schedule-core-stable.rs b/examples/t-schedule-core-stable.rs index 10539014a7..adcc0b695b 100644 --- a/examples/t-schedule-core-stable.rs +++ b/examples/t-schedule-core-stable.rs @@ -7,13 +7,13 @@ use panic_halt as _; -#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])] +#[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { #[init] - fn init(c: init::Context) -> init::LateResources { - let _c: rtic::Peripherals = c.core; + fn init(c: init::Context) -> (init::LateResources, init::Monotonics) { + let _c: cortex_m::Peripherals = c.core; - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task] diff --git a/examples/t-schedule.rs b/examples/t-schedule.rs index 9c94d1b427..1771d4195f 100644 --- a/examples/t-schedule.rs +++ b/examples/t-schedule.rs @@ -7,17 +7,17 @@ use panic_halt as _; -#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])] +#[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { use rtic::cyccnt::{Instant, U32Ext as _}; #[init] - fn init(c: init::Context) -> init::LateResources { + fn init(c: init::Context) -> (init::LateResources, init::Monotonics) { let _: Result<(), ()> = foo::schedule(c.start + 10.cycles()); let _: Result<(), u32> = bar::schedule(c.start + 20.cycles(), 0); let _: Result<(), (u32, u32)> = baz::schedule(c.start + 30.cycles(), 0, 1); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[idle] diff --git a/examples/t-spawn.rs b/examples/t-spawn.rs index c9949ef9b9..cc7754e858 100644 --- a/examples/t-spawn.rs +++ b/examples/t-spawn.rs @@ -10,12 +10,12 @@ use panic_halt as _; #[rtic::app(device = lm3s6965, dispatchers = [SSI0])] mod app { #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { let _: Result<(), ()> = foo::spawn(); let _: Result<(), u32> = bar::spawn(0); let _: Result<(), (u32, u32)> = baz::spawn(0, 1); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[idle] diff --git a/examples/t-stask-main.rs b/examples/t-stask-main.rs index 034ad7c56e..cfc93425be 100644 --- a/examples/t-stask-main.rs +++ b/examples/t-stask-main.rs @@ -10,10 +10,10 @@ mod app { use cortex_m_semihosting::debug; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { taskmain::spawn().ok(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task] diff --git a/examples/task-local-minimal.rs b/examples/task-local-minimal.rs index 6e25c10d68..f83493c29d 100644 --- a/examples/task-local-minimal.rs +++ b/examples/task-local-minimal.rs @@ -18,8 +18,8 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { - init::LateResources { l: 42 } + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { + (init::LateResources { l: 42 }, init::Monotonics()) } // l is task_local diff --git a/examples/task-local.rs b/examples/task-local.rs index e86197a0cb..3020c3b3af 100644 --- a/examples/task-local.rs +++ b/examples/task-local.rs @@ -38,10 +38,10 @@ mod app { } #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { rtic::pend(Interrupt::UART0); rtic::pend(Interrupt::UART1); - init::LateResources { e2: 2, l2: 2 } + (init::LateResources { e2: 2, l2: 2 }, init::Monotonics()) } // `shared` cannot be accessed from this context diff --git a/examples/task.rs b/examples/task.rs index 5e4769a59b..9d4492f284 100644 --- a/examples/task.rs +++ b/examples/task.rs @@ -12,10 +12,10 @@ mod app { use cortex_m_semihosting::{debug, hprintln}; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { foo::spawn().unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task] diff --git a/examples/task_named_main.rs b/examples/task_named_main.rs index c3d21b5806..c2c4e62d91 100644 --- a/examples/task_named_main.rs +++ b/examples/task_named_main.rs @@ -12,10 +12,10 @@ mod app { use cortex_m_semihosting::{debug, hprintln}; #[init] - fn init(_: init::Context) -> init::LateResources { + fn init(_: init::Context) -> (init::LateResources, init::Monotonics) { main::spawn().unwrap(); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[task] diff --git a/examples/test_new_monotonic.rs b/examples/test_new_monotonic.rs deleted file mode 100644 index 67883465b6..0000000000 --- a/examples/test_new_monotonic.rs +++ /dev/null @@ -1,25 +0,0 @@ -//! examples/test_new_monotonic.rs - -#![no_main] -#![no_std] - -use panic_semihosting as _; // panic handler -use rtic::app; - -#[app(device = lm3s6965, dispatchers = [UART])] -mod app { - #[monotonic(binds = SysTick)] - type MyMono1 = hal::Mono1; - - #[monotonic(binds = SomeISR2, default = true)] - type MyMono2 = hal::Mono2; - - #[init] - fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {} - - #[task] - fn task1(_: task1::Context) {} - - #[task] - fn task2(_: task2::Context) {} -} diff --git a/examples/types.rs b/examples/types.rs index bcdd30a930..8411eecd9c 100644 --- a/examples/types.rs +++ b/examples/types.rs @@ -7,10 +7,9 @@ use panic_semihosting as _; -#[rtic::app(device = lm3s6965, peripherals = true, monotonic = rtic::cyccnt::CYCCNT, dispatchers = [SSI0])] +#[rtic::app(device = lm3s6965, peripherals = true, dispatchers = [SSI0])] mod app { use cortex_m_semihosting::debug; - use rtic::cyccnt; #[resources] struct Resources { @@ -19,14 +18,14 @@ mod app { } #[init] - fn init(cx: init::Context) -> init::LateResources { + fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) { let _: cyccnt::Instant = cx.start; let _: rtic::Peripherals = cx.core; let _: lm3s6965::Peripherals = cx.device; debug::exit(debug::EXIT_SUCCESS); - init::LateResources {} + (init::LateResources {}, init::Monotonics()) } #[idle]