From addb08607007aac915ac33984a1816a5aa353ced Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Tue, 14 Sep 2021 16:13:28 +0200 Subject: [PATCH] Cleanup export and actually use rtic::export, made fn init inline --- macros/src/codegen/init.rs | 1 + macros/src/codegen/module.rs | 2 +- src/export.rs | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/macros/src/codegen/init.rs b/macros/src/codegen/init.rs index b6d3f72ef0..2de3e73481 100644 --- a/macros/src/codegen/init.rs +++ b/macros/src/codegen/init.rs @@ -77,6 +77,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> CodegenResult { let user_init = quote!( #(#attrs)* + #[inline(always)] #[allow(non_snake_case)] fn #name(#context: #name::Context) -> (#user_init_return) { #(#stmts)* diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index 4db2c0c2f4..17bc34d363 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -275,7 +275,7 @@ pub fn codegen( ( quote!(core::mem::transmute::<_, cortex_m::peripheral::SYST>(()) .enable_interrupt()), - quote!(cortex_m::peripheral::SCB::set_pendst()), + quote!(rtic::export::SCB::set_pendst()), ) } else { let rt_err = util::rt_err_ident(); diff --git a/src/export.rs b/src/export.rs index 927e951e0a..8fdcb67ef8 100644 --- a/src/export.rs +++ b/src/export.rs @@ -5,12 +5,10 @@ use core::{ pub use crate::tq::{NotReady, TimerQueue}; pub use bare_metal::CriticalSection; -#[cfg(armv7m)] -pub use cortex_m::register::basepri; pub use cortex_m::{ asm::wfi, interrupt, - peripheral::{scb::SystemHandler, syst::SystClkSource, DWT, NVIC}, + peripheral::{scb::SystemHandler, DWT, NVIC, SCB}, Peripherals, }; pub use heapless::sorted_linked_list::SortedLinkedList; @@ -21,6 +19,9 @@ pub use rtic_monotonic as monotonic; pub type SCFQ = Queue; pub type SCRQ = Queue<(T, u8), N>; +#[cfg(armv7m)] +use cortex_m::register::basepri; + #[cfg(armv7m)] #[inline(always)] pub fn run(priority: u8, f: F)