mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-17 21:35:20 +01:00
Fixing tests
This commit is contained in:
parent
633012190b
commit
98d2af9d73
75 changed files with 591 additions and 1183 deletions
|
|
@ -25,27 +25,32 @@ mod app {
|
|||
use super::BigStruct;
|
||||
use core::mem::MaybeUninit;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[shared]
|
||||
struct Shared {
|
||||
big_struct: &'static mut BigStruct,
|
||||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
let big_struct = unsafe {
|
||||
static mut BIG_STRUCT: MaybeUninit<BigStruct> = MaybeUninit::uninit();
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init(local = [bs: MaybeUninit<BigStruct> = MaybeUninit::uninit()])]
|
||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
let big_struct = unsafe {
|
||||
// write directly into the static storage
|
||||
BIG_STRUCT.as_mut_ptr().write(BigStruct::new());
|
||||
&mut *BIG_STRUCT.as_mut_ptr()
|
||||
cx.local.bs.as_mut_ptr().write(BigStruct::new());
|
||||
&mut *cx.local.bs.as_mut_ptr()
|
||||
};
|
||||
|
||||
(
|
||||
init::LateResources {
|
||||
Shared {
|
||||
// assign the reference so we can use the resource
|
||||
big_struct,
|
||||
},
|
||||
Local {},
|
||||
init::Monotonics(),
|
||||
)
|
||||
}
|
||||
|
||||
#[task(binds = UART0, shared = [big_struct])]
|
||||
fn task(_: task::Context) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,19 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
hprintln!("init").unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
@ -35,16 +41,14 @@ mod app {
|
|||
}
|
||||
}
|
||||
|
||||
#[task(binds = UART0)]
|
||||
fn foo(_: foo::Context) {
|
||||
static mut TIMES: u32 = 0;
|
||||
|
||||
*TIMES += 1;
|
||||
#[task(binds = UART0, local = [times: u32 = 0])]
|
||||
fn foo(cx: foo::Context) {
|
||||
*cx.local.times += 1;
|
||||
|
||||
hprintln!(
|
||||
"foo called {} time{}",
|
||||
*TIMES,
|
||||
if *TIMES > 1 { "s" } else { "" }
|
||||
*cx.local.times,
|
||||
if *cx.local.times > 1 { "s" } else { "" }
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,11 +12,17 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = UART0)]
|
||||
|
|
|
|||
|
|
@ -13,22 +13,32 @@ mod app {
|
|||
#[cfg(debug_assertions)]
|
||||
use cortex_m_semihosting::hprintln;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[shared]
|
||||
struct Shared {
|
||||
#[cfg(debug_assertions)] // <- `true` when using the `dev` profile
|
||||
#[init(0)]
|
||||
count: u32,
|
||||
#[cfg(never)]
|
||||
#[init(0)]
|
||||
unused: u32,
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
foo::spawn().unwrap();
|
||||
foo::spawn().unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(
|
||||
Shared {
|
||||
#[cfg(debug_assertions)]
|
||||
count: 0,
|
||||
#[cfg(never)]
|
||||
unused: 1,
|
||||
},
|
||||
Local {},
|
||||
init::Monotonics(),
|
||||
)
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
@ -40,17 +50,17 @@ mod app {
|
|||
}
|
||||
}
|
||||
|
||||
#[task(capacity = 2, resources = [count])]
|
||||
#[task(capacity = 2, shared = [count])]
|
||||
fn foo(mut _cx: foo::Context) {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
_cx.resources.count.lock(|count| *count += 1);
|
||||
_cx.shared.count.lock(|count| *count += 1);
|
||||
|
||||
log::spawn(_cx.resources.count.lock(|count| *count)).unwrap();
|
||||
log::spawn(_cx.shared.count.lock(|count| *count)).unwrap();
|
||||
}
|
||||
|
||||
// this wouldn't compile in `release` mode
|
||||
// *_cx.resources.count += 1;
|
||||
// *_cx.shared.count += 1;
|
||||
|
||||
// ..
|
||||
}
|
||||
|
|
@ -58,17 +68,17 @@ mod app {
|
|||
// The whole task should disappear,
|
||||
// currently still present in the Tasks enum
|
||||
#[cfg(never)]
|
||||
#[task(capacity = 2, resources = [count])]
|
||||
#[task(capacity = 2, shared = [count])]
|
||||
fn foo2(mut _cx: foo2::Context) {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
_cx.resources.count.lock(|count| *count += 10);
|
||||
_cx.shared.count.lock(|count| *count += 10);
|
||||
|
||||
log::spawn(_cx.resources.count.lock(|count| *count)).unwrap();
|
||||
log::spawn(_cx.shared.count.lock(|count| *count)).unwrap();
|
||||
}
|
||||
|
||||
// this wouldn't compile in `release` mode
|
||||
// *_cx.resources.count += 1;
|
||||
// *_cx.shared.count += 1;
|
||||
|
||||
// ..
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
//! examples/cfg.rs
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0])]
|
||||
mod app {
|
||||
use cortex_m_semihosting::debug;
|
||||
#[cfg(debug_assertions)]
|
||||
use cortex_m_semihosting::hprintln;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[cfg(debug_assertions)] // <- `true` when using the `dev` profile
|
||||
#[init(0)]
|
||||
count: u32,
|
||||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
foo::spawn().unwrap();
|
||||
foo::spawn().unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
fn idle(_: idle::Context) -> ! {
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
}
|
||||
}
|
||||
|
||||
#[task(capacity = 2, resources = [count])]
|
||||
fn foo(mut _cx: foo::Context) {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
_cx.resources.count.lock(|count| *count += 1);
|
||||
|
||||
log::spawn(_cx.resources.count.lock(|count| *count)).unwrap();
|
||||
}
|
||||
|
||||
// this wouldn't compile in `release` mode
|
||||
// *_cx.resources.count += 1;
|
||||
|
||||
// ..
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
#[task(capacity = 2)]
|
||||
fn log(_: log::Context, n: u32) {
|
||||
hprintln!(
|
||||
"foo has been called {} time{}",
|
||||
n,
|
||||
if n == 1 { "" } else { "s" }
|
||||
)
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
|
|
@ -12,39 +12,39 @@ mod app {
|
|||
use cortex_m_semihosting::hprintln;
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[shared]
|
||||
struct Shared {
|
||||
// Some resources to work with
|
||||
#[init(0)]
|
||||
a: u32,
|
||||
#[init(0)]
|
||||
b: u32,
|
||||
#[init(0)]
|
||||
c: u32,
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared { a: 0, b: 0, c: 0 }, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// Direct destructure
|
||||
#[task(binds = UART0, resources = [&a, &b, &c])]
|
||||
#[task(binds = UART0, shared = [&a, &b, &c])]
|
||||
fn uart0(cx: uart0::Context) {
|
||||
let a = cx.resources.a;
|
||||
let b = cx.resources.b;
|
||||
let c = cx.resources.c;
|
||||
let a = cx.shared.a;
|
||||
let b = cx.shared.b;
|
||||
let c = cx.shared.c;
|
||||
|
||||
hprintln!("UART0: a = {}, b = {}, c = {}", a, b, c).unwrap();
|
||||
}
|
||||
|
||||
// De-structure-ing syntax
|
||||
#[task(binds = UART1, resources = [&a, &b, &c])]
|
||||
#[task(binds = UART1, shared = [&a, &b, &c])]
|
||||
fn uart1(cx: uart1::Context) {
|
||||
let uart1::Resources { a, b, c } = cx.resources;
|
||||
let uart1::SharedResources { a, b, c } = cx.shared;
|
||||
|
||||
hprintln!("UART0: a = {}, b = {}, c = {}", a, b, c).unwrap();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,14 @@ mod app {
|
|||
#[monotonic(binds = SysTick, default = true)]
|
||||
type MyMono = DwtSystick<8_000_000>; // 8 MHz
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
task1::spawn().ok();
|
||||
|
||||
let mut dcb = cx.core.DCB;
|
||||
|
|
@ -25,7 +31,7 @@ mod app {
|
|||
|
||||
let mono = DwtSystick::new(&mut dcb, dwt, systick, 8_000_000);
|
||||
|
||||
(init::LateResources {}, init::Monotonics(mono))
|
||||
(Shared {}, Local {}, init::Monotonics(mono))
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
|||
|
|
@ -19,13 +19,19 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
hprintln!("init").unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
|||
|
|
@ -21,11 +21,17 @@ fn foo(_c: app::foo::Context, x: i32, y: u32) {
|
|||
mod app {
|
||||
use crate::foo;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_c: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
foo::spawn(1, 2).unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
extern "Rust" {
|
||||
|
|
|
|||
|
|
@ -14,42 +14,40 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[init(0)]
|
||||
#[shared]
|
||||
struct Shared {
|
||||
shared: u32,
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared { shared: 0 }, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = UART0, resources = [shared])]
|
||||
#[task(binds = UART0, shared = [shared], local = [state: u32 = 0])]
|
||||
fn uart0(c: uart0::Context) {
|
||||
static mut STATE: u32 = 0;
|
||||
hprintln!("UART0(STATE = {})", *c.local.state).unwrap();
|
||||
|
||||
hprintln!("UART0(STATE = {})", *STATE).unwrap();
|
||||
|
||||
// second argument has type `resources::shared`
|
||||
super::advance(STATE, c.resources.shared);
|
||||
// second argument has type `shared::shared`
|
||||
super::advance(c.local.state, c.shared.shared);
|
||||
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
#[task(binds = UART1, priority = 2, resources = [shared])]
|
||||
#[task(binds = UART1, priority = 2, shared = [shared], local = [state: u32 = 0])]
|
||||
fn uart1(c: uart1::Context) {
|
||||
static mut STATE: u32 = 0;
|
||||
hprintln!("UART1(STATE = {})", *c.local.state).unwrap();
|
||||
|
||||
hprintln!("UART1(STATE = {})", *STATE).unwrap();
|
||||
|
||||
// second argument has type `resources::shared`
|
||||
super::advance(STATE, c.resources.shared);
|
||||
// second argument has type `shared::shared`
|
||||
super::advance(c.local.state, c.shared.shared);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,15 +12,21 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
// Pends the UART0 interrupt but its handler won't run until *after*
|
||||
// `init` returns because interrupts are disabled
|
||||
rtic::pend(Interrupt::UART0); // equivalent to NVIC::pend
|
||||
|
||||
hprintln!("init").unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
@ -38,17 +44,15 @@ mod app {
|
|||
}
|
||||
}
|
||||
|
||||
#[task(binds = UART0)]
|
||||
fn uart0(_: uart0::Context) {
|
||||
static mut TIMES: u32 = 0;
|
||||
|
||||
#[task(binds = UART0, local = [times: u32 = 0])]
|
||||
fn uart0(cx: uart0::Context) {
|
||||
// Safe access to local `static mut` variable
|
||||
*TIMES += 1;
|
||||
*cx.local.times += 1;
|
||||
|
||||
hprintln!(
|
||||
"UART0 called {} time{}",
|
||||
*TIMES,
|
||||
if *TIMES > 1 { "s" } else { "" }
|
||||
*cx.local.times,
|
||||
if *cx.local.times > 1 { "s" } else { "" }
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,19 +11,23 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
hprintln!("init").unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
fn idle(_: idle::Context) -> ! {
|
||||
static mut X: u32 = 0;
|
||||
|
||||
// Safe access to local `static mut` variable
|
||||
let _x: &'static mut u32 = X;
|
||||
#[idle(local = [x: u32 = 0])]
|
||||
fn idle(cx: idle::Context) -> ! {
|
||||
// Locals in idle have lifetime 'static
|
||||
let _x: &'static mut u32 = cx.local.x;
|
||||
|
||||
hprintln!("idle").unwrap();
|
||||
|
||||
|
|
|
|||
|
|
@ -11,18 +11,22 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
static mut X: u32 = 0;
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init(local = [x: u32 = 0])]
|
||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
// Cortex-M peripherals
|
||||
let _core: cortex_m::Peripherals = cx.core;
|
||||
|
||||
// Device specific peripherals
|
||||
let _device: lm3s6965::Peripherals = cx.device;
|
||||
|
||||
// Safe access to local `static mut` variable
|
||||
let _x: &'static mut u32 = X;
|
||||
// Locals in `init` have 'static lifetime
|
||||
let _x: &'static mut u32 = cx.local.x;
|
||||
|
||||
// Access to the critical section token,
|
||||
// to indicate that this is a critical seciton
|
||||
|
|
@ -32,6 +36,6 @@ mod app {
|
|||
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,26 +12,28 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[init(0)]
|
||||
#[shared]
|
||||
struct Shared {
|
||||
shared: u32,
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::GPIOA);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared { shared: 0 }, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// when omitted priority is assumed to be `1`
|
||||
#[task(binds = GPIOA, resources = [shared])]
|
||||
#[task(binds = GPIOA, shared = [shared])]
|
||||
fn gpioa(mut c: gpioa::Context) {
|
||||
hprintln!("A").unwrap();
|
||||
|
||||
// the lower priority task requires a critical section to access the data
|
||||
c.resources.shared.lock(|shared| {
|
||||
c.shared.shared.lock(|shared| {
|
||||
// data can only be modified within this critical section (closure)
|
||||
*shared += 1;
|
||||
|
||||
|
|
@ -51,10 +53,10 @@ mod app {
|
|||
debug::exit(debug::EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
#[task(binds = GPIOB, priority = 2, resources = [shared])]
|
||||
#[task(binds = GPIOB, priority = 2, shared = [shared])]
|
||||
fn gpiob(mut c: gpiob::Context) {
|
||||
// the higher priority task does still need a critical section
|
||||
let shared = c.resources.shared.lock(|shared| {
|
||||
let shared = c.shared.shared.lock(|shared| {
|
||||
*shared += 1;
|
||||
|
||||
*shared
|
||||
|
|
|
|||
|
|
@ -11,21 +11,25 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
foo::spawn(/* no message */).unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
fn foo(_: foo::Context) {
|
||||
static mut COUNT: u32 = 0;
|
||||
|
||||
#[task(local = [count: u32 = 0])]
|
||||
fn foo(cx: foo::Context) {
|
||||
hprintln!("foo").unwrap();
|
||||
|
||||
bar::spawn(*COUNT).unwrap();
|
||||
*COUNT += 1;
|
||||
bar::spawn(*cx.local.count).unwrap();
|
||||
*cx.local.count += 1;
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
|||
|
|
@ -14,29 +14,37 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[init(0)]
|
||||
#[shared]
|
||||
struct Shared {
|
||||
shared1: u32,
|
||||
#[init(0)]
|
||||
shared2: u32,
|
||||
#[init(0)]
|
||||
shared3: u32,
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::GPIOA);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(
|
||||
Shared {
|
||||
shared1: 0,
|
||||
shared2: 0,
|
||||
shared3: 0,
|
||||
},
|
||||
Local {},
|
||||
init::Monotonics(),
|
||||
)
|
||||
}
|
||||
|
||||
// when omitted priority is assumed to be `1`
|
||||
#[task(binds = GPIOA, resources = [shared1, shared2, shared3])]
|
||||
#[task(binds = GPIOA, shared = [shared1, shared2, shared3])]
|
||||
fn locks(c: locks::Context) {
|
||||
let mut s1 = c.resources.shared1;
|
||||
let mut s2 = c.resources.shared2;
|
||||
let mut s3 = c.resources.shared3;
|
||||
let mut s1 = c.shared.shared1;
|
||||
let mut s2 = c.shared.shared2;
|
||||
let mut s3 = c.shared.shared3;
|
||||
|
||||
hprintln!("Multiple single locks").unwrap();
|
||||
s1.lock(|s1| {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//! `examples/not-sync.rs`
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
// #![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
|
@ -12,32 +12,42 @@ pub struct NotSync {
|
|||
_0: PhantomData<*const ()>,
|
||||
}
|
||||
|
||||
unsafe impl Send for NotSync {}
|
||||
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
use super::NotSync;
|
||||
use core::marker::PhantomData;
|
||||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[init(NotSync { _0: PhantomData })]
|
||||
#[shared]
|
||||
struct Shared {
|
||||
shared: NotSync,
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(
|
||||
Shared {
|
||||
shared: NotSync { _0: PhantomData },
|
||||
},
|
||||
Local {},
|
||||
init::Monotonics(),
|
||||
)
|
||||
}
|
||||
|
||||
#[task(resources = [&shared])]
|
||||
#[task(shared = [&shared])]
|
||||
fn foo(c: foo::Context) {
|
||||
let _: &NotSync = c.resources.shared;
|
||||
let _: &NotSync = c.shared.shared;
|
||||
}
|
||||
|
||||
#[task(resources = [&shared])]
|
||||
#[task(shared = [&shared])]
|
||||
fn bar(c: bar::Context) {
|
||||
let _: &NotSync = c.resources.shared;
|
||||
let _: &NotSync = c.shared.shared;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,29 +12,32 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[shared]
|
||||
struct Shared {
|
||||
key: u32,
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
(init::LateResources { key: 0xdeadbeef }, init::Monotonics())
|
||||
(Shared { key: 0xdeadbeef }, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = UART0, resources = [&key])]
|
||||
#[task(binds = UART0, shared = [&key])]
|
||||
fn uart0(cx: uart0::Context) {
|
||||
let key: &u32 = cx.resources.key;
|
||||
let key: &u32 = cx.shared.key;
|
||||
hprintln!("UART0(key = {:#x})", key).unwrap();
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
#[task(binds = UART1, priority = 2, resources = [&key])]
|
||||
#[task(binds = UART1, priority = 2, shared = [&key])]
|
||||
fn uart1(cx: uart1::Context) {
|
||||
hprintln!("UART1(key = {:#x})", cx.resources.key).unwrap();
|
||||
hprintln!("UART1(key = {:#x})", cx.shared.key).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,14 @@ mod app {
|
|||
#[monotonic(binds = SysTick, default = true)]
|
||||
type MyMono = DwtSystick<8_000_000>; // 8 MHz
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
let mut dcb = cx.core.DCB;
|
||||
let dwt = cx.core.DWT;
|
||||
let systick = cx.core.SYST;
|
||||
|
|
@ -26,7 +32,7 @@ mod app {
|
|||
|
||||
foo::spawn_after(Seconds(1_u32)).unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics(mono))
|
||||
(Shared {}, Local {}, init::Monotonics(mono))
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
|||
|
|
@ -9,11 +9,17 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
assert!(cortex_m::Peripherals::take().is_none());
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,16 +24,20 @@ mod app {
|
|||
// Import the memory pool into scope
|
||||
use super::P;
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
static mut MEMORY: [u8; 512] = [0; 512];
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init(local = [memory: [u8; 512] = [0; 512]])]
|
||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
// Increase the capacity of the memory pool by ~4
|
||||
P::grow(MEMORY);
|
||||
P::grow(cx.local.memory);
|
||||
|
||||
rtic::pend(Interrupt::I2C0);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = I2C0, priority = 2)]
|
||||
|
|
|
|||
|
|
@ -11,11 +11,17 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::GPIOA);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = GPIOA, priority = 1)]
|
||||
|
|
|
|||
|
|
@ -18,11 +18,17 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
foo::spawn().unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
|
|
|
|||
|
|
@ -12,26 +12,28 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[shared]
|
||||
struct Shared {
|
||||
// A resource
|
||||
#[init(0)]
|
||||
shared: u32,
|
||||
}
|
||||
|
||||
// Should not collide with the struct above
|
||||
#[allow(dead_code)]
|
||||
struct Resources2 {
|
||||
struct Shared2 {
|
||||
// A resource
|
||||
shared: u32,
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared { shared: 0 }, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// `shared` cannot be accessed from this context
|
||||
|
|
@ -39,16 +41,16 @@ mod app {
|
|||
fn idle(_cx: idle::Context) -> ! {
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
// error: no `resources` field in `idle::Context`
|
||||
// _cx.resources.shared += 1;
|
||||
// error: no `shared` field in `idle::Context`
|
||||
// _cx.shared.shared += 1;
|
||||
|
||||
loop {}
|
||||
}
|
||||
|
||||
// `shared` can be accessed from this context
|
||||
#[task(binds = UART0, resources = [shared])]
|
||||
#[task(binds = UART0, shared = [shared])]
|
||||
fn uart0(mut cx: uart0::Context) {
|
||||
let shared = cx.resources.shared.lock(|shared| {
|
||||
let shared = cx.shared.shared.lock(|shared| {
|
||||
*shared += 1;
|
||||
*shared
|
||||
});
|
||||
|
|
@ -57,9 +59,9 @@ mod app {
|
|||
}
|
||||
|
||||
// `shared` can be accessed from this context
|
||||
#[task(binds = UART1, resources = [shared])]
|
||||
#[task(binds = UART1, shared = [shared])]
|
||||
fn uart1(mut cx: uart1::Context) {
|
||||
let shared = cx.resources.shared.lock(|shared| {
|
||||
let shared = cx.shared.shared.lock(|shared| {
|
||||
*shared += 1;
|
||||
*shared
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,19 +12,20 @@ mod app {
|
|||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
// A resource
|
||||
#[init(0)]
|
||||
#[shared]
|
||||
struct Shared {
|
||||
shared: u32,
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared { shared: 0 }, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// `shared` cannot be accessed from this context
|
||||
|
|
@ -32,8 +33,8 @@ mod app {
|
|||
fn idle(_cx: idle::Context) -> ! {
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
// error: no `resources` field in `idle::Context`
|
||||
// _cx.resources.shared += 1;
|
||||
// error: no `shared` field in `idle::Context`
|
||||
// _cx.shared.shared += 1;
|
||||
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
|
|
@ -42,9 +43,9 @@ mod app {
|
|||
|
||||
// `shared` can be accessed from this context
|
||||
// defaults to priority 1
|
||||
#[task(binds = UART0, resources = [shared])]
|
||||
#[task(binds = UART0, shared = [shared])]
|
||||
fn uart0(mut cx: uart0::Context) {
|
||||
let shared = cx.resources.shared.lock(|shared| {
|
||||
let shared = cx.shared.shared.lock(|shared| {
|
||||
*shared += 1;
|
||||
*shared
|
||||
});
|
||||
|
|
@ -54,9 +55,9 @@ mod app {
|
|||
|
||||
// `shared` can be accessed from this context
|
||||
// explicitly set to priority 2
|
||||
#[task(binds = UART1, resources = [shared], priority = 2)]
|
||||
#[task(binds = UART1, shared = [shared], priority = 2)]
|
||||
fn uart1(mut cx: uart1::Context) {
|
||||
let shared = cx.resources.shared.lock(|shared| {
|
||||
let shared = cx.shared.shared.lock(|shared| {
|
||||
*shared += 1;
|
||||
*shared
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,8 +19,14 @@ mod app {
|
|||
#[monotonic(binds = SysTick, default = true)]
|
||||
type MyMono = DwtSystick<MONO_HZ>;
|
||||
|
||||
#[init()]
|
||||
fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
let mut dcb = cx.core.DCB;
|
||||
let dwt = cx.core.DWT;
|
||||
let systick = cx.core.SYST;
|
||||
|
|
@ -35,7 +41,7 @@ mod app {
|
|||
// Schedule `bar` to run 2 seconds in the future
|
||||
bar::spawn_after(Seconds(2_u32)).ok();
|
||||
|
||||
(init::LateResources {}, init::Monotonics(mono))
|
||||
(Shared {}, Local {}, init::Monotonics(mono))
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
|||
|
|
@ -17,27 +17,27 @@ mod app {
|
|||
};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
// Late resources
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[shared]
|
||||
struct Shared {
|
||||
p: Producer<'static, u32, U4>,
|
||||
c: Consumer<'static, u32, U4>,
|
||||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
static mut Q: Queue<u32, U4> = Queue(i::Queue::new());
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
let (p, c) = Q.split();
|
||||
#[init(local = [q: Queue<u32, U4> = Queue(i::Queue::new())])]
|
||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
let (p, c) = cx.local.q.split();
|
||||
|
||||
// Initialization of late resources
|
||||
(init::LateResources { p, c }, init::Monotonics())
|
||||
// Initialization of shared resources
|
||||
(Shared { p, c }, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle(resources = [c])]
|
||||
#[idle(shared = [c])]
|
||||
fn idle(mut c: idle::Context) -> ! {
|
||||
loop {
|
||||
if let Some(byte) = c.resources.c.lock(|c| c.dequeue()) {
|
||||
if let Some(byte) = c.shared.c.lock(|c| c.dequeue()) {
|
||||
hprintln!("received message: {}", byte).unwrap();
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
|
@ -47,8 +47,8 @@ mod app {
|
|||
}
|
||||
}
|
||||
|
||||
#[task(binds = UART0, resources = [p])]
|
||||
#[task(binds = UART0, shared = [p])]
|
||||
fn uart0(mut c: uart0::Context) {
|
||||
c.resources.p.lock(|p| p.enqueue(42).unwrap());
|
||||
c.shared.p.lock(|p| p.enqueue(42).unwrap());
|
||||
}
|
||||
}
|
||||
|
|
@ -7,4 +7,15 @@ use panic_semihosting as _; // panic handler
|
|||
use rtic::app;
|
||||
|
||||
#[app(device = lm3s6965)]
|
||||
mod app {}
|
||||
mod app {
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
(Shared {}, Local {}, init::Monotonics {})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,17 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_c: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
foo::spawn(1, 2).unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics {})
|
||||
}
|
||||
|
||||
#[task()]
|
||||
|
|
|
|||
|
|
@ -11,11 +11,17 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_c: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
foo::spawn(1, 2).unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics {})
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
|||
|
|
@ -18,27 +18,26 @@ mod app {
|
|||
};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
// Late resources
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[shared]
|
||||
struct Shared {
|
||||
p: Producer<'static, u32, U4>,
|
||||
c: Consumer<'static, u32, U4>,
|
||||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
static mut Q: Queue<u32, U4> = Queue(i::Queue::new());
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
let (p, c) = Q.split();
|
||||
#[init(local = [q: Queue<u32, U4> = Queue(i::Queue::new())])]
|
||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
let (p, c) = cx.local.q.split();
|
||||
|
||||
// Initialization of late resources
|
||||
(init::LateResources { p, c }, init::Monotonics())
|
||||
(Shared { p, c }, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle(resources = [c])]
|
||||
#[idle(shared = [c])]
|
||||
fn idle(mut c: idle::Context) -> ! {
|
||||
loop {
|
||||
if let Some(byte) = c.resources.c.lock(|c| c.dequeue()) {
|
||||
if let Some(byte) = c.shared.c.lock(|c| c.dequeue()) {
|
||||
hprintln!("received message: {}", byte).unwrap();
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
|
@ -48,10 +47,9 @@ mod app {
|
|||
}
|
||||
}
|
||||
|
||||
#[task(binds = UART0, resources = [p])]
|
||||
#[task(binds = UART0, shared = [p], local = [kalle: u32 = 0])]
|
||||
fn uart0(mut c: uart0::Context) {
|
||||
static mut KALLE: u32 = 0;
|
||||
*KALLE += 1;
|
||||
c.resources.p.lock(|p| p.enqueue(42).unwrap());
|
||||
*c.local.kalle += 1;
|
||||
c.shared.p.lock(|p| p.enqueue(42).unwrap());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,15 @@ use panic_semihosting as _;
|
|||
|
||||
#[rtic::app(device = lm3s6965)]
|
||||
mod app {
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
// Cortex-M exception
|
||||
|
|
|
|||
|
|
@ -7,25 +7,24 @@ use panic_semihosting as _;
|
|||
|
||||
#[rtic::app(device = lm3s6965)]
|
||||
mod app {
|
||||
#[resources]
|
||||
struct Resources {
|
||||
// A resource
|
||||
#[init(0)]
|
||||
shared: u32,
|
||||
#[shared]
|
||||
struct Shared {
|
||||
// A conditionally compiled resource behind feature_x
|
||||
#[cfg(feature = "feature_x")]
|
||||
x: u32,
|
||||
dummy: (), // dummy such that we have at least one late resource
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
(
|
||||
init::LateResources {
|
||||
// The feature needs to be applied everywhere x is defined or used
|
||||
Shared {
|
||||
#[cfg(feature = "feature_x")]
|
||||
x: 0,
|
||||
dummy: (), // dummy such that we have at least one late resource
|
||||
},
|
||||
Local {},
|
||||
init::Monotonics(),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
//! [compile-pass] check that `#[cfg]` attributes are respected
|
||||
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0, QEI0])]
|
||||
mod app {
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[cfg(never)]
|
||||
#[init(0)]
|
||||
foo: u32,
|
||||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
#[cfg(never)]
|
||||
static mut BAR: u32 = 0;
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
fn idle(_: idle::Context) -> ! {
|
||||
#[cfg(never)]
|
||||
static mut BAR: u32 = 0;
|
||||
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
}
|
||||
}
|
||||
|
||||
#[task(resources = [foo])]
|
||||
fn foo(_: foo::Context) {
|
||||
#[cfg(never)]
|
||||
static mut BAR: u32 = 0;
|
||||
}
|
||||
|
||||
#[task(priority = 3, resources = [foo])]
|
||||
fn bar(_: bar::Context) {
|
||||
#[cfg(never)]
|
||||
static mut BAR: u32 = 0;
|
||||
}
|
||||
|
||||
#[cfg(never)]
|
||||
#[task]
|
||||
fn quux(_: quux::Context) {}
|
||||
}
|
||||
|
|
@ -9,11 +9,17 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(lm3s6965::Interrupt::UART0);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task(binds = UART0)]
|
||||
|
|
|
|||
|
|
@ -9,9 +9,15 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
|||
|
|
@ -9,10 +9,16 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//! [compile-pass] late resources don't need to be `Send` if they are owned by `idle`
|
||||
//! [compile-pass] shared resources don't need to be `Send` if they are owned by `idle`
|
||||
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
|
@ -16,24 +16,28 @@ mod app {
|
|||
use super::NotSend;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[shared]
|
||||
struct Shared {
|
||||
x: NotSend,
|
||||
#[init(None)]
|
||||
y: Option<NotSend>,
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
(
|
||||
init::LateResources {
|
||||
Shared {
|
||||
x: NotSend { _0: PhantomData },
|
||||
y: None,
|
||||
},
|
||||
Local {},
|
||||
init::Monotonics(),
|
||||
)
|
||||
}
|
||||
|
||||
#[idle(resources = [x, y])]
|
||||
#[idle(shared = [x, y])]
|
||||
fn idle(_: idle::Context) -> ! {
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//! [compile-pass] Check code generation of resources
|
||||
//! [compile-pass] Check code generation of shared resources
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
|
|
@ -9,73 +9,77 @@ use panic_semihosting as _;
|
|||
|
||||
#[rtic::app(device = lm3s6965)]
|
||||
mod app {
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[init(0)]
|
||||
o1: u32, // init
|
||||
#[init(0)]
|
||||
#[shared]
|
||||
struct Shared {
|
||||
o2: u32, // idle
|
||||
#[init(0)]
|
||||
o3: u32, // EXTI0
|
||||
#[init(0)]
|
||||
o4: u32, // idle
|
||||
#[init(0)]
|
||||
o5: u32, // EXTI1
|
||||
#[init(0)]
|
||||
o6: u32, // init
|
||||
#[init(0)]
|
||||
s1: u32, // idle & uart0
|
||||
#[init(0)]
|
||||
s2: u32, // uart0 & uart1
|
||||
#[init(0)]
|
||||
s3: u32, // idle & uart0
|
||||
}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
(
|
||||
Shared {
|
||||
o2: 0,
|
||||
o3: 0,
|
||||
o4: 0,
|
||||
o5: 0,
|
||||
s1: 0,
|
||||
s2: 0,
|
||||
s3: 0,
|
||||
},
|
||||
Local {},
|
||||
init::Monotonics(),
|
||||
)
|
||||
}
|
||||
|
||||
#[idle(resources = [o2, &o4, s1, &s3])]
|
||||
#[idle(shared = [o2, &o4, s1, &s3])]
|
||||
fn idle(mut c: idle::Context) -> ! {
|
||||
// owned by `idle` == `&'static mut`
|
||||
let _: resources::o2 = c.resources.o2;
|
||||
let _: shared_resources::o2 = c.shared.o2;
|
||||
|
||||
// owned by `idle` == `&'static` if read-only
|
||||
let _: &u32 = c.resources.o4;
|
||||
let _: &u32 = c.shared.o4;
|
||||
|
||||
// shared with `idle` == `Mutex`
|
||||
c.resources.s1.lock(|_| {});
|
||||
c.shared.s1.lock(|_| {});
|
||||
|
||||
// `&` if read-only
|
||||
let _: &u32 = c.resources.s3;
|
||||
let _: &u32 = c.shared.s3;
|
||||
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
}
|
||||
}
|
||||
|
||||
#[task(binds = UART0, resources = [o3, s1, s2, &s3])]
|
||||
#[task(binds = UART0, shared = [o3, s1, s2, &s3])]
|
||||
fn uart0(c: uart0::Context) {
|
||||
// owned by interrupt == `&mut`
|
||||
let _: resources::o3 = c.resources.o3;
|
||||
let _: shared_resources::o3 = c.shared.o3;
|
||||
|
||||
// no `Mutex` proxy when access from highest priority task
|
||||
let _: resources::s1 = c.resources.s1;
|
||||
let _: shared_resources::s1 = c.shared.s1;
|
||||
|
||||
// no `Mutex` proxy when co-owned by cooperative (same priority) tasks
|
||||
let _: resources::s2 = c.resources.s2;
|
||||
let _: shared_resources::s2 = c.shared.s2;
|
||||
|
||||
// `&` if read-only
|
||||
let _: &u32 = c.resources.s3;
|
||||
let _: &u32 = c.shared.s3;
|
||||
}
|
||||
|
||||
#[task(binds = UART1, resources = [s2, &o5])]
|
||||
#[task(binds = UART1, shared = [s2, &o5])]
|
||||
fn uart1(c: uart1::Context) {
|
||||
// owned by interrupt == `&` if read-only
|
||||
let _: &u32 = c.resources.o5;
|
||||
let _: &u32 = c.shared.o5;
|
||||
|
||||
// no `Mutex` proxy when co-owned by cooperative (same priority) tasks
|
||||
let _: resources::s2 = c.resources.s2;
|
||||
let _: shared_resources::s2 = c.shared.s2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
//! [compile-pass] Check `schedule` code generation
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
#[init]
|
||||
fn init(c: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
let _c: cortex_m::Peripherals = c.core;
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
fn some_task(_: some_task::Context) {}
|
||||
}
|
||||
|
|
@ -15,8 +15,14 @@ mod app {
|
|||
#[monotonic(binds = SysTick, default = true)]
|
||||
type MyMono = DwtSystick<8_000_000>; // 8 MHz
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
let mut dcb = cx.core.DCB;
|
||||
let dwt = cx.core.DWT;
|
||||
let systick = cx.core.SYST;
|
||||
|
|
@ -114,7 +120,7 @@ mod app {
|
|||
let handle: Result<baz::SpawnHandle, (u32, u32)> = baz::spawn_after(Seconds(1_u32), 0, 1);
|
||||
let _: Result<(u32, u32), ()> = handle.unwrap().cancel();
|
||||
|
||||
(init::LateResources {}, init::Monotonics(mono))
|
||||
(Shared {}, Local {}, init::Monotonics(mono))
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
|||
|
|
@ -9,13 +9,19 @@ use panic_semihosting as _;
|
|||
|
||||
#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
let _: Result<(), ()> = foo::spawn();
|
||||
let _: Result<(), u32> = bar::spawn(0);
|
||||
let _: Result<(), (u32, u32)> = baz::spawn(0, 1);
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
|
|
|
|||
|
|
@ -9,11 +9,17 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::debug;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
taskmain::spawn().ok();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
//! examples/task-local_minimal.rs
|
||||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965)]
|
||||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
// A local (move), late resource
|
||||
#[task_local]
|
||||
l: u32,
|
||||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
(init::LateResources { l: 42 }, init::Monotonics())
|
||||
}
|
||||
|
||||
// l is task_local
|
||||
#[idle(resources =[l])]
|
||||
fn idle(cx: idle::Context) -> ! {
|
||||
hprintln!("IDLE:l = {}", cx.resources.l).unwrap();
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
//! examples/task-local.rs
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965)]
|
||||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
use lm3s6965::Interrupt;
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
// An early resource
|
||||
#[init(0)]
|
||||
shared: u32,
|
||||
|
||||
// A local (move), early resource
|
||||
#[task_local]
|
||||
#[init(1)]
|
||||
l1: u32,
|
||||
|
||||
// An exclusive, early resource
|
||||
#[lock_free]
|
||||
#[init(1)]
|
||||
e1: u32,
|
||||
|
||||
// A local (move), late resource
|
||||
#[task_local]
|
||||
l2: u32,
|
||||
|
||||
// An exclusive, late resource
|
||||
#[lock_free]
|
||||
e2: u32,
|
||||
}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
rtic::pend(Interrupt::UART1);
|
||||
(init::LateResources { e2: 2, l2: 2 }, init::Monotonics())
|
||||
}
|
||||
|
||||
// `shared` cannot be accessed from this context
|
||||
// l1 ok (task_local)
|
||||
// e2 ok (lock_free)
|
||||
#[idle(resources =[l1, e2])]
|
||||
fn idle(cx: idle::Context) -> ! {
|
||||
hprintln!("IDLE:l1 = {}", cx.resources.l1).unwrap();
|
||||
hprintln!("IDLE:e2 = {}", cx.resources.e2).unwrap();
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
}
|
||||
}
|
||||
|
||||
// `shared` can be accessed from this context
|
||||
// l2 ok (task_local)
|
||||
// e1 ok (lock_free)
|
||||
#[task(priority = 1, binds = UART0, resources = [shared, l2, e1])]
|
||||
fn uart0(mut cx: uart0::Context) {
|
||||
let shared = cx.resources.shared.lock(|shared| {
|
||||
*shared += 1;
|
||||
*shared
|
||||
});
|
||||
*cx.resources.e1 += 10;
|
||||
hprintln!("UART0: shared = {}", shared).unwrap();
|
||||
hprintln!("UART0:l2 = {}", cx.resources.l2).unwrap();
|
||||
hprintln!("UART0:e1 = {}", cx.resources.e1).unwrap();
|
||||
}
|
||||
|
||||
// `shared` can be accessed from this context
|
||||
// e1 ok (lock_free)
|
||||
#[task(priority = 1, binds = UART1, resources = [shared, e1])]
|
||||
fn uart1(mut cx: uart1::Context) {
|
||||
let shared = cx.resources.shared.lock(|shared| {
|
||||
*shared += 1;
|
||||
*shared
|
||||
});
|
||||
|
||||
hprintln!("UART1: shared = {}", shared).unwrap();
|
||||
hprintln!("UART1:e1 = {}", cx.resources.e1).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
@ -11,11 +11,17 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
foo::spawn().unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
|||
|
|
@ -11,11 +11,17 @@ use panic_semihosting as _;
|
|||
mod app {
|
||||
use cortex_m_semihosting::{debug, hprintln};
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
main::spawn().unwrap();
|
||||
|
||||
(init::LateResources {}, init::Monotonics())
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[task]
|
||||
|
|
|
|||
|
|
@ -10,6 +10,17 @@ use rtic::app;
|
|||
mod app {
|
||||
type Test = u32;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
|
||||
#[local]
|
||||
struct Local {}
|
||||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
(Shared {}, Local {}, init::Monotonics {})
|
||||
}
|
||||
|
||||
#[task]
|
||||
fn t1(_: t1::Context, _val: Test) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,57 +0,0 @@
|
|||
//! examples/types.rs
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
#![deny(warnings)]
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[rtic::app(device = lm3s6965, peripherals = true, dispatchers = [SSI0])]
|
||||
mod app {
|
||||
use cortex_m_semihosting::debug;
|
||||
use dwt_systick_monotonic::DwtSystick;
|
||||
|
||||
#[monotonic(binds = SysTick, default = true)]
|
||||
type MyMono = DwtSystick<8_000_000>; // 8 MHz
|
||||
|
||||
#[resources]
|
||||
struct Resources {
|
||||
#[init(0)]
|
||||
shared: u32,
|
||||
}
|
||||
|
||||
#[init]
|
||||
fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) {
|
||||
let _: cortex_m::Peripherals = cx.core;
|
||||
let _: lm3s6965::Peripherals = cx.device;
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS);
|
||||
|
||||
let mut dcb = cx.core.DCB;
|
||||
let dwt = cx.core.DWT;
|
||||
let systick = cx.core.SYST;
|
||||
|
||||
let mono = DwtSystick::new(&mut dcb, dwt, systick, 8_000_000);
|
||||
|
||||
(init::LateResources {}, init::Monotonics(mono))
|
||||
}
|
||||
|
||||
#[idle]
|
||||
fn idle(_: idle::Context) -> ! {
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
}
|
||||
}
|
||||
|
||||
#[task(binds = UART0, resources = [shared])]
|
||||
fn uart0(cx: uart0::Context) {
|
||||
let _: resources::shared = cx.resources.shared;
|
||||
}
|
||||
|
||||
#[task(priority = 2, resources = [shared])]
|
||||
fn foo(cx: foo::Context) {
|
||||
let _: resources::shared = cx.resources.shared;
|
||||
let _: foo::Resources = cx.resources;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue