Rename RTFM to RTIC

This commit is contained in:
Henrik Tjäder 2020-06-11 17:18:29 +00:00
parent 4a0393f756
commit 602a5b4374
129 changed files with 454 additions and 454 deletions

View file

@ -1,17 +1,17 @@
[package]
authors = [
"The Real Time For the Masses developers",
"The Real-Time Interrupt-driven Concurrency developers",
"Jorge Aparicio <jorge@japaric.io>",
]
categories = ["concurrency", "embedded", "no-std"]
description = "Procedural macros of the cortex-m-rtfm crate"
documentation = "https://rtfm-rs.github.io/cortex-m-rtfm/api/cortex_m_rtfm"
description = "Procedural macros of the cortex-m-rtic crate"
documentation = "https://rtic-rs.github.io/cortex-m-rtic/api/cortex_m_rtic"
edition = "2018"
keywords = ["arm", "cortex-m"]
license = "MIT OR Apache-2.0"
name = "cortex-m-rtfm-macros"
name = "cortex-m-rtic-macros"
readme = "../README.md"
repository = "https://github.com/rtfm-rs/cortex-m-rtfm"
repository = "https://github.com/rtic-rs/cortex-m-rtic"
version = "0.5.0"
[lib]
@ -21,7 +21,7 @@ proc-macro = true
proc-macro2 = "1"
quote = "1"
syn = "1"
rtfm-syntax = "0.4.0"
rtic-syntax = "0.4.0"
[features]
heterogeneous = []

View file

@ -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,

View file

@ -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]`",
))
}
}

View file

@ -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![];

View file

@ -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

View file

@ -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)*
});
}

View file

@ -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)*
}

View file

@ -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()
}),
)
}

View file

@ -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,

View file

@ -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)
};

View file

@ -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
};

View file

@ -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)
}

View file

@ -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();
));

View file

@ -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)*
})

View file

@ -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

View file

@ -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> {

View file

@ -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,

View file

@ -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)*
}

View file

@ -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();)
}),

View file

@ -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 {

View file

@ -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)]

View file

@ -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]))

View file

@ -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()

View file

@ -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;

View file

@ -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: () = {

View file

@ -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: () = {