diff options
author | 2020-06-11 17:18:29 +0000 | |
---|---|---|
committer | 2020-06-11 17:18:29 +0000 | |
commit | 602a5b4374961dbcf7f3290053ab9b01f0622c67 (patch) | |
tree | d3e64006a7b310d34d82df7aa2a4467c03595e55 /macros/src | |
parent | 4a0393f756cc3ccd480f839eb6b6a9349326fe8e (diff) | |
download | rtic-602a5b4374961dbcf7f3290053ab9b01f0622c67.tar.gz rtic-602a5b4374961dbcf7f3290053ab9b01f0622c67.tar.zst rtic-602a5b4374961dbcf7f3290053ab9b01f0622c67.zip |
Rename RTFM to RTIC
Diffstat (limited to 'macros/src')
25 files changed, 131 insertions, 131 deletions
diff --git a/macros/src/analyze.rs b/macros/src/analyze.rs index e3ed7781..af6811fa 100644 --- a/macros/src/analyze.rs +++ b/macros/src/analyze.rs @@ -1,7 +1,7 @@ use core::ops; use std::collections::{BTreeMap, BTreeSet}; -use rtfm_syntax::{ +use rtic_syntax::{ analyze::{self, Priority}, ast::App, Core, P, diff --git a/macros/src/check.rs b/macros/src/check.rs index 0136370c..71634446 100644 --- a/macros/src/check.rs +++ b/macros/src/check.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; use proc_macro2::Span; -use rtfm_syntax::{ +use rtic_syntax::{ analyze::Analysis, ast::{App, CustomArg}, }; @@ -21,7 +21,7 @@ impl<'a> Extra<'a> { pub fn app<'a>(app: &'a App, analysis: &Analysis) -> parse::Result<Extra<'a>> { if cfg!(feature = "homogeneous") { - // this RTFM mode uses the same namespace for all cores so we need to check that the + // this RTIC mode uses the same namespace for all cores so we need to check that the // identifiers used for each core `#[init]` and `#[idle]` functions don't collide let mut seen = HashSet::new(); @@ -219,7 +219,7 @@ pub fn app<'a>(app: &'a App, analysis: &Analysis) -> parse::Result<Extra<'a>> { } else { Err(parse::Error::new( Span::call_site(), - "a `device` argument must be specified in `#[rtfm::app]`", + "a `device` argument must be specified in `#[rtic::app]`", )) } } diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index 80e65cd4..2433684c 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::ast::App; +use rtic_syntax::ast::App; use crate::{analyze::Analysis, check::Extra}; @@ -23,7 +23,7 @@ mod spawn_body; mod timer_queue; mod util; -// TODO document the syntax here or in `rtfm-syntax` +// TODO document the syntax here or in `rtic-syntax` pub fn app(app: &App, analysis: &Analysis, extra: &Extra) -> TokenStream2 { let mut const_app = vec![]; let mut mains = vec![]; diff --git a/macros/src/codegen/assertions.rs b/macros/src/codegen/assertions.rs index 4a77352f..51bbdbff 100644 --- a/macros/src/codegen/assertions.rs +++ b/macros/src/codegen/assertions.rs @@ -12,13 +12,13 @@ pub fn codegen(core: u8, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream2 if let Some(types) = analysis.send_types.get(&core) { for ty in types { - stmts.push(quote!(rtfm::export::assert_send::<#ty>();)); + stmts.push(quote!(rtic::export::assert_send::<#ty>();)); } } if let Some(types) = analysis.sync_types.get(&core) { for ty in types { - stmts.push(quote!(rtfm::export::assert_sync::<#ty>();)); + stmts.push(quote!(rtic::export::assert_sync::<#ty>();)); } } @@ -26,7 +26,7 @@ pub fn codegen(core: u8, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream2 // `monotonic` timer can be used in multi-core context if analysis.timer_queues.len() > 1 && analysis.timer_queues.contains_key(&core) { let monotonic = extra.monotonic(); - stmts.push(quote!(rtfm::export::assert_multicore::<#monotonic>();)); + stmts.push(quote!(rtic::export::assert_multicore::<#monotonic>();)); } stmts diff --git a/macros/src/codegen/dispatchers.rs b/macros/src/codegen/dispatchers.rs index 1400786b..60b8626e 100644 --- a/macros/src/codegen/dispatchers.rs +++ b/macros/src/codegen/dispatchers.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::ast::App; +use rtic_syntax::ast::App; use crate::{analyze::Analysis, check::Extra, codegen::util}; @@ -49,23 +49,23 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream let (rq_attr, rq_ty, rq_expr, section) = if sender == receiver { ( cfg_sender.clone(), - quote!(rtfm::export::SCRQ<#t, #n>), - quote!(rtfm::export::Queue(unsafe { - rtfm::export::iQueue::u8_sc() + quote!(rtic::export::SCRQ<#t, #n>), + quote!(rtic::export::Queue(unsafe { + rtic::export::iQueue::u8_sc() })), util::link_section("bss", sender), ) } else { let shared = if cfg!(feature = "heterogeneous") { - Some(quote!(#[rtfm::export::shared])) + Some(quote!(#[rtic::export::shared])) } else { None }; ( shared, - quote!(rtfm::export::MCRQ<#t, #n>), - quote!(rtfm::export::Queue(rtfm::export::iQueue::u8())), + quote!(rtic::export::MCRQ<#t, #n>), + quote!(rtic::export::Queue(rtic::export::iQueue::u8())), None, ) }; @@ -87,7 +87,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream items.push(quote!( #cfg_sender struct #rq<'a> { - priority: &'a rtfm::export::Priority, + priority: &'a rtic::export::Priority, } )); @@ -140,7 +140,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream #inputs.get_unchecked(usize::from(index)).as_ptr().read(); #let_instant #fq.split().0.enqueue_unchecked(index); - let priority = &rtfm::export::Priority::new(PRIORITY); + let priority = &rtic::export::Priority::new(PRIORITY); crate::#name( #locals_new #name::Context::new(priority #instant) @@ -177,7 +177,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream /// The priority of this interrupt handler const PRIORITY: u8 = #level; - rtfm::export::run(PRIORITY, || { + rtic::export::run(PRIORITY, || { #(#stmts)* }); } diff --git a/macros/src/codegen/hardware_tasks.rs b/macros/src/codegen/hardware_tasks.rs index a9c2a2bd..453dbccb 100644 --- a/macros/src/codegen/hardware_tasks.rs +++ b/macros/src/codegen/hardware_tasks.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::{ast::App, Context}; +use rtic_syntax::{ast::App, Context}; use crate::{ analyze::Analysis, @@ -36,7 +36,7 @@ pub fn codegen( let m = extra.monotonic(); ( - Some(quote!(let instant = <#m as rtfm::Monotonic>::now();)), + Some(quote!(let instant = <#m as rtic::Monotonic>::now();)), Some(quote!(, instant)), ) } else { @@ -67,10 +67,10 @@ pub fn codegen( #let_instant - rtfm::export::run(PRIORITY, || { + rtic::export::run(PRIORITY, || { crate::#name( #locals_new - #name::Context::new(&rtfm::export::Priority::new(PRIORITY) #instant) + #name::Context::new(&rtic::export::Priority::new(PRIORITY) #instant) ) }); } @@ -121,7 +121,7 @@ pub fn codegen( #[allow(non_snake_case)] #section fn #name(#(#locals_pat,)* #context: #name::Context) { - use rtfm::Mutex as _; + use rtic::Mutex as _; #(#stmts)* } diff --git a/macros/src/codegen/idle.rs b/macros/src/codegen/idle.rs index 72432f67..032c8ade 100644 --- a/macros/src/codegen/idle.rs +++ b/macros/src/codegen/idle.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::{ast::App, Context}; +use rtic_syntax::{ast::App, Context}; use crate::{ analyze::Analysis, @@ -65,7 +65,7 @@ pub fn codegen( #cfg_core #section fn #name(#(#locals_pat,)* #context: #name::Context) -> ! { - use rtfm::Mutex as _; + use rtic::Mutex as _; #(#stmts)* } @@ -74,7 +74,7 @@ pub fn codegen( let locals_new = locals_new.iter(); let call_idle = quote!(crate::#name( #(#locals_new,)* - #name::Context::new(&rtfm::export::Priority::new(0)) + #name::Context::new(&rtic::export::Priority::new(0)) )); (const_app, root_idle, user_idle, call_idle) @@ -84,7 +84,7 @@ pub fn codegen( vec![], None, quote!(loop { - rtfm::export::wfi() + rtic::export::wfi() }), ) } diff --git a/macros/src/codegen/init.rs b/macros/src/codegen/init.rs index e28354af..fa273fee 100644 --- a/macros/src/codegen/init.rs +++ b/macros/src/codegen/init.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::{ast::App, Context}; +use rtic_syntax::{ast::App, Context}; use crate::{ analyze::Analysis, diff --git a/macros/src/codegen/locals.rs b/macros/src/codegen/locals.rs index cbfe05fb..127f4b09 100644 --- a/macros/src/codegen/locals.rs +++ b/macros/src/codegen/locals.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::{ +use rtic_syntax::{ ast::{App, Local}, Context, Core, Map, }; @@ -43,7 +43,7 @@ pub fn codegen( has_cfgs |= !cfgs.is_empty(); let section = if local.shared && cfg!(feature = "heterogeneous") { - Some(quote!(#[rtfm::export::shared])) + Some(quote!(#[rtic::export::shared])) } else { util::link_section("data", core) }; diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index 5f077a22..1b21209f 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::{ast::App, Context}; +use rtic_syntax::{ast::App, Context}; use crate::{check::Extra, codegen::util}; @@ -21,19 +21,19 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> fields.push(quote!( /// System start time = `Instant(0 /* cycles */)` - pub start: <#m as rtfm::Monotonic>::Instant + pub start: <#m as rtic::Monotonic>::Instant )); - values.push(quote!(start: <#m as rtfm::Monotonic>::zero())); + values.push(quote!(start: <#m as rtic::Monotonic>::zero())); fields.push(quote!( /// Core (Cortex-M) peripherals minus the SysTick - pub core: rtfm::Peripherals + pub core: rtic::Peripherals )); } else { fields.push(quote!( /// Core (Cortex-M) peripherals - pub core: rtfm::export::Peripherals + pub core: rtic::export::Peripherals )); } @@ -59,7 +59,7 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> fields.push(quote!( /// Time at which this handler started executing - pub start: <#m as rtfm::Monotonic>::Instant + pub start: <#m as rtic::Monotonic>::Instant )); values.push(quote!(start: instant)); @@ -74,7 +74,7 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> fields.push(quote!( /// The time at which this task was scheduled to run - pub scheduled: <#m as rtfm::Monotonic>::Instant + pub scheduled: <#m as rtic::Monotonic>::Instant )); values.push(quote!(scheduled: instant)); @@ -145,13 +145,13 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> #[doc = #doc] #[derive(Clone, Copy)] pub struct Schedule<'a> { - priority: &'a rtfm::export::Priority, + priority: &'a rtic::export::Priority, } impl<'a> Schedule<'a> { #[doc(hidden)] #[inline(always)] - pub unsafe fn priority(&self) -> &rtfm::export::Priority { + pub unsafe fn priority(&self) -> &rtic::export::Priority { &self.priority } } @@ -199,7 +199,7 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> #[doc = #doc] #[derive(Clone, Copy)] pub struct Spawn<'a> { - priority: &'a rtfm::export::Priority, + priority: &'a rtic::export::Priority, } )); @@ -210,11 +210,11 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> needs_instant = true; instant_method = Some(quote!( - pub unsafe fn instant(&self) -> <#m as rtfm::Monotonic>::Instant { + pub unsafe fn instant(&self) -> <#m as rtic::Monotonic>::Instant { self.instant } )); - Some(quote!(instant: <#m as rtfm::Monotonic>::Instant,)) + Some(quote!(instant: <#m as rtic::Monotonic>::Instant,)) } else { None }; @@ -224,7 +224,7 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> #[derive(Clone, Copy)] pub struct Spawn<'a> { #instant_field - priority: &'a rtfm::export::Priority, + priority: &'a rtic::export::Priority, } )); @@ -242,7 +242,7 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> impl<'a> Spawn<'a> { #[doc(hidden)] #[inline(always)] - pub unsafe fn priority(&self) -> &rtfm::export::Priority { + pub unsafe fn priority(&self) -> &rtic::export::Priority { self.priority } @@ -273,9 +273,9 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> let core = if ctxt.is_init() { if app.uses_schedule(core) { - Some(quote!(core: rtfm::Peripherals,)) + Some(quote!(core: rtic::Peripherals,)) } else { - Some(quote!(core: rtfm::export::Peripherals,)) + Some(quote!(core: rtic::export::Peripherals,)) } } else { None @@ -284,13 +284,13 @@ pub fn codegen(ctxt: Context, resources_tick: bool, app: &App, extra: &Extra) -> let priority = if ctxt.is_init() { None } else { - Some(quote!(priority: &#lt rtfm::export::Priority)) + Some(quote!(priority: &#lt rtic::export::Priority)) }; let instant = if needs_instant { let m = extra.monotonic(); - Some(quote!(, instant: <#m as rtfm::Monotonic>::Instant)) + Some(quote!(, instant: <#m as rtic::Monotonic>::Instant)) } else { None }; diff --git a/macros/src/codegen/post_init.rs b/macros/src/codegen/post_init.rs index b816e072..0c740e85 100644 --- a/macros/src/codegen/post_init.rs +++ b/macros/src/codegen/post_init.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::ast::App; +use rtic_syntax::ast::App; use crate::{analyze::Analysis, check::Extra, codegen::util}; @@ -40,7 +40,7 @@ pub fn codegen( let ib = util::init_barrier(*user); let shared = if cfg!(feature = "heterogeneous") { Some(quote!( - #[rtfm::export::shared] + #[rtic::export::shared] )) } else { None @@ -48,7 +48,7 @@ pub fn codegen( const_app.push(quote!( #shared - static #ib: rtfm::export::Barrier = rtfm::export::Barrier::new(); + static #ib: rtic::export::Barrier = rtic::export::Barrier::new(); )); stmts.push(quote!( @@ -85,7 +85,7 @@ pub fn codegen( if analysis.timer_queues.len() == 1 { // reset the monotonic timer / counter stmts.push(quote!( - <#m as rtfm::Monotonic>::reset(); + <#m as rtic::Monotonic>::reset(); )); } else { // in the multi-core case we need a rendezvous (RV) barrier between *all* the cores that @@ -102,7 +102,7 @@ pub fn codegen( let rv = util::rendezvous_ident(i); let shared = if cfg!(feature = "heterogeneous") { Some(quote!( - #[rtfm::export::shared] + #[rtic::export::shared] )) } else { None @@ -110,7 +110,7 @@ pub fn codegen( const_app.push(quote!( #shared - static #rv: rtfm::export::Barrier = rtfm::export::Barrier::new(); + static #rv: rtic::export::Barrier = rtic::export::Barrier::new(); )); // wait until all the other cores have reached the RV point @@ -130,7 +130,7 @@ pub fn codegen( core::sync::atomic::compiler_fence(core::sync::atomic::Ordering::SeqCst); // reset the counter - <#m as rtfm::Monotonic>::reset(); + <#m as rtic::Monotonic>::reset(); core::sync::atomic::compiler_fence(core::sync::atomic::Ordering::SeqCst); @@ -156,7 +156,7 @@ pub fn codegen( } // enable the interrupts -- this completes the `init`-ialization phase - stmts.push(quote!(rtfm::export::interrupt::enable();)); + stmts.push(quote!(rtic::export::interrupt::enable();)); (const_app, stmts) } diff --git a/macros/src/codegen/pre_init.rs b/macros/src/codegen/pre_init.rs index 605171b8..1f1735d2 100644 --- a/macros/src/codegen/pre_init.rs +++ b/macros/src/codegen/pre_init.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::ast::App; +use rtic_syntax::ast::App; use crate::{analyze::Analysis, check::Extra, codegen::util}; @@ -20,7 +20,7 @@ pub fn codegen( let mut stmts = vec![]; // disable interrupts -- `init` must run with interrupts disabled - stmts.push(quote!(rtfm::export::interrupt::disable();)); + stmts.push(quote!(rtic::export::interrupt::disable();)); // populate this core `FreeQueue`s for (name, senders) in &analysis.free_queues { @@ -40,7 +40,7 @@ pub fn codegen( stmts.push(quote!( // NOTE(transmute) to avoid debug_assertion in multi-core mode - let mut core: rtfm::export::Peripherals = core::mem::transmute(()); + let mut core: rtic::export::Peripherals = core::mem::transmute(()); )); let device = extra.device; @@ -69,13 +69,13 @@ pub fn codegen( stmts.push(quote!( core.NVIC.set_priority( #device::#interrupt::#name, - rtfm::export::logical2hw(#priority, #nvic_prio_bits), + rtic::export::logical2hw(#priority, #nvic_prio_bits), ); )); // NOTE unmask the interrupt *after* setting its priority: changing the priority of a pended // interrupt is implementation defined - stmts.push(quote!(rtfm::export::NVIC::unmask(#device::#interrupt::#name);)); + stmts.push(quote!(rtic::export::NVIC::unmask(#device::#interrupt::#name);)); } // cross-spawn barriers: now that priorities have been set and the interrupts have been unmasked @@ -84,7 +84,7 @@ pub fn codegen( let sb = util::spawn_barrier(core); let shared = if cfg!(feature = "heterogeneous") { Some(quote!( - #[rtfm::export::shared] + #[rtic::export::shared] )) } else { None @@ -92,7 +92,7 @@ pub fn codegen( const_app.push(quote!( #shared - static #sb: rtfm::export::Barrier = rtfm::export::Barrier::new(); + static #sb: rtic::export::Barrier = rtic::export::Barrier::new(); )); // unblock cores that may send us a message @@ -113,8 +113,8 @@ pub fn codegen( stmts.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];)); stmts.push(quote!(core.SCB.set_priority( - rtfm::export::SystemHandler::#name, - rtfm::export::logical2hw(#priority, #nvic_prio_bits), + rtic::export::SystemHandler::#name, + rtic::export::logical2hw(#priority, #nvic_prio_bits), );)); } @@ -126,12 +126,12 @@ pub fn codegen( stmts.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];)); stmts.push(quote!(core.SCB.set_priority( - rtfm::export::SystemHandler::SysTick, - rtfm::export::logical2hw(#priority, #nvic_prio_bits), + rtic::export::SystemHandler::SysTick, + rtic::export::logical2hw(#priority, #nvic_prio_bits), );)); stmts.push(quote!( - core.SYST.set_clock_source(rtfm::export::SystClkSource::Core); + core.SYST.set_clock_source(rtic::export::SystClkSource::Core); core.SYST.enable_counter(); core.DCB.enable_trace(); )); diff --git a/macros/src/codegen/resources.rs b/macros/src/codegen/resources.rs index 83bfabd7..0bec3e5a 100644 --- a/macros/src/codegen/resources.rs +++ b/macros/src/codegen/resources.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::{ +use rtic_syntax::{ analyze::{Location, Ownership}, ast::App, }; @@ -42,7 +42,7 @@ pub fn codegen( // shared `static`s and cross-initialized resources need to be in `.shared` memory _ => ( if cfg!(feature = "heterogeneous") { - Some(quote!(#[rtfm::export::shared])) + Some(quote!(#[rtic::export::shared])) } else { None }, @@ -129,7 +129,7 @@ pub fn codegen( quote!() } else { quote!(mod resources { - use rtfm::export::Priority; + use rtic::export::Priority; #(#mod_resources)* }) diff --git a/macros/src/codegen/resources_struct.rs b/macros/src/codegen/resources_struct.rs index 07a60616..994e751c 100644 --- a/macros/src/codegen/resources_struct.rs +++ b/macros/src/codegen/resources_struct.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::{ast::App, Context}; +use rtic_syntax::{ast::App, Context}; use crate::{analyze::Analysis, codegen::util}; @@ -164,7 +164,7 @@ pub fn codegen( let arg = if ctxt.is_init() { None } else { - Some(quote!(priority: &#lt rtfm::export::Priority)) + Some(quote!(priority: &#lt rtic::export::Priority)) }; let constructor = quote!( #cfg_core diff --git a/macros/src/codegen/schedule.rs b/macros/src/codegen/schedule.rs index 8cf60985..728d3a09 100644 --- a/macros/src/codegen/schedule.rs +++ b/macros/src/codegen/schedule.rs @@ -2,7 +2,7 @@ use std::collections::{BTreeMap, HashSet}; use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::ast::App; +use rtic_syntax::ast::App; use crate::{ check::Extra, @@ -16,7 +16,7 @@ pub fn codegen(app: &App, extra: &Extra) -> Vec<TokenStream2> { let mut seen = BTreeMap::<u8, HashSet<_>>::new(); for (scheduler, schedulees) in app.schedule_callers() { let m = extra.monotonic(); - let instant = quote!(<#m as rtfm::Monotonic>::Instant); + let instant = quote!(<#m as rtic::Monotonic>::Instant); let sender = scheduler.core(app); let cfg_sender = util::cfg_core(sender, app.args.cores); @@ -58,7 +58,7 @@ pub fn codegen(app: &App, extra: &Extra) -> Vec<TokenStream2> { #(#cfgs)* #section unsafe fn #schedule( - priority: &rtfm::export::Priority, + priority: &rtic::export::Priority, instant: #instant #(,#args)* ) -> Result<(), #ty> { diff --git a/macros/src/codegen/schedule_body.rs b/macros/src/codegen/schedule_body.rs index 208fd0b7..8fd026c2 100644 --- a/macros/src/codegen/schedule_body.rs +++ b/macros/src/codegen/schedule_body.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::{ast::App, Context}; +use rtic_syntax::{ast::App, Context}; use syn::Ident; use crate::codegen::util; @@ -36,7 +36,7 @@ pub fn codegen(scheduler: Context, name: &Ident, app: &App) -> TokenStream2 { let t = util::schedule_t_ident(sender); quote!( unsafe { - use rtfm::Mutex as _; + use rtic::Mutex as _; let input = #tupled; if let Some(index) = #dequeue { @@ -44,7 +44,7 @@ pub fn codegen(scheduler: Context, name: &Ident, app: &App) -> TokenStream2 { #write_instant - let nr = rtfm::export::NotReady { + let nr = rtic::export::NotReady { instant, index, task: #t::#name, diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs index be1eb05c..14a57633 100644 --- a/macros/src/codegen/software_tasks.rs +++ b/macros/src/codegen/software_tasks.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::{ast::App, Context}; +use rtic_syntax::{ast::App, Context}; use crate::{ analyze::Analysis, @@ -52,24 +52,24 @@ pub fn codegen( ) = if receiver == sender { ( cfg_sender.clone(), - quote!(rtfm::export::SCFQ<#cap_ty>), - quote!(rtfm::export::Queue(unsafe { - rtfm::export::iQueue::u8_sc() + quote!(rtic::export::SCFQ<#cap_ty>), + quote!(rtic::export::Queue(unsafe { + rtic::export::iQueue::u8_sc() })), util::link_section("bss", sender), Box::new(|| util::link_section_uninit(Some(sender))), ) } else { let shared = if cfg!(feature = "heterogeneous") { - Some(quote!(#[rtfm::export::shared])) + Some(quote!(#[rtic::export::shared])) } else { None }; ( shared, - quote!(rtfm::export::MCFQ<#cap_ty>), - quote!(rtfm::export::Queue(rtfm::export::iQueue::u8())), + quote!(rtic::export::MCFQ<#cap_ty>), + quote!(rtic::export::Queue(rtic::export::iQueue::u8())), None, Box::new(|| util::link_section_uninit(None)), ) @@ -89,7 +89,7 @@ pub fn codegen( const_app.push(quote!( #cfg_sender struct #fq<'a> { - priority: &'a rtfm::export::Priority, + priority: &'a rtic::export::Priority, } )); @@ -119,7 +119,7 @@ pub fn codegen( #uninit /// Buffer that holds the instants associated to the inputs of a task static mut #instants: - [core::mem::MaybeUninit<<#m as rtfm::Monotonic>::Instant>; #cap_lit] = + [core::mem::MaybeUninit<<#m as rtic::Monotonic>::Instant>; #cap_lit] = [#(#elems,)*]; )); } @@ -176,7 +176,7 @@ pub fn codegen( #cfg_receiver #section fn #name(#(#locals_pat,)* #context: #name::Context #(,#inputs)*) { - use rtfm::Mutex as _; + use rtic::Mutex as _; #(#stmts)* } diff --git a/macros/src/codegen/spawn.rs b/macros/src/codegen/spawn.rs index c63c410b..287c92a1 100644 --- a/macros/src/codegen/spawn.rs +++ b/macros/src/codegen/spawn.rs @@ -2,7 +2,7 @@ use std::collections::{BTreeMap, HashSet}; use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::ast::App; +use rtic_syntax::ast::App; use crate::{ analyze::Analysis, @@ -37,7 +37,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream let let_instant = if app.uses_schedule(receiver) { let m = extra.monotonic(); - Some(quote!(let instant = unsafe { <#m as rtfm::Monotonic>::zero() };)) + Some(quote!(let instant = unsafe { <#m as rtic::Monotonic>::zero() };)) } else { None }; @@ -61,7 +61,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream let instant = if app.uses_schedule(receiver) { let m = extra.monotonic(); - Some(quote!(, instant: <#m as rtfm::Monotonic>::Instant)) + Some(quote!(, instant: <#m as rtic::Monotonic>::Instant)) } else { None }; @@ -74,7 +74,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream #(#cfgs)* #section unsafe fn #spawn( - priority: &rtfm::export::Priority + priority: &rtic::export::Priority #instant #(,#args)* ) -> Result<(), #ty> { @@ -88,7 +88,7 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream ( Some(if spawner.is_idle() { - quote!(let instant = <#m as rtfm::Monotonic>::now();) + quote!(let instant = <#m as rtic::Monotonic>::now();) } else { quote!(let instant = self.instant();) }), diff --git a/macros/src/codegen/spawn_body.rs b/macros/src/codegen/spawn_body.rs index 98bce074..3433875e 100644 --- a/macros/src/codegen/spawn_body.rs +++ b/macros/src/codegen/spawn_body.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::{ast::App, Context}; +use rtic_syntax::{ast::App, Context}; use syn::Ident; use crate::{analyze::Analysis, check::Extra, codegen::util}; @@ -53,7 +53,7 @@ pub fn codegen( ) } else { quote!( - rtfm::pend(#device::#enum_::#interrupt); + rtic::pend(#device::#enum_::#interrupt); ) }; @@ -61,7 +61,7 @@ pub fn codegen( let inputs = util::inputs_ident(name, sender); quote!( unsafe { - use rtfm::Mutex as _; + use rtic::Mutex as _; let input = #tupled; if let Some(index) = #dequeue { diff --git a/macros/src/codegen/timer_queue.rs b/macros/src/codegen/timer_queue.rs index 3af7e432..56304001 100644 --- a/macros/src/codegen/timer_queue.rs +++ b/macros/src/codegen/timer_queue.rs @@ -1,6 +1,6 @@ use proc_macro2::TokenStream as TokenStream2; use quote::quote; -use rtfm_syntax::ast::App; +use rtic_syntax::ast::App; use crate::{analyze::Analysis, check::Extra, codegen::util}; @@ -46,22 +46,22 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream let doc = format!("Core #{} timer queue", sender); let m = extra.monotonic(); let n = util::capacity_typenum(timer_queue.capacity, false); - let tq_ty = quote!(rtfm::export::TimerQueue<#m, #t, #n>); + let tq_ty = quote!(rtic::export::TimerQueue<#m, #t, #n>); let section = util::link_section("bss", sender); items.push(quote!( #cfg_sender #[doc = #doc] #section - static mut #tq: #tq_ty = rtfm::export::TimerQueue( - rtfm::export::BinaryHeap( - rtfm::export::iBinaryHeap::new() + static mut #tq: #tq_ty = rtic::export::TimerQueue( + rtic::export::BinaryHeap( + rtic::export::iBinaryHeap::new() ) ); #cfg_sender struct #tq<'a> { - priority: &'a rtfm::export::Priority, + priority: &'a rtic::export::Priority, } )); @@ -100,14 +100,14 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream ) } else { quote!( - rtfm::pend(#device::#enum_::#interrupt); + rtic::pend(#device::#enum_::#interrupt); ) }; quote!( #(#cfgs)* #t::#name => { - (#rq { priority: &rtfm::export::Priority::new(PRIORITY) }).lock(|rq| { + (#rq { priority: &rtic::export::Priority::new(PRIORITY) }).lock(|rq| { rq.split().0.enqueue_unchecked((#rqt::#name, index)) }); @@ -125,15 +125,15 @@ pub fn codegen(app: &App, analysis: &Analysis, extra: &Extra) -> Vec<TokenStream #cfg_sender #section unsafe fn #sys_tick() { - use rtfm::Mutex as _; + use rtic::Mutex as _; /// The priority of this handler const PRIORITY: u8 = #priority; - rtfm::export::run(PRIORITY, || { + rtic::export::run(PRIORITY, || { while let Some((task, index)) = (#tq { // NOTE dynamic priority is always the static priority at this point - priority: &rtfm::export::Priority::new(PRIORITY), + priority: &rtic::export::Priority::new(PRIORITY), }) // NOTE `inline(always)` produces faster and smaller code .lock(#[inline(always)] diff --git a/macros/src/codegen/util.rs b/macros/src/codegen/util.rs index 207272dc..68aca5d1 100644 --- a/macros/src/codegen/util.rs +++ b/macros/src/codegen/util.rs @@ -2,7 +2,7 @@ use core::sync::atomic::{AtomicUsize, Ordering}; use proc_macro2::{Span, TokenStream as TokenStream2}; use quote::quote; -use rtfm_syntax::{ast::App, Context, Core}; +use rtic_syntax::{ast::App, Context, Core}; use syn::{Attribute, Ident, LitInt, PatType}; use crate::check::Extra; @@ -22,7 +22,7 @@ pub fn capacity_typenum(capacity: u8, round_up_to_power_of_two: bool) -> TokenSt let ident = Ident::new(&format!("U{}", capacity), Span::call_site()); - quote!(rtfm::export::consts::#ident) + quote!(rtic::export::consts::#ident) } /// Generates a `#[cfg(core = "0")]` attribute if we are in multi-core mode @@ -69,7 +69,7 @@ pub fn impl_mutex( quote!( #(#cfgs)* #cfg_core - impl<'a> rtfm::Mutex for #path<'a> { + impl<'a> rtic::Mutex for #path<'a> { type T = #ty; #[inline(always)] @@ -78,7 +78,7 @@ pub fn impl_mutex( const CEILING: u8 = #ceiling; unsafe { - rtfm::export::lock( + rtic::export::lock( #ptr, #priority, CEILING, @@ -143,7 +143,7 @@ fn link_section_index() -> usize { pub fn link_section(section: &str, core: Core) -> Option<TokenStream2> { if cfg!(feature = "homogeneous") { - let section = format!(".{}_{}.rtfm{}", section, core, link_section_index()); + let section = format!(".{}_{}.rtic{}", section, core, link_section_index()); Some(quote!(#[link_section = #section])) } else { None @@ -156,9 +156,9 @@ pub fn link_section_uninit(core: Option<Core>) -> Option<TokenStream2> { let index = link_section_index(); if cfg!(feature = "homogeneous") { - format!(".uninit_{}.rtfm{}", core, index) + format!(".uninit_{}.rtic{}", core, index) } else { - format!(".uninit.rtfm{}", index) + format!(".uninit.rtic{}", index) } } else { if cfg!(feature = "heterogeneous") { @@ -166,7 +166,7 @@ pub fn link_section_uninit(core: Option<Core>) -> Option<TokenStream2> { return None; } - format!(".uninit.rtfm{}", link_section_index()) + format!(".uninit.rtic{}", link_section_index()) }; Some(quote!(#[link_section = #section])) diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 54282e1e..b5803628 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -5,7 +5,7 @@ extern crate proc_macro; use proc_macro::TokenStream; use std::{fs, path::Path}; -use rtfm_syntax::Settings; +use rtic_syntax::Settings; mod analyze; mod check; @@ -13,7 +13,7 @@ mod codegen; #[cfg(test)] mod tests; -/// Attribute used to declare a RTFM application +/// Attribute used to declare a RTIC application /// /// This attribute must be applied to a `const` item of type `()`. The `const` item is effectively /// used as a `mod` item: its value must be a block that contains items commonly found in modules, @@ -73,10 +73,10 @@ mod tests; /// The first argument of the function, `<fn-name>::Context`, is a structure that contains the /// following fields: /// -/// - `core`. Exclusive access to core peripherals. The type of this field is [`rtfm::Peripherals`] +/// - `core`. Exclusive access to core peripherals. The type of this field is [`rtic::Peripherals`] /// when the `schedule` API is used and [`cortex_m::Peripherals`] when it's not. /// -/// [`rtfm::Peripherals`]: ../rtfm/struct.Peripherals.html +/// [`rtic::Peripherals`]: ../rtic/struct.Peripherals.html /// [`cortex_m::Peripherals`]: https://docs.rs/cortex-m/0.6/cortex_m/peripheral/struct.Peripherals.html /// /// - `device: <device>::Peripherals`. Exclusive access to device-specific peripherals. This @@ -89,9 +89,9 @@ mod tests; /// /// - `resources: <fn-name>::Resources`. A `struct` that contains all the resources that can be /// accessed from this context. Each field is a different resource; each resource may appear as a -/// reference (`&[mut]-`) or as proxy structure that implements the [`rftm::Mutex`][rtfm-mutex] trait. +/// reference (`&[mut]-`) or as proxy structure that implements the [`rftm::Mutex`][rtic-mutex] trait. /// -/// [rtfm-mutex]: ../rtfm/trait.Mutex.html +/// [rtic-mutex]: ../rtic/trait.Mutex.html /// /// - `schedule: <fn-name>::Schedule`. A `struct` that can be used to schedule *software* tasks. /// @@ -210,7 +210,7 @@ pub fn app(args: TokenStream, input: TokenStream) -> TokenStream { settings.parse_extern_interrupt = true; settings.parse_schedule = true; - let (app, analysis) = match rtfm_syntax::parse(args, input, settings) { + let (app, analysis) = match rtic_syntax::parse(args, input, settings) { Err(e) => return e.to_compile_error().into(), Ok(x) => x, }; @@ -226,7 +226,7 @@ pub fn app(args: TokenStream, input: TokenStream) -> TokenStream { // Try to write the expanded code to disk if Path::new("target").exists() { - fs::write("target/rtfm-expansion.rs", ts.to_string()).ok(); + fs::write("target/rtic-expansion.rs", ts.to_string()).ok(); } ts.into() diff --git a/macros/src/tests.rs b/macros/src/tests.rs index 470c9058..94969d1a 100644 --- a/macros/src/tests.rs +++ b/macros/src/tests.rs @@ -1,5 +1,5 @@ -// NOTE these tests are specific to the Cortex-M port; `rtfm-syntax` has a more extensive test suite -// that tests functionality common to all the RTFM ports +// NOTE these tests are specific to the Cortex-M port; `rtic-syntax` has a more extensive test suite +// that tests functionality common to all the RTIC ports mod multi; mod single; diff --git a/macros/src/tests/multi.rs b/macros/src/tests/multi.rs index b55c451f..366789be 100644 --- a/macros/src/tests/multi.rs +++ b/macros/src/tests/multi.rs @@ -1,5 +1,5 @@ use quote::quote; -use rtfm_syntax::Settings; +use rtic_syntax::Settings; #[test] fn analyze() { @@ -7,7 +7,7 @@ fn analyze() { settings.parse_cores = true; settings.parse_extern_interrupt = true; - let (app, analysis) = rtfm_syntax::parse2( + let (app, analysis) = rtic_syntax::parse2( quote!(device = pac, cores = 2), quote!( const APP: () = { diff --git a/macros/src/tests/single.rs b/macros/src/tests/single.rs index 5d7a8a9d..497d1da7 100644 --- a/macros/src/tests/single.rs +++ b/macros/src/tests/single.rs @@ -1,11 +1,11 @@ use quote::quote; -use rtfm_syntax::Settings; +use rtic_syntax::Settings; #[test] fn analyze() { let mut settings = Settings::default(); settings.parse_extern_interrupt = true; - let (app, analysis) = rtfm_syntax::parse2( + let (app, analysis) = rtic_syntax::parse2( quote!(device = pac), quote!( const APP: () = { |