diff --git a/.gitignore b/.gitignore index 8bc31d43a2..29204d6567 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ **/*.rs.bk *.org +.#* .gdb_history Cargo.lock target/ diff --git a/Cargo.toml b/Cargo.toml index 37db8565e5..e1c7549261 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,8 @@ version = "0.3.0" [dependencies] cortex-m = { git = "https://github.com/japaric/cortex-m" } untagged-option = "0.1.1" -rtfm-core = "0.1.0" +# rtfm-core = "0.1.0" +rtfm-core = { git = "https://github.com/japaric/rtfm-core", branch = "no-static" } cortex-m-rtfm-macros = { path = "macros" } [target.'cfg(target_arch = "x86_64")'.dev-dependencies] diff --git a/examples/full-syntax.rs b/examples/full-syntax.rs index a8f79a7210..b84077fb34 100644 --- a/examples/full-syntax.rs +++ b/examples/full-syntax.rs @@ -63,22 +63,22 @@ mod main { *r.OWNED != *r.OWNED; if *r.OWNED { - if r.SHARED.claim(t, |shared, _| **shared) { + if r.SHARED.claim(t, |shared, _| *shared) { rtfm::wfi(); } } else { - r.SHARED.claim_mut(t, |shared, _| **shared = !**shared); + r.SHARED.claim_mut(t, |shared, _| *shared = !*shared); } } } } fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) { - **r.ON = !**r.ON; + *r.ON = !*r.ON; - **r.CO_OWNED += 1; + *r.CO_OWNED += 1; } fn tim2(_t: &mut Threshold, r: TIM2::Resources) { - **r.CO_OWNED += 1; + *r.CO_OWNED += 1; } diff --git a/examples/one-task.rs b/examples/one-task.rs index 2e77676891..90eb459a2c 100644 --- a/examples/one-task.rs +++ b/examples/one-task.rs @@ -79,9 +79,9 @@ fn idle() -> ! { #[allow(unsafe_code)] fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) { // toggle state - **r.ON = !**r.ON; + *r.ON = !*r.ON; - if **r.ON { + if *r.ON { // set the pin PC13 high // NOTE(unsafe) atomic write to a stateless register unsafe { diff --git a/examples/preemption.rs b/examples/preemption.rs index 98dde8d1f3..07e9362150 100644 --- a/examples/preemption.rs +++ b/examples/preemption.rs @@ -47,7 +47,7 @@ fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) { // This task can't be preempted by `tim2` so it has direct access to the // resource data - **r.COUNTER += 1; + *r.COUNTER += 1; // .. } @@ -61,7 +61,7 @@ fn tim2(t: &mut Threshold, mut r: TIM2::Resources) { // lead to undefined behavior. r.COUNTER.claim_mut(t, |counter, _t| { // `claim_mut` creates a critical section - **counter += 1; + *counter += 1; }); // .. diff --git a/examples/two-tasks.rs b/examples/two-tasks.rs index df6e784a97..e9d31e783d 100644 --- a/examples/two-tasks.rs +++ b/examples/two-tasks.rs @@ -45,7 +45,7 @@ fn idle() -> ! { fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) { // .. - **r.COUNTER += 1; + *r.COUNTER += 1; // .. } @@ -53,7 +53,7 @@ fn sys_tick(_t: &mut Threshold, r: SYS_TICK::Resources) { fn tim2(_t: &mut Threshold, r: TIM2::Resources) { // .. - **r.COUNTER += 1; + *r.COUNTER += 1; // .. } diff --git a/macros/src/trans.rs b/macros/src/trans.rs index 9bf1e2a9dc..b209b8ef53 100644 --- a/macros/src/trans.rs +++ b/macros/src/trans.rs @@ -176,11 +176,11 @@ fn init(app: &App, main: &mut Vec, root: &mut Vec) { let ty = &resource.ty; fields.push(quote! { - pub #name: &'a mut #krate::Static<#ty>, + pub #name: &'a mut #ty, }); rexprs.push(quote! { - #name: ::#krate::Static::ref_mut(&mut ::#_name), + #name: &mut ::#_name, }); } @@ -369,20 +369,20 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec) { fn borrow<'cs>( &'cs self, t: &'cs #krate::Threshold, - ) -> &'cs #krate::Static<#ty> { + ) -> &'cs #ty { assert!(t.value() >= #ceiling); - unsafe { #krate::Static::ref_(&#res_rvalue) } + unsafe { &#res_rvalue } } fn borrow_mut<'cs>( &'cs mut self, t: &'cs #krate::Threshold, - ) -> &'cs mut #krate::Static<#ty> { + ) -> &'cs mut #ty { assert!(t.value() >= #ceiling); unsafe { - #krate::Static::ref_mut(&mut #res_rvalue) + &mut #res_rvalue } } @@ -393,12 +393,12 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec) { ) -> R where F: FnOnce( - &#krate::Static<#ty>, + &#ty, &mut #krate::Threshold) -> R { unsafe { #krate::claim( - #krate::Static::ref_(&#res_rvalue), + &#res_rvalue, #ceiling, #device::NVIC_PRIO_BITS, t, @@ -414,12 +414,12 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec) { ) -> R where F: FnOnce( - &mut #krate::Static<#ty>, + &mut #ty, &mut #krate::Threshold) -> R { unsafe { #krate::claim( - #krate::Static::ref_mut(&mut #res_rvalue), + &mut #res_rvalue, #ceiling, #device::NVIC_PRIO_BITS, t, @@ -510,16 +510,16 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec) { let ty = &resource.ty; fields.push(quote! { - pub #name: &'a mut ::#krate::Static<#ty>, + pub #name: &'a mut #ty, }); exprs.push(if resource.expr.is_some() { quote! { - #name: ::#krate::Static::ref_mut(&mut ::#_name), + #name: &mut ::#_name, } } else { quote! { - #name: ::#krate::Static::ref_mut(::#_name.as_mut()), + #name: ::#_name.as_mut(), } }); } diff --git a/src/lib.rs b/src/lib.rs index f5481bc401..be670490e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,7 +84,7 @@ extern crate untagged_option; use core::u8; -pub use rtfm_core::{Resource, Static, Threshold}; +pub use rtfm_core::{Resource, Threshold}; pub use cortex_m::asm::{bkpt, wfi}; pub use cortex_m_rtfm_macros::app; #[doc(hidden)]