mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-18 13:55:23 +01:00
implement RFC #212
This commit is contained in:
parent
14d63f4961
commit
9195038c87
25 changed files with 369 additions and 311 deletions
|
|
@ -9,30 +9,30 @@ use panic_halt as _;
|
|||
|
||||
#[rtfm::app(cores = 2, device = heterogeneous)]
|
||||
const APP: () = {
|
||||
extern "C" {
|
||||
struct Resources {
|
||||
// owned by core #1 but initialized by core #0
|
||||
static mut X: u32;
|
||||
x: u32,
|
||||
|
||||
// owned by core #0 but initialized by core #1
|
||||
static mut Y: u32;
|
||||
y: u32,
|
||||
}
|
||||
|
||||
#[init(core = 0, late = [X])]
|
||||
#[init(core = 0, late = [x])]
|
||||
fn a(_: a::Context) -> a::LateResources {
|
||||
a::LateResources { X: 0 }
|
||||
a::LateResources { x: 0 }
|
||||
}
|
||||
|
||||
#[idle(core = 0, resources = [Y])]
|
||||
#[idle(core = 0, resources = [y])]
|
||||
fn b(_: b::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[init(core = 1)]
|
||||
fn c(_: c::Context) -> c::LateResources {
|
||||
c::LateResources { Y: 0 }
|
||||
c::LateResources { y: 0 }
|
||||
}
|
||||
|
||||
#[idle(core = 1, resources = [X])]
|
||||
#[idle(core = 1, resources = [x])]
|
||||
fn d(_: d::Context) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,18 +9,18 @@ use panic_halt as _;
|
|||
|
||||
#[rtfm::app(cores = 2, device = heterogeneous)]
|
||||
const APP: () = {
|
||||
extern "C" {
|
||||
static mut X: u32;
|
||||
static mut Y: u32;
|
||||
struct Resources {
|
||||
x: u32,
|
||||
y: u32,
|
||||
}
|
||||
|
||||
#[init(core = 0, late = [X])]
|
||||
#[init(core = 0, late = [x])]
|
||||
fn a(_: a::Context) -> a::LateResources {
|
||||
a::LateResources { X: 0 }
|
||||
a::LateResources { x: 0 }
|
||||
}
|
||||
|
||||
#[init(core = 1)]
|
||||
fn b(_: b::Context) -> b::LateResources {
|
||||
b::LateResources { Y: 0 }
|
||||
b::LateResources { y: 0 }
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue