more fixes

This commit is contained in:
Jorge Aparicio 2018-08-24 16:31:04 +02:00
parent 5a3605050e
commit abca829926
41 changed files with 30 additions and 65 deletions

View file

@ -1,5 +0,0 @@
[dependencies.core]
stage = 0
[dependencies.compiler_builtins]
stage = 1

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -85,7 +85,7 @@ fn idle(app: &App, ownerships: &Ownerships, main: &mut Vec<TokenStream>, root: &
}); });
rexprs.push(quote! { rexprs.push(quote! {
#name: ::idle::#name { _0: core::marker::PhantomData }, #name: ::idle::#name { _0: ::core::marker::PhantomData },
}); });
} }
} }
@ -149,7 +149,7 @@ fn idle(app: &App, ownerships: &Ownerships, main: &mut Vec<TokenStream>, root: &
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! {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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