mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 22:35:19 +01:00
update the cfail tests
This commit is contained in:
parent
205aa44ed5
commit
e34abea704
22 changed files with 258 additions and 187 deletions
|
|
@ -5,9 +5,10 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::{app, Resource, Threshold};
|
||||
use rtfm::{app, Resource};
|
||||
|
||||
app! {
|
||||
device: stm32f103xx,
|
||||
|
|
@ -21,23 +22,27 @@ app! {
|
|||
},
|
||||
|
||||
tasks: {
|
||||
EXTI0: {
|
||||
path: exti0,
|
||||
priority: 1,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
resources: [ON],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals, _r: init::Resources) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
fn idle(mut ctxt: idle::Context) -> ! {
|
||||
let t = &mut ctxt.threshold;
|
||||
let on = ctxt.resources.ON;
|
||||
|
||||
fn idle(t: &mut Threshold, r: idle::Resources) -> ! {
|
||||
let state = rtfm::atomic(t, |t| {
|
||||
// ERROR borrow can't escape this *global* critical section
|
||||
r.ON.borrow(t) //~ error cannot infer an appropriate lifetime
|
||||
on.borrow(t) //~ error cannot infer an appropriate lifetime
|
||||
});
|
||||
|
||||
let state = r.ON.claim(t, |state, _t| {
|
||||
let state = on.claim(t, |state, _t| {
|
||||
// ERROR borrow can't escape this critical section
|
||||
state //~ error cannot infer an appropriate lifetime
|
||||
});
|
||||
|
|
@ -45,4 +50,4 @@ fn idle(t: &mut Threshold, r: idle::Resources) -> ! {
|
|||
loop {}
|
||||
}
|
||||
|
||||
fn exti0(_t: &mut Threshold, _r: EXTI0::Resources) {}
|
||||
fn exti0(_ctxt: exti0::Context) {}
|
||||
|
|
|
|||
|
|
@ -8,21 +8,22 @@ extern crate stm32f103xx;
|
|||
|
||||
use rtfm::app;
|
||||
|
||||
app! {
|
||||
//~^ error proc macro panicked
|
||||
app! { //~ error proc macro panicked
|
||||
device: stm32f103xx,
|
||||
|
||||
tasks: {
|
||||
SYS_TICK: {
|
||||
a: {
|
||||
interrupt: EXTI0, //~ error this interrupt is already bound to another task
|
||||
priority: 1,
|
||||
},
|
||||
|
||||
SYS_TICK: {
|
||||
b: {
|
||||
interrupt: EXTI0,
|
||||
priority: 2,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {}
|
||||
|
||||
fn idle() -> ! {}
|
||||
fn idle(_ctxt: idle::Context) -> ! {}
|
||||
|
|
|
|||
|
|
@ -4,24 +4,27 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::app;
|
||||
|
||||
app! { //~ error proc macro panicked
|
||||
device: stm32f103xx,
|
||||
device: stm32f103xx, //~ no variant named `SYS_TICK` found for type `stm32f103xx::Interrupt`
|
||||
|
||||
tasks: {
|
||||
// ERROR exceptions can't be enabled / disabled here
|
||||
SYS_TICK: {
|
||||
enabled: true,
|
||||
priority: 1,
|
||||
sys_tick: {
|
||||
interrupt: SYS_TICK, // ERROR can't bind to exception
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn sys_tick(_ctxt: sys_tick::Context) {}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,18 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::app;
|
||||
|
||||
app! { //~ error mismatched types
|
||||
app! { //~ mismatched types
|
||||
device: stm32f103xx,
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
// ERROR `idle` must be a diverging function
|
||||
fn idle() {}
|
||||
fn idle(_ctxt: idle::Context) {}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::app;
|
||||
|
|
@ -24,8 +25,10 @@ app! { //~ proc macro panicked
|
|||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals, _r: init::Resources) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
fn idle(_r: init::Resources) -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![feature(proc_macro)]
|
||||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::app;
|
||||
|
|
@ -19,18 +21,20 @@ app! { //~ proc macro panicked
|
|||
},
|
||||
|
||||
tasks: {
|
||||
SYS_TICK: {
|
||||
path: sys_tick,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
resources: [BUFFER],
|
||||
//~^ error: this resource is owned by `init` and can't be shared
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn sys_tick() {}
|
||||
fn exti0(_ctxt: exti0::Context) {}
|
||||
|
|
|
|||
|
|
@ -4,17 +4,19 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::app;
|
||||
|
||||
app! { //~ error mismatched types
|
||||
app! { //~ error incorrect number of function parameters
|
||||
//~^ note expected type `fn(init::Context) -> _ZN4init13LateResourcesE`
|
||||
device: stm32f103xx,
|
||||
}
|
||||
|
||||
// ERROR `init` must have signature `fn (init::Peripherals)`
|
||||
fn init() {}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,24 +4,27 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::app;
|
||||
|
||||
app! { //~ error no variant named `EXTI33` found for type
|
||||
app! { //~ error no variant named `EXTI33` found for type `stm32f103xx::Interrupt`
|
||||
device: stm32f103xx,
|
||||
|
||||
tasks: {
|
||||
EXTI33: {
|
||||
path: exti33,
|
||||
exti33: {
|
||||
interrupt: EXTI33,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn exti33() {}
|
||||
fn exti33(_ctxt: exti33::Context) {}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::{app, Threshold};
|
||||
use rtfm::app;
|
||||
|
||||
app! {
|
||||
device: stm32f103xx,
|
||||
|
|
@ -17,34 +18,32 @@ app! {
|
|||
},
|
||||
|
||||
tasks: {
|
||||
EXTI0: {
|
||||
path: exti0,
|
||||
priority: 1,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
// priority: 1,
|
||||
resources: [A, LATE],
|
||||
},
|
||||
|
||||
EXTI1: {
|
||||
path: exti1,
|
||||
exti1: {
|
||||
interrupt: EXTI1,
|
||||
priority: 2,
|
||||
resources: [A, LATE],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals, r: init::Resources) -> init::LateResources {
|
||||
// Try to use a resource that's not yet initialized:
|
||||
r.LATE;
|
||||
//~^ error: no field `LATE`
|
||||
fn init(ctxt: init::Context) -> init::LateResources {
|
||||
// Tried to use a resource that's not yet initialized:
|
||||
let _late = ctxt.resources.LATE;
|
||||
//~^ error: no field `LATE` on type `init::Resources`
|
||||
|
||||
init::LateResources {
|
||||
LATE: 0,
|
||||
}
|
||||
init::LateResources { LATE: 0 }
|
||||
}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn exti0(_t: &mut Threshold, _r: EXTI0::Resources) {}
|
||||
fn exti0(_ctxt: exti0::Context) {}
|
||||
|
||||
fn exti1(_t: &mut Threshold, _r: EXTI1::Resources) {}
|
||||
fn exti1(_ctxt: exti1::Context) {}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::{app, Resource, Threshold};
|
||||
use rtfm::{app, Resource};
|
||||
|
||||
app! {
|
||||
device: stm32f103xx,
|
||||
|
|
@ -15,54 +16,62 @@ app! {
|
|||
resources: {
|
||||
static ON: bool = false;
|
||||
static MAX: u8 = 0;
|
||||
static OWNED: bool = false;
|
||||
},
|
||||
|
||||
tasks: {
|
||||
EXTI0: {
|
||||
path: exti0,
|
||||
priority: 1,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
// priority: 1,
|
||||
resources: [MAX, ON],
|
||||
},
|
||||
|
||||
EXTI1: {
|
||||
path: exti1,
|
||||
exti1: {
|
||||
interrupt: EXTI1,
|
||||
priority: 2,
|
||||
resources: [ON],
|
||||
resources: [ON, OWNED],
|
||||
},
|
||||
|
||||
EXTI2: {
|
||||
path: exti2,
|
||||
exti2: {
|
||||
interrupt: EXTI2,
|
||||
priority: 16,
|
||||
resources: [MAX],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals, _r: init::Resources) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn exti0(mut t: &mut Threshold, mut r: EXTI0::Resources) {
|
||||
#[allow(non_snake_case)]
|
||||
fn exti0(mut ctxt: exti0::Context) {
|
||||
let exti0::Resources { ON, mut MAX } = ctxt.resources;
|
||||
let t = &mut ctxt.threshold;
|
||||
|
||||
// ERROR need to lock to access the resource because priority < ceiling
|
||||
if *r.ON {
|
||||
//~^ error type `EXTI0::ON` cannot be dereferenced
|
||||
{
|
||||
let _on = ON.borrow(t);
|
||||
//~^ error type mismatch resolving
|
||||
}
|
||||
|
||||
// OK need to lock to access the resource
|
||||
if r.ON.claim(&mut t, |on, _| *on) {}
|
||||
if ON.claim(t, |on, _| *on) {}
|
||||
|
||||
// OK can claim a resource with maximum ceiling
|
||||
r.MAX.claim_mut(&mut t, |max, _| *max += 1);
|
||||
MAX.claim_mut(t, |max, _| *max += 1);
|
||||
}
|
||||
|
||||
fn exti1(mut t: &mut Threshold, r: EXTI1::Resources) {
|
||||
// OK to directly access the resource because priority == ceiling
|
||||
if *r.ON {}
|
||||
#[allow(non_snake_case)]
|
||||
fn exti1(ctxt: exti1::Context) {
|
||||
let exti1::Resources { OWNED, .. } = ctxt.resources;
|
||||
|
||||
// though the resource can still be claimed -- the claim is a no-op
|
||||
if r.ON.claim(&mut t, |on, _| *on) {}
|
||||
// OK to directly access the resource because this task is the only owner
|
||||
if *OWNED {}
|
||||
}
|
||||
|
||||
fn exti2(_t: &mut Threshold, _r: EXTI2::Resources) {}
|
||||
fn exti2(_ctxt: exti2::Context) {}
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![feature(proc_macro)]
|
||||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::app;
|
||||
|
||||
app! { //~ error proc macro panicked
|
||||
device: stm32f103xx,
|
||||
|
||||
tasks: {
|
||||
EXTI0: {
|
||||
enabled: true,
|
||||
priority: 1,
|
||||
// ERROR peripheral appears twice in this list
|
||||
resources: [GPIOA, GPIOA],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals) {}
|
||||
|
||||
fn idle() -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
|
@ -1,30 +1,30 @@
|
|||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![feature(proc_macro)]
|
||||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::app;
|
||||
|
||||
app! { //~ error attempt to subtract with overflow
|
||||
//~^ error constant evaluation error
|
||||
device: stm32f103xx,
|
||||
|
||||
tasks: {
|
||||
SYS_TICK: {
|
||||
path: sys_tick,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
// ERROR priority must be in the range [1, 16]
|
||||
priority: 17,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn sys_tick() {}
|
||||
fn exti0(_ctxt: exti0::Context) {}
|
||||
|
|
|
|||
|
|
@ -4,27 +4,26 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::app;
|
||||
|
||||
app! { //~ error attempt to subtract with overflow
|
||||
//~^ error constant evaluation error
|
||||
app! {
|
||||
device: stm32f103xx,
|
||||
|
||||
tasks: {
|
||||
SYS_TICK: {
|
||||
path: sys_tick,
|
||||
// ERROR priority must be in the range [1, 16]
|
||||
priority: 0,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
priority: 0, //~ error this value is outside the valid range of `(1, 255)`
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn sys_tick() {}
|
||||
fn exti0(_ctxt: exti0::Context) {}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::app;
|
||||
|
|
@ -12,21 +13,23 @@ app! { //~ error proc macro panicked
|
|||
device: stm32f103xx,
|
||||
|
||||
resources: {
|
||||
// resource `MAX` listed twice
|
||||
MAX: u8 = 0;
|
||||
MAX: u16 = 0;
|
||||
static MAX: u8 = 0;
|
||||
static MAX: u16 = 0; //~ error this resource name appears more than once in this list
|
||||
},
|
||||
|
||||
tasks: {
|
||||
EXTI0: {
|
||||
enabled: true,
|
||||
priority: 1,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
resources: [
|
||||
MAX,
|
||||
MAX, //~ error this resource name appears more than once in this list
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(proc_macro)]
|
||||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::{app, Threshold};
|
||||
use rtfm::app;
|
||||
|
||||
app! {
|
||||
device: stm32f103xx,
|
||||
|
|
@ -17,38 +17,47 @@ app! {
|
|||
},
|
||||
|
||||
tasks: {
|
||||
EXTI0: {
|
||||
path: exti0,
|
||||
priority: 1,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
// priority: 1,
|
||||
resources: [SHARED],
|
||||
},
|
||||
|
||||
EXTI1: {
|
||||
path: exti1,
|
||||
exti1: {
|
||||
interrupt: EXTI1,
|
||||
priority: 2,
|
||||
resources: [SHARED],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals, _r: init::Resources) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn is_send<T>(_: &T) where T: Send {}
|
||||
fn is_sync<T>(_: &T) where T: Sync {}
|
||||
fn is_send<T>(_: &T)
|
||||
where
|
||||
T: Send,
|
||||
{
|
||||
}
|
||||
fn is_sync<T>(_: &T)
|
||||
where
|
||||
T: Sync,
|
||||
{
|
||||
}
|
||||
|
||||
fn exti0(_t: &mut Threshold, r: EXTI0::Resources) {
|
||||
fn exti0(ctxt: exti0::Context) {
|
||||
// ERROR resource proxies can't be shared between tasks
|
||||
is_sync(&r.SHARED);
|
||||
is_sync(&ctxt.resources.SHARED);
|
||||
//~^ error `*const ()` cannot be shared between threads safely
|
||||
|
||||
// ERROR resource proxies are not `Send`able across tasks
|
||||
is_send(&r.SHARED);
|
||||
is_send(&ctxt.resources.SHARED);
|
||||
//~^ error the trait bound `*const (): core::marker::Send` is not satisfied
|
||||
}
|
||||
|
||||
fn exti1(_t: &mut Threshold, _r: EXTI1::Resources) {
|
||||
}
|
||||
fn exti1(_ctxt: exti1::Context) {}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(proc_macro)]
|
||||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::{app, Resource, Threshold};
|
||||
use rtfm::{app, Resource};
|
||||
|
||||
app! {
|
||||
device: stm32f103xx,
|
||||
|
|
@ -17,30 +17,33 @@ app! {
|
|||
},
|
||||
|
||||
tasks: {
|
||||
EXTI0: {
|
||||
path: exti0,
|
||||
priority: 1,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
// priority: 1,
|
||||
resources: [STATE],
|
||||
},
|
||||
|
||||
EXTI1: {
|
||||
path: exti1,
|
||||
exti1: {
|
||||
interrupt: EXTI1,
|
||||
priority: 2,
|
||||
resources: [STATE],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals, _r: init::Resources) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn exti0(mut t: &mut Threshold, r: EXTI0::Resources) {
|
||||
fn exti0(ctxt: exti0::Context) {
|
||||
// ERROR token should not outlive the critical section
|
||||
let t = r.STATE.claim(&mut t, |_state, t| t);
|
||||
let t = &mut ctxt.threshold;
|
||||
let t = ctxt.resources.STATE.claim(t, |_state, t| t);
|
||||
//~^ error cannot infer an appropriate lifetime
|
||||
}
|
||||
|
||||
fn exti1(_t: &mut Threshold, _r: EXTI1::Resources) {}
|
||||
fn exti1(_ctxt: exti1::Context) {}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,18 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
extern crate typenum;
|
||||
|
||||
use rtfm::{app, Threshold};
|
||||
use typenum::consts::U1;
|
||||
|
||||
app! { //~ error bound `*const (): core::marker::Send` is not satisfied
|
||||
device: stm32f103xx,
|
||||
|
||||
resources: {
|
||||
static TOKEN: Option<Threshold> = None;
|
||||
static TOKEN: Option<Threshold<U1>> = None;
|
||||
},
|
||||
|
||||
idle: {
|
||||
|
|
@ -21,17 +24,17 @@ app! { //~ error bound `*const (): core::marker::Send` is not satisfied
|
|||
},
|
||||
|
||||
tasks: {
|
||||
EXTI0: {
|
||||
path: exti0,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
resources: [TOKEN],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals, _r: init::Resources) {}
|
||||
fn init(_ctxt: init::Context) {}
|
||||
|
||||
fn idle(_t: &mut Threshold, _r: idle::Resources) -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn exti0(_t: &mut Threshold, _r: EXTI0::Resources) {}
|
||||
fn exti0(_ctxt: exti0::Context) {}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@
|
|||
#![no_std]
|
||||
|
||||
extern crate cortex_m_rtfm as rtfm;
|
||||
extern crate panic_abort;
|
||||
extern crate stm32f103xx;
|
||||
|
||||
use rtfm::{app, Resource, Threshold};
|
||||
use rtfm::{app, Resource};
|
||||
|
||||
app! {
|
||||
device: stm32f103xx,
|
||||
|
|
@ -17,32 +18,37 @@ app! {
|
|||
},
|
||||
|
||||
tasks: {
|
||||
EXTI0: {
|
||||
path: exti0,
|
||||
priority: 1,
|
||||
exti0: {
|
||||
interrupt: EXTI0,
|
||||
// priority: 1,
|
||||
resources: [A, B],
|
||||
},
|
||||
|
||||
EXTI1: {
|
||||
path: exti1,
|
||||
exti1: {
|
||||
interrupt: EXTI1,
|
||||
priority: 2,
|
||||
resources: [A, B],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
fn init(_p: init::Peripherals, _r: init::Resources) {}
|
||||
fn init(_ctxt: init::Context) -> init::LateResources {
|
||||
init::LateResources {}
|
||||
}
|
||||
|
||||
fn idle() -> ! {
|
||||
fn idle(_ctxt: idle::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn exti0(mut ot: &mut Threshold, r: EXTI0::Resources) {
|
||||
r.A.claim(&mut ot, |_a, mut _it| {
|
||||
//~^ error cannot borrow `ot` as mutable more than once at a time
|
||||
fn exti0(mut ctxt: exti0::Context) {
|
||||
let ot = &mut ctxt.threshold;
|
||||
let exti0::Resources { A, B } = ctxt.resources;
|
||||
|
||||
A.claim(ot, |_a, _it| {
|
||||
//~^ error closure requires unique access to `ot` but `*ot` is already borrowed
|
||||
// ERROR must use inner token `it` instead of the outer one (`ot`)
|
||||
r.B.claim(&mut ot, |_b, _| {})
|
||||
B.claim(ot, |_b, _| {})
|
||||
});
|
||||
}
|
||||
|
||||
fn exti1(_t: &mut Threshold, _r: EXTI1::Resources) {}
|
||||
fn exti1(_ctxt: exti1::Context) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue