diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs index c38013325f..afda26cf0c 100644 --- a/macros/src/codegen/module.rs +++ b/macros/src/codegen/module.rs @@ -266,6 +266,9 @@ pub fn codegen( let user_imports = &app.user_imports; + let doc = format!(" RTIC internal: {}:{}", file!(), line!()); + items.push(quote!(#[doc = #doc])); + items.push(quote!( /// Holds methods related to this monotonic pub mod #m { @@ -312,6 +315,7 @@ pub fn codegen( .write(input); #app_path::#instants + .get_mut_unchecked() .get_unchecked_mut(usize::from(index)) .as_mut_ptr() .write(instant); @@ -324,7 +328,7 @@ pub fn codegen( rtic::export::interrupt::free(|_| if let Some(mono) = #app_path::#m_ident.as_mut() { - #app_path::#tq.enqueue_unchecked( + #app_path::#tq.get_mut_unchecked().enqueue_unchecked( nr, || #enable_interrupt, || #pend, diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs index b114f79dca..d4ff274db0 100644 --- a/macros/src/codegen/software_tasks.rs +++ b/macros/src/codegen/software_tasks.rs @@ -65,13 +65,14 @@ pub fn codegen( let mono_type = &monotonic.ty; let uninit = mk_uninit(); + let doc = format!(" RTIC internal: {}:{}", file!(), line!()); mod_app.push(quote!( #uninit // /// Buffer that holds the instants associated to the inputs of a task - #[doc(hidden)] - static mut #instants: - [core::mem::MaybeUninit>; #cap_lit] = - [#(#elems,)*]; + #[doc = #doc] + static #instants: + rtic::RacyCell<[core::mem::MaybeUninit>; #cap_lit]> = + rtic::RacyCell::new([#(#elems,)*]); )); } diff --git a/macros/src/codegen/timer_queue.rs b/macros/src/codegen/timer_queue.rs index f3fb5804f6..47f45350e6 100644 --- a/macros/src/codegen/timer_queue.rs +++ b/macros/src/codegen/timer_queue.rs @@ -61,13 +61,13 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec); + let doc = format!(" RTIC internal: {}:{}", file!(), line!()); items.push(quote!( - #[doc(hidden)] - static mut #tq: #tq_ty = rtic::export::TimerQueue( - rtic::export::BinaryHeap( - rtic::export::iBinaryHeap::new() - ) - ); + #[doc = #doc] + static #tq: rtic::RacyCell<#tq_ty> = + rtic::RacyCell::new(rtic::export::TimerQueue( + rtic::export::BinaryHeap(rtic::export::iBinaryHeap::new()) + )); )); let mono = util::monotonic_ident(&monotonic_name); @@ -129,7 +129,7 @@ pub fn codegen(app: &App, analysis: &Analysis, _extra: &Extra) -> Vec