diff options
author | 2020-10-07 15:17:00 +0200 | |
---|---|---|
committer | 2020-10-07 15:17:00 +0200 | |
commit | 6d003e20a83edc064b532d67853f27ec13f4fa4f (patch) | |
tree | 077b18048986d8d225ea4f80bfe7a9cd2996ae89 | |
parent | 36781cdd890752d6876623d8802b860e950b24eb (diff) | |
download | rtic-6d003e20a83edc064b532d67853f27ec13f4fa4f.tar.gz rtic-6d003e20a83edc064b532d67853f27ec13f4fa4f.tar.zst rtic-6d003e20a83edc064b532d67853f27ec13f4fa4f.zip |
Now core contains the same `Peripherals` type based on monotonic
-rw-r--r-- | examples/t-schedule-core-stable.rs | 28 | ||||
-rw-r--r-- | macros/src/codegen/module.rs | 4 |
2 files changed, 30 insertions, 2 deletions
diff --git a/examples/t-schedule-core-stable.rs b/examples/t-schedule-core-stable.rs new file mode 100644 index 00000000..c2a8fdb5 --- /dev/null +++ b/examples/t-schedule-core-stable.rs @@ -0,0 +1,28 @@ +//! [compile-pass] Check `schedule` code generation + +#![deny(unsafe_code)] +#![deny(warnings)] +#![no_main] +#![no_std] + +use panic_halt as _; + +#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)] +mod app { + #[init] + fn init(c: init::Context) -> init::LateResources { + let _c: rtic::Peripherals = c.core; + + init::LateResources {} + } + + #[task] + fn some_task(_: some_task::Context) {} + + // RTIC requires that unused interrupts are declared in an extern block when + // using software tasks; these free interrupts will be used to dispatch the + // software tasks. + extern "C" { + fn SSI0(); + } +} diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index 2e51e7db..3d90cbd3 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -15,7 +15,7 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> let mut lt = None; match ctxt { Context::Init => { - if app.uses_schedule() { + if extra.monotonic.is_some() { let m = extra.monotonic(); fields.push(quote!( @@ -277,7 +277,7 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> }; let core = if ctxt.is_init() { - if app.uses_schedule() { + if extra.monotonic.is_some() { Some(quote!(core: rtic::Peripherals,)) } else { Some(quote!(core: rtic::export::Peripherals,)) |