mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-12-25 03:19:34 +01:00
Merge #85
85: fix master r=japaric a=japaric closes #80 Co-authored-by: Ferdia McKeogh <chocol4te@users.noreply.github.com> Co-authored-by: Jorge Aparicio <jorge@japaric.io>
This commit is contained in:
commit
62a232f5c6
45 changed files with 56 additions and 111 deletions
25
.travis.yml
25
.travis.yml
|
@ -7,44 +7,21 @@ matrix:
|
||||||
|
|
||||||
- env: TARGET=thumbv6m-none-eabi
|
- env: TARGET=thumbv6m-none-eabi
|
||||||
rust: nightly
|
rust: nightly
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- debian-sid
|
|
||||||
packages:
|
|
||||||
- binutils-arm-none-eabi
|
|
||||||
|
|
||||||
- env: TARGET=thumbv7m-none-eabi
|
- env: TARGET=thumbv7m-none-eabi
|
||||||
rust: nightly
|
rust: nightly
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- debian-sid
|
|
||||||
packages:
|
|
||||||
- binutils-arm-none-eabi
|
|
||||||
|
|
||||||
- env: TARGET=thumbv7em-none-eabi
|
- env: TARGET=thumbv7em-none-eabi
|
||||||
rust: nightly
|
rust: nightly
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- debian-sid
|
|
||||||
packages:
|
|
||||||
- binutils-arm-none-eabi
|
|
||||||
|
|
||||||
- env: TARGET=thumbv7em-none-eabihf
|
- env: TARGET=thumbv7em-none-eabihf
|
||||||
rust: nightly
|
rust: nightly
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- debian-sid
|
|
||||||
packages:
|
|
||||||
- binutils-arm-none-eabi
|
|
||||||
|
|
||||||
before_install: set -e
|
before_install: set -e
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- bash ci/install.sh
|
- bash ci/install.sh
|
||||||
|
- export PATH="$PATH:$PWD/gcc/bin"
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- bash ci/script.sh
|
- bash ci/script.sh
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[dependencies.core]
|
|
||||||
stage = 0
|
|
||||||
|
|
||||||
[dependencies.compiler_builtins]
|
|
||||||
stage = 1
|
|
|
@ -4,6 +4,10 @@ main() {
|
||||||
if [ $TARGET != x86_64-unknown-linux-gnu ]; then
|
if [ $TARGET != x86_64-unknown-linux-gnu ]; then
|
||||||
rustup target add $TARGET
|
rustup target add $TARGET
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir gcc
|
||||||
|
|
||||||
|
curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2?revision=bc2c96c0-14b5-4bb4-9f18-bceb4050fee7?product=GNU%20Arm%20Embedded%20Toolchain,64-bit,,Linux,7-2018-q2-update | tar --strip-components=1 -C gcc -xj
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! A showcase of the `app!` macro syntax
|
//! A showcase of the `app!` macro syntax
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
@ -60,7 +59,7 @@ mod main {
|
||||||
|
|
||||||
pub fn idle(t: &mut Threshold, mut r: ::idle::Resources) -> ! {
|
pub fn idle(t: &mut Threshold, mut r: ::idle::Resources) -> ! {
|
||||||
loop {
|
loop {
|
||||||
*r.OWNED != *r.OWNED;
|
*r.OWNED = !*r.OWNED;
|
||||||
|
|
||||||
if *r.OWNED {
|
if *r.OWNED {
|
||||||
if r.SHARED.claim(t, |shared, _| *shared) {
|
if r.SHARED.claim(t, |shared, _| *shared) {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
//! Working with resources in a generic fashion
|
//! Working with resources in a generic fashion
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
extern crate stm32f103xx;
|
extern crate stm32f103xx;
|
||||||
|
|
||||||
use rtfm::{app, Resource, Threshold};
|
use rtfm::{app, Resource, Threshold};
|
||||||
use stm32f103xx::{SPI1, GPIOA};
|
use stm32f103xx::{GPIOA, SPI1};
|
||||||
|
|
||||||
app! {
|
app! {
|
||||||
device: stm32f103xx,
|
device: stm32f103xx,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! Demonstrates initialization of resources in `init`.
|
//! Demonstrates initialization of resources in `init`.
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
//! letters in the comments: A, then B, then C, etc.
|
//! letters in the comments: A, then B, then C, etc.
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
@ -60,7 +59,13 @@ fn idle() -> ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn exti0(t: &mut Threshold, EXTI0::Resources { mut LOW, mut HIGH }: EXTI0::Resources) {
|
fn exti0(
|
||||||
|
t: &mut Threshold,
|
||||||
|
EXTI0::Resources {
|
||||||
|
LOW: mut low,
|
||||||
|
HIGH: mut high,
|
||||||
|
}: EXTI0::Resources,
|
||||||
|
) {
|
||||||
// Because this task has a priority of 1 the preemption threshold `t` also
|
// Because this task has a priority of 1 the preemption threshold `t` also
|
||||||
// starts at 1
|
// starts at 1
|
||||||
|
|
||||||
|
@ -71,7 +76,7 @@ fn exti0(t: &mut Threshold, EXTI0::Resources { mut LOW, mut HIGH }: EXTI0::Resou
|
||||||
rtfm::set_pending(Interrupt::EXTI1); // ~> exti1
|
rtfm::set_pending(Interrupt::EXTI1); // ~> exti1
|
||||||
|
|
||||||
// A claim creates a critical section
|
// A claim creates a critical section
|
||||||
LOW.claim_mut(t, |_low, t| {
|
low.claim_mut(t, |_low, t| {
|
||||||
// This claim increases the preemption threshold to 2
|
// This claim increases the preemption threshold to 2
|
||||||
//
|
//
|
||||||
// 2 is just high enough to not race with task `exti1` for access to the
|
// 2 is just high enough to not race with task `exti1` for access to the
|
||||||
|
@ -92,7 +97,7 @@ fn exti0(t: &mut Threshold, EXTI0::Resources { mut LOW, mut HIGH }: EXTI0::Resou
|
||||||
rtfm::bkpt();
|
rtfm::bkpt();
|
||||||
|
|
||||||
// Claims can be nested
|
// Claims can be nested
|
||||||
HIGH.claim_mut(t, |_high, _| {
|
high.claim_mut(t, |_high, _| {
|
||||||
// This claim increases the preemption threshold to 3
|
// This claim increases the preemption threshold to 3
|
||||||
|
|
||||||
// Now `exti2` can't preempt this task
|
// Now `exti2` can't preempt this task
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! An application with one task
|
//! An application with one task
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m;
|
extern crate cortex_m;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! Two tasks running at *different* priorities with access to the same resource
|
//! Two tasks running at *different* priorities with access to the same resource
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! Safe creation of `&'static mut` references
|
//! Safe creation of `&'static mut` references
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! Two tasks running at the *same* priority with access to the same resource
|
//! Two tasks running at the *same* priority with access to the same resource
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
//! Minimal example with zero tasks
|
//! Minimal example with zero tasks
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
// IMPORTANT always include this feature gate
|
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm; // IMPORTANT always do this rename
|
extern crate cortex_m_rtfm as rtfm; // IMPORTANT always do this rename
|
||||||
|
|
|
@ -11,10 +11,10 @@ version = "0.3.1"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
failure = "0.1.1"
|
failure = "0.1.1"
|
||||||
proc-macro2 = "0.3.6"
|
proc-macro2 = "0.4.6"
|
||||||
quote = "0.5.1"
|
quote = "0.6.3"
|
||||||
rtfm-syntax = "0.3.0"
|
rtfm-syntax = "0.3.4"
|
||||||
syn = "0.13.1"
|
syn = "0.14.2"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
|
@ -61,7 +61,7 @@ pub fn app(app: check::App) -> Result<App> {
|
||||||
tasks: app.tasks
|
tasks: app.tasks
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(k, v)| {
|
.map(|(k, v)| {
|
||||||
let v = ::check::task(k.as_ref(), v)?;
|
let v = ::check::task(&k.to_string(), v)?;
|
||||||
|
|
||||||
Ok((k, v))
|
Ok((k, v))
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//! Procedural macros of the `cortex-m-rtfm` crate
|
//! Procedural macros of the `cortex-m-rtfm` crate
|
||||||
// #![deny(warnings)]
|
// #![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![recursion_limit = "128"]
|
#![recursion_limit = "128"]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
use proc_macro2::Span;
|
use proc_macro2::{TokenStream, Span};
|
||||||
use quote::Tokens;
|
|
||||||
use syn::{Ident, LitStr};
|
use syn::{Ident, LitStr};
|
||||||
|
|
||||||
use analyze::Ownerships;
|
use analyze::Ownerships;
|
||||||
use check::{App, Kind};
|
use check::{App, Kind};
|
||||||
|
|
||||||
fn krate() -> Ident {
|
fn krate() -> Ident {
|
||||||
Ident::from("rtfm")
|
Ident::new("rtfm", Span::call_site())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn app(app: &App, ownerships: &Ownerships) -> Tokens {
|
pub fn app(app: &App, ownerships: &Ownerships) -> TokenStream {
|
||||||
let mut root = vec![];
|
let mut root = vec![];
|
||||||
let mut main = vec![quote!(#![allow(path_statements)])];
|
let mut main = vec![quote!(#![allow(path_statements)])];
|
||||||
|
|
||||||
|
@ -28,7 +27,7 @@ pub fn app(app: &App, ownerships: &Ownerships) -> Tokens {
|
||||||
quote!(#(#root)*)
|
quote!(#(#root)*)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn idle(app: &App, ownerships: &Ownerships, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
|
fn idle(app: &App, ownerships: &Ownerships, main: &mut Vec<TokenStream>, root: &mut Vec<TokenStream>) {
|
||||||
let krate = krate();
|
let krate = krate();
|
||||||
|
|
||||||
let mut mod_items = vec![];
|
let mut mod_items = vec![];
|
||||||
|
@ -54,7 +53,7 @@ fn idle(app: &App, ownerships: &Ownerships, main: &mut Vec<Tokens>, root: &mut V
|
||||||
let super_ = if needs_reexport {
|
let super_ = if needs_reexport {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(Ident::from("super"))
|
Some(Ident::new("super", Span::call_site()))
|
||||||
};
|
};
|
||||||
let mut rexprs = vec![];
|
let mut rexprs = vec![];
|
||||||
let mut rfields = vec![];
|
let mut rfields = vec![];
|
||||||
|
@ -70,7 +69,7 @@ fn idle(app: &App, ownerships: &Ownerships, main: &mut Vec<Tokens>, root: &mut V
|
||||||
pub #name: &'static mut #ty,
|
pub #name: &'static mut #ty,
|
||||||
});
|
});
|
||||||
|
|
||||||
let _name = Ident::from(format!("_{}", name.as_ref()));
|
let _name = Ident::new(&name.to_string(), Span::call_site());
|
||||||
rexprs.push(if resource.expr.is_some() {
|
rexprs.push(if resource.expr.is_some() {
|
||||||
quote! {
|
quote! {
|
||||||
#name: &mut #super_::#_name,
|
#name: &mut #super_::#_name,
|
||||||
|
@ -86,7 +85,7 @@ fn idle(app: &App, ownerships: &Ownerships, main: &mut Vec<Tokens>, root: &mut V
|
||||||
});
|
});
|
||||||
|
|
||||||
rexprs.push(quote! {
|
rexprs.push(quote! {
|
||||||
#name: ::idle::#name { _0: core::marker::PhantomData },
|
#name: ::idle::#name { _0: ::core::marker::PhantomData },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +135,7 @@ fn idle(app: &App, ownerships: &Ownerships, main: &mut Vec<Tokens>, root: &mut V
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let _name = Ident::from(format!("_{}", name.as_ref()));
|
let _name = Ident::new(&name.to_string(), Span::call_site());
|
||||||
let resource = app.resources
|
let resource = app.resources
|
||||||
.get(name)
|
.get(name)
|
||||||
.expect(&format!("BUG: resource {} has no definition", name));
|
.expect(&format!("BUG: resource {} has no definition", name));
|
||||||
|
@ -150,7 +149,7 @@ fn idle(app: &App, ownerships: &Ownerships, main: &mut Vec<Tokens>, root: &mut V
|
||||||
|
|
||||||
mod_items.push(quote! {
|
mod_items.push(quote! {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub struct #name { _0: core::marker::PhantomData<*const ()> }
|
pub struct #name { _0: ::core::marker::PhantomData<*const ()> }
|
||||||
});
|
});
|
||||||
|
|
||||||
root.push(quote! {
|
root.push(quote! {
|
||||||
|
@ -224,7 +223,7 @@ fn idle(app: &App, ownerships: &Ownerships, main: &mut Vec<Tokens>, root: &mut V
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
|
fn init(app: &App, main: &mut Vec<TokenStream>, root: &mut Vec<TokenStream>) {
|
||||||
let device = &app.device;
|
let device = &app.device;
|
||||||
let krate = krate();
|
let krate = krate();
|
||||||
|
|
||||||
|
@ -263,7 +262,7 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
|
||||||
&mut #name
|
&mut #name
|
||||||
},));
|
},));
|
||||||
} else {
|
} else {
|
||||||
let _name = Ident::from(format!("_{}", name.as_ref()));
|
let _name = Ident::new(&name.to_string(), Span::call_site());
|
||||||
lifetime = Some(quote!('a));
|
lifetime = Some(quote!('a));
|
||||||
|
|
||||||
fields.push(quote! {
|
fields.push(quote! {
|
||||||
|
@ -310,7 +309,7 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
|
||||||
let mut fields = vec![];
|
let mut fields = vec![];
|
||||||
|
|
||||||
for (name, resource) in late_resources {
|
for (name, resource) in late_resources {
|
||||||
let _name = Ident::from(format!("_{}", name.as_ref()));
|
let _name = Ident::new(&name.to_string(), Span::call_site());
|
||||||
|
|
||||||
let ty = &resource.ty;
|
let ty = &resource.ty;
|
||||||
|
|
||||||
|
@ -415,11 +414,11 @@ fn init(app: &App, main: &mut Vec<Tokens>, root: &mut Vec<Tokens>) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
|
fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<TokenStream>) {
|
||||||
let krate = krate();
|
let krate = krate();
|
||||||
|
|
||||||
for name in ownerships.keys() {
|
for name in ownerships.keys() {
|
||||||
let _name = Ident::from(format!("_{}", name.as_ref()));
|
let _name = Ident::new(&name.to_string(), Span::call_site());
|
||||||
|
|
||||||
// Declare the static that holds the resource
|
// Declare the static that holds the resource
|
||||||
let resource = app.resources
|
let resource = app.resources
|
||||||
|
@ -442,7 +441,7 @@ fn resources(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>, main: &mut Vec<Tokens>) {
|
fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<TokenStream>, main: &mut Vec<TokenStream>) {
|
||||||
let device = &app.device;
|
let device = &app.device;
|
||||||
let krate = krate();
|
let krate = krate();
|
||||||
|
|
||||||
|
@ -456,7 +455,7 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>, main: &mut
|
||||||
if has_resources {
|
if has_resources {
|
||||||
for rname in &task.resources {
|
for rname in &task.resources {
|
||||||
let ceiling = ownerships[rname].ceiling();
|
let ceiling = ownerships[rname].ceiling();
|
||||||
let _rname = Ident::from(format!("_{}", rname.as_ref()));
|
let _rname = Ident::new(&rname.to_string(), Span::call_site());
|
||||||
let resource = app.resources
|
let resource = app.resources
|
||||||
.get(rname)
|
.get(rname)
|
||||||
.expect(&format!("BUG: resource {} has no definition", rname));
|
.expect(&format!("BUG: resource {} has no definition", rname));
|
||||||
|
@ -594,8 +593,8 @@ fn tasks(app: &App, ownerships: &Ownerships, root: &mut Vec<Tokens>, main: &mut
|
||||||
}
|
}
|
||||||
|
|
||||||
let path = &task.path;
|
let path = &task.path;
|
||||||
let _tname = Ident::from(format!("_{}", tname));
|
let _tname = Ident::new(&tname.to_string(), Span::call_site());
|
||||||
let export_name = LitStr::new(tname.as_ref(), Span::call_site());
|
let export_name = LitStr::new(&tname.to_string(), Span::call_site());
|
||||||
root.push(quote! {
|
root.push(quote! {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! #![deny(unsafe_code)]
|
//! #![deny(unsafe_code)]
|
||||||
//! #![deny(warnings)]
|
//! #![deny(warnings)]
|
||||||
//! // IMPORTANT always include this feature gate
|
|
||||||
//! #![feature(proc_macro)]
|
|
||||||
//! #![no_std]
|
//! #![no_std]
|
||||||
//!
|
//!
|
||||||
//! extern crate cortex_m_rtfm as rtfm; // IMPORTANT always do this rename
|
//! extern crate cortex_m_rtfm as rtfm; // IMPORTANT always do this rename
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! #![deny(unsafe_code)]
|
//! #![deny(unsafe_code)]
|
||||||
//! #![deny(warnings)]
|
//! #![deny(warnings)]
|
||||||
//! #![feature(proc_macro)]
|
|
||||||
//! #![no_std]
|
//! #![no_std]
|
||||||
//!
|
//!
|
||||||
//! extern crate cortex_m;
|
//! extern crate cortex_m;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! #![deny(unsafe_code)]
|
//! #![deny(unsafe_code)]
|
||||||
//! #![deny(warnings)]
|
//! #![deny(warnings)]
|
||||||
//! #![feature(proc_macro)]
|
|
||||||
//! #![no_std]
|
//! #![no_std]
|
||||||
//!
|
//!
|
||||||
//! extern crate cortex_m_rtfm as rtfm;
|
//! extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! #![deny(unsafe_code)]
|
//! #![deny(unsafe_code)]
|
||||||
//! #![deny(warnings)]
|
//! #![deny(warnings)]
|
||||||
//! #![feature(proc_macro)]
|
|
||||||
//! #![no_std]
|
//! #![no_std]
|
||||||
//!
|
//!
|
||||||
//! extern crate cortex_m_rtfm as rtfm;
|
//! extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -6,14 +6,13 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! #![deny(unsafe_code)]
|
//! #![deny(unsafe_code)]
|
||||||
//! #![deny(warnings)]
|
//! #![deny(warnings)]
|
||||||
//! #![feature(proc_macro)]
|
|
||||||
//! #![no_std]
|
//! #![no_std]
|
||||||
//!
|
//!
|
||||||
//! extern crate cortex_m_rtfm as rtfm;
|
//! extern crate cortex_m_rtfm as rtfm;
|
||||||
//! extern crate stm32f103xx;
|
//! extern crate stm32f103xx;
|
||||||
//!
|
//!
|
||||||
//! use stm32f103xx::Interrupt;
|
|
||||||
//! use rtfm::{app, Resource, Threshold};
|
//! use rtfm::{app, Resource, Threshold};
|
||||||
|
//! use stm32f103xx::Interrupt;
|
||||||
//!
|
//!
|
||||||
//! app! {
|
//! app! {
|
||||||
//! device: stm32f103xx,
|
//! device: stm32f103xx,
|
||||||
|
@ -64,7 +63,10 @@
|
||||||
//! #[allow(non_snake_case)]
|
//! #[allow(non_snake_case)]
|
||||||
//! fn exti0(
|
//! fn exti0(
|
||||||
//! t: &mut Threshold,
|
//! t: &mut Threshold,
|
||||||
//! EXTI0::Resources { mut LOW, mut HIGH }: EXTI0::Resources,
|
//! EXTI0::Resources {
|
||||||
|
//! LOW: mut low,
|
||||||
|
//! HIGH: mut high,
|
||||||
|
//! }: EXTI0::Resources,
|
||||||
//! ) {
|
//! ) {
|
||||||
//! // Because this task has a priority of 1 the preemption threshold `t` also
|
//! // Because this task has a priority of 1 the preemption threshold `t` also
|
||||||
//! // starts at 1
|
//! // starts at 1
|
||||||
|
@ -76,7 +78,7 @@
|
||||||
//! rtfm::set_pending(Interrupt::EXTI1); // ~> exti1
|
//! rtfm::set_pending(Interrupt::EXTI1); // ~> exti1
|
||||||
//!
|
//!
|
||||||
//! // A claim creates a critical section
|
//! // A claim creates a critical section
|
||||||
//! LOW.claim_mut(t, |_low, t| {
|
//! low.claim_mut(t, |_low, t| {
|
||||||
//! // This claim increases the preemption threshold to 2
|
//! // This claim increases the preemption threshold to 2
|
||||||
//! //
|
//! //
|
||||||
//! // 2 is just high enough to not race with task `exti1` for access to the
|
//! // 2 is just high enough to not race with task `exti1` for access to the
|
||||||
|
@ -97,7 +99,7 @@
|
||||||
//! rtfm::bkpt();
|
//! rtfm::bkpt();
|
||||||
//!
|
//!
|
||||||
//! // Claims can be nested
|
//! // Claims can be nested
|
||||||
//! HIGH.claim_mut(t, |_high, _| {
|
//! high.claim_mut(t, |_high, _| {
|
||||||
//! // This claim increases the preemption threshold to 3
|
//! // This claim increases the preemption threshold to 3
|
||||||
//!
|
//!
|
||||||
//! // Now `exti2` can't preempt this task
|
//! // Now `exti2` can't preempt this task
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! #![deny(unsafe_code)]
|
//! #![deny(unsafe_code)]
|
||||||
//! #![deny(warnings)]
|
//! #![deny(warnings)]
|
||||||
//! #![feature(proc_macro)]
|
|
||||||
//! #![no_std]
|
//! #![no_std]
|
||||||
//!
|
//!
|
||||||
//! extern crate cortex_m_rtfm as rtfm;
|
//! extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! #![deny(unsafe_code)]
|
//! #![deny(unsafe_code)]
|
||||||
//! #![deny(warnings)]
|
//! #![deny(warnings)]
|
||||||
//! #![feature(proc_macro)]
|
|
||||||
//! #![no_std]
|
//! #![no_std]
|
||||||
//!
|
//!
|
||||||
//! extern crate cortex_m_rtfm as rtfm;
|
//! extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -3,14 +3,13 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! #![deny(unsafe_code)]
|
//! #![deny(unsafe_code)]
|
||||||
//! #![deny(warnings)]
|
//! #![deny(warnings)]
|
||||||
//! #![feature(proc_macro)]
|
|
||||||
//! #![no_std]
|
//! #![no_std]
|
||||||
//!
|
//!
|
||||||
//! extern crate cortex_m_rtfm as rtfm;
|
//! extern crate cortex_m_rtfm as rtfm;
|
||||||
//! extern crate stm32f103xx;
|
//! extern crate stm32f103xx;
|
||||||
//!
|
//!
|
||||||
//! use rtfm::{app, Resource, Threshold};
|
//! use rtfm::{app, Resource, Threshold};
|
||||||
//! use stm32f103xx::{SPI1, GPIOA};
|
//! use stm32f103xx::{GPIOA, SPI1};
|
||||||
//!
|
//!
|
||||||
//! app! {
|
//! app! {
|
||||||
//! device: stm32f103xx,
|
//! device: stm32f103xx,
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
//! ```
|
//! ```
|
||||||
//! #![deny(unsafe_code)]
|
//! #![deny(unsafe_code)]
|
||||||
//! #![deny(warnings)]
|
//! #![deny(warnings)]
|
||||||
//! #![feature(proc_macro)]
|
|
||||||
//! #![no_std]
|
//! #![no_std]
|
||||||
//!
|
//!
|
||||||
//! extern crate cortex_m_rtfm as rtfm;
|
//! extern crate cortex_m_rtfm as rtfm;
|
||||||
|
@ -62,7 +61,7 @@
|
||||||
//!
|
//!
|
||||||
//! pub fn idle(t: &mut Threshold, mut r: ::idle::Resources) -> ! {
|
//! pub fn idle(t: &mut Threshold, mut r: ::idle::Resources) -> ! {
|
||||||
//! loop {
|
//! loop {
|
||||||
//! *r.OWNED != *r.OWNED;
|
//! *r.OWNED = !*r.OWNED;
|
||||||
//!
|
//!
|
||||||
//! if *r.OWNED {
|
//! if *r.OWNED {
|
||||||
//! if r.SHARED.claim(t, |shared, _| *shared) {
|
//! if r.SHARED.claim(t, |shared, _| *shared) {
|
||||||
|
|
|
@ -79,7 +79,6 @@
|
||||||
//! [rtfm]: http://www.diva-portal.org/smash/get/diva2:1005680/FULLTEXT01.pdf
|
//! [rtfm]: http://www.diva-portal.org/smash/get/diva2:1005680/FULLTEXT01.pdf
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m;
|
extern crate cortex_m;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
@ -8,8 +7,9 @@ extern crate stm32f103xx;
|
||||||
|
|
||||||
use rtfm::app;
|
use rtfm::app;
|
||||||
|
|
||||||
app! { //~ error attempt to subtract with overflow
|
app! { //~ error referenced constant has errors
|
||||||
//~^ error constant evaluation error
|
//~^ error could not evaluate constant
|
||||||
|
//~| error constant evaluation error
|
||||||
device: stm32f103xx,
|
device: stm32f103xx,
|
||||||
|
|
||||||
tasks: {
|
tasks: {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
@ -8,8 +7,9 @@ extern crate stm32f103xx;
|
||||||
|
|
||||||
use rtfm::app;
|
use rtfm::app;
|
||||||
|
|
||||||
app! { //~ error attempt to subtract with overflow
|
app! { //~ error referenced constant has errors
|
||||||
//~^ error constant evaluation error
|
//~^ error could not evaluate constant
|
||||||
|
//~| error constant evaluation error
|
||||||
device: stm32f103xx,
|
device: stm32f103xx,
|
||||||
|
|
||||||
tasks: {
|
tasks: {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
@ -47,7 +46,7 @@ fn exti0(_t: &mut Threshold, r: EXTI0::Resources) {
|
||||||
|
|
||||||
// ERROR resource proxies are not `Send`able across tasks
|
// ERROR resource proxies are not `Send`able across tasks
|
||||||
is_send(&r.SHARED);
|
is_send(&r.SHARED);
|
||||||
//~^ error the trait bound `*const (): core::marker::Send` is not satisfied
|
//~^ error `*const ()` cannot be sent between threads safely
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exti1(_t: &mut Threshold, _r: EXTI1::Resources) {
|
fn exti1(_t: &mut Threshold, _r: EXTI1::Resources) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
@ -9,7 +8,7 @@ extern crate stm32f103xx;
|
||||||
|
|
||||||
use rtfm::{app, Threshold};
|
use rtfm::{app, Threshold};
|
||||||
|
|
||||||
app! { //~ error bound `*const (): core::marker::Send` is not satisfied
|
app! { //~ error `*const ()` cannot be sent between threads safely
|
||||||
device: stm32f103xx,
|
device: stm32f103xx,
|
||||||
|
|
||||||
resources: {
|
resources: {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
#![feature(proc_macro)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
extern crate cortex_m_rtfm as rtfm;
|
extern crate cortex_m_rtfm as rtfm;
|
||||||
|
|
Loading…
Reference in a new issue