aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Cargo.toml3
-rw-r--r--examples/full-syntax.rs10
-rw-r--r--examples/one-task.rs4
-rw-r--r--examples/preemption.rs4
-rw-r--r--examples/two-tasks.rs4
-rw-r--r--macros/src/trans.rs26
-rw-r--r--src/lib.rs2
8 files changed, 28 insertions, 26 deletions
diff --git a/.gitignore b/.gitignore
index 8bc31d43..29204d65 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 37db8565..e1c75492 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 a8f79a72..b84077fb 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 2e776768..90eb459a 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 98dde8d1..07e93621 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 df6e784a..e9d31e78 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 9bf1e2a9..b209b8ef 100644
--- a/macros/src/trans.rs
+++ b/macros/src/trans.rs
@@ -176,11 +176,11 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
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<Tokens>) {
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<Tokens>) {
) -> 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<Tokens>) {
) -> 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<Tokens>) {
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 f5481bc4..be670490 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)]