mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-12-24 19:09:33 +01:00
Merge #680
680: Update cortex-m-semihosting requirement from 0.3.3 to 0.5.0 r=AfoHT a=dependabot[bot] Updates the requirements on [cortex-m-semihosting](https://github.com/rust-embedded/cortex-m) to permit the latest version. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/rust-embedded/cortex-m/blob/master/CHANGELOG.md">cortex-m-semihosting's changelog</a>.</em></p> <blockquote> <h2>[v0.5.0] - 2018-05-11</h2> <h3>Added</h3> <ul> <li> <p><code>DebugMonitor</code> and <code>SecureFault</code> variants to the <code>Exception</code> enumeration.</p> </li> <li> <p>An optional <code>"inline-asm"</code> feature</p> </li> </ul> <h3>Changed</h3> <ul> <li> <p>[breaking-change] This crate now requires <code>arm-none-eabi-gcc</code> to be installed and available in <code>$PATH</code> when built with the <code>"inline-asm"</code> feature disabled (which is disabled by default).</p> </li> <li> <p>[breaking-change] The <code>register::{apsr,lr,pc}</code> modules are now behind the <code>"inline-asm"</code> feature.</p> </li> <li> <p>[breaking-change] Some variants of the <code>Exception</code> enumeration are no longer available on <code>thumbv6m-none-eabi</code>. See API docs for details.</p> </li> <li> <p>[breaking-change] Several of the variants of the <code>Exception</code> enumeration have been renamed to match the CMSIS specification.</p> </li> <li> <p>[breaking-change] fixed typo in <code>shcrs</code> field of <code>scb::RegisterBlock</code>; it was previously named <code>shpcrs</code>.</p> </li> <li> <p>[breaking-change] removed several fields from <code>scb::RegisterBlock</code> on ARMv6-M. These registers are not available on that sub-architecture.</p> </li> <li> <p>[breaking-change] changed the type of <code>scb::RegisterBlock.shpr</code> from <code>RW<u8></code> to <code>RW<u32></code> on ARMv6-M. These registers are word accessible only on that sub-architecture.</p> </li> <li> <p>[breaking-change] renamed the <code>mmar</code> field of <code>scb::RegisterBlock</code> to <code>mmfar</code> to match the CMSIS name.</p> </li> <li> <p>[breaking-change] removed the <code>iabr</code> field from <code>scb::RegisterBlock</code> on ARMv6-M. This register is not available on that sub-architecture.</p> </li> <li> <p>[breaking-change] removed several fields from <code>cpuid::RegisterBlock</code> on ARMv6-M. These registers are not available on that sub-architecture.</p> </li> <li> <p>[breaking-change] The <code>Mutex.new</code> constructor is not a <code>const fn</code> by default. To make it a <code>const fn</code> you have to opt into the <code>"const-fn"</code> feature, which was added in v0.5.1, and switch to a nightly compiler.</p> </li> </ul> <h3>Removed</h3> <ul> <li>[breaking-change] The <code>exception</code> module has been removed. A replacement for <code>Exception::active</code> can be found in <code>SCB::vect_active</code>. A modified version <code>exception::Exception</code> can be found in the <code>peripheral::scb</code> module.</li> </ul> <h2>[v0.4.3] - 2018-01-25</h2> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="a448e9156e
"><code>a448e91</code></a> v0.5.0</li> <li><a href="e3217ad94d
"><code>e3217ad</code></a> Merge <a href="https://github-redirect.dependabot.com/rust-embedded/cortex-m/issues/88">#88</a></li> <li><a href="05bbc3b815
"><code>05bbc3b</code></a> always list all the peripherals in <code>Peripherals</code></li> <li><a href="550f94902f
"><code>550f949</code></a> fix build for ARMv7E-M + "inline-asm"</li> <li><a href="7d51707b5f
"><code>7d51707</code></a> simplify #[cfg]s</li> <li><a href="2cd6092848
"><code>2cd6092</code></a> ARMv6-M: remove fields that are not available from cpuid::RegisterBlock</li> <li><a href="17bd0c8e88
"><code>17bd0c8</code></a> fix x86_64 tests</li> <li><a href="c290aa4ee8
"><code>c290aa4</code></a> ARMv6-M: remove fields that are not available from NVIC and SCB</li> <li><a href="716398ce54
"><code>716398c</code></a> fix build on ARMv6-M</li> <li><a href="1d68643772
"><code>1d68643</code></a> fix build on ARMv7E-M</li> <li>Additional commits viewable in <a href="https://github.com/rust-embedded/cortex-m/compare/c-m-sh-v0.3.5...v0.5.0">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - ``@dependabot` rebase` will rebase this PR - ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it - ``@dependabot` merge` will merge this PR after your CI passes on it - ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it - ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging - ``@dependabot` reopen` will reopen this PR if it is closed - ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
This commit is contained in:
commit
86ce8919ae
35 changed files with 113 additions and 112 deletions
|
@ -19,6 +19,7 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
|
|||
|
||||
### Changed
|
||||
|
||||
- Updated dev-dependency cortex-m-semihosting to v0.5
|
||||
- CI: Updated to setup-python@v4
|
||||
- CI: Updated to checkout@v3
|
||||
- Tuned redirect message for rtic.rs/meeting
|
||||
|
|
|
@ -32,7 +32,7 @@ version_check = "0.9"
|
|||
|
||||
[dev-dependencies]
|
||||
lm3s6965 = "0.1.3"
|
||||
cortex-m-semihosting = "0.3.3"
|
||||
cortex-m-semihosting = "0.5.0"
|
||||
systick-monotonic = "1.0.0"
|
||||
|
||||
[dev-dependencies.panic-semihosting]
|
||||
|
|
|
@ -23,21 +23,22 @@ mod app {
|
|||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
hprintln!("init").unwrap();
|
||||
hprintln!("init");
|
||||
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
fn idle(_: idle::Context) -> ! {
|
||||
hprintln!("idle").unwrap();
|
||||
hprintln!("idle");
|
||||
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
|
||||
loop {
|
||||
// Exit moved after nop to ensure that rtic::pend gets
|
||||
// to run before exiting
|
||||
cortex_m::asm::nop();
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +50,6 @@ mod app {
|
|||
"foo called {} time{}",
|
||||
*cx.local.times,
|
||||
if *cx.local.times > 1 { "s" } else { "" }
|
||||
)
|
||||
.unwrap();
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ mod app {
|
|||
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
|
||||
let mono = Systick::new(systick, 12_000_000);
|
||||
|
||||
hprintln!("init").ok();
|
||||
hprintln!("init");
|
||||
|
||||
// Schedule `foo` to run 1 second in the future
|
||||
foo::spawn_after(1.secs()).unwrap();
|
||||
|
@ -42,7 +42,7 @@ mod app {
|
|||
|
||||
#[task]
|
||||
fn foo(_: foo::Context) {
|
||||
hprintln!("foo").ok();
|
||||
hprintln!("foo");
|
||||
|
||||
// Schedule `bar` to run 2 seconds in the future (1 second after foo runs)
|
||||
let spawn_handle = baz::spawn_after(2.secs()).unwrap();
|
||||
|
@ -51,7 +51,7 @@ mod app {
|
|||
|
||||
#[task]
|
||||
fn bar(_: bar::Context, baz_handle: baz::SpawnHandle, do_reschedule: bool) {
|
||||
hprintln!("bar").ok();
|
||||
hprintln!("bar");
|
||||
|
||||
if do_reschedule {
|
||||
// Reschedule baz 2 seconds from now, instead of the original 1 second
|
||||
|
@ -67,7 +67,7 @@ mod app {
|
|||
|
||||
#[task]
|
||||
fn baz(_: baz::Context) {
|
||||
hprintln!("baz").ok();
|
||||
hprintln!("baz");
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,12 +37,12 @@ mod app {
|
|||
|
||||
#[task(capacity = 4)]
|
||||
fn foo(_: foo::Context, x: u32) {
|
||||
hprintln!("foo({})", x).unwrap();
|
||||
hprintln!("foo({})", x);
|
||||
}
|
||||
|
||||
#[task]
|
||||
fn bar(_: bar::Context) {
|
||||
hprintln!("bar").unwrap();
|
||||
hprintln!("bar");
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
|
|
@ -88,7 +88,6 @@ mod app {
|
|||
"foo has been called {} time{}",
|
||||
n,
|
||||
if n == 1 { "" } else { "s" }
|
||||
)
|
||||
.ok();
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ mod app {
|
|||
// This task is only spawned once in `init`, hence this task will run
|
||||
// only once
|
||||
|
||||
hprintln!("foo").ok();
|
||||
hprintln!("foo");
|
||||
}
|
||||
|
||||
// Software task, also not bound to a hardware interrupt
|
||||
|
@ -81,7 +81,7 @@ mod app {
|
|||
// The resources `s1` and `s2` are shared between all other tasks.
|
||||
#[task(shared = [s1, s2], local = [l2])]
|
||||
fn bar(_: bar::Context) {
|
||||
hprintln!("bar").ok();
|
||||
hprintln!("bar");
|
||||
|
||||
// Run `bar` once per second
|
||||
bar::spawn_after(1.secs()).unwrap();
|
||||
|
@ -97,6 +97,6 @@ mod app {
|
|||
// Note that RTIC does NOT clear the interrupt flag, this is up to the
|
||||
// user
|
||||
|
||||
hprintln!("UART0 interrupt!").ok();
|
||||
hprintln!("UART0 interrupt!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ mod app {
|
|||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
hprintln!("init").unwrap();
|
||||
hprintln!("init");
|
||||
|
||||
(
|
||||
Shared {
|
||||
|
@ -40,31 +40,31 @@ mod app {
|
|||
|
||||
#[idle(shared = [s2, s3])]
|
||||
fn idle(mut cx: idle::Context) -> ! {
|
||||
hprintln!("idle p0 started").ok();
|
||||
hprintln!("idle p0 started");
|
||||
rtic::pend(Interrupt::GPIOC);
|
||||
cx.shared.s3.lock(|s| {
|
||||
hprintln!("idle enter lock s3 {}", s).ok();
|
||||
hprintln!("idle pend t0").ok();
|
||||
hprintln!("idle enter lock s3 {}", s);
|
||||
hprintln!("idle pend t0");
|
||||
rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 3
|
||||
hprintln!("idle pend t1").ok();
|
||||
hprintln!("idle pend t1");
|
||||
rtic::pend(Interrupt::GPIOB); // t1 p3, with shared ceiling 3
|
||||
hprintln!("idle pend t2").ok();
|
||||
hprintln!("idle pend t2");
|
||||
rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing
|
||||
hprintln!("idle still in lock s3 {}", s).ok();
|
||||
hprintln!("idle still in lock s3 {}", s);
|
||||
});
|
||||
hprintln!("\nback in idle").ok();
|
||||
hprintln!("\nback in idle");
|
||||
|
||||
cx.shared.s2.lock(|s| {
|
||||
hprintln!("enter lock s2 {}", s).ok();
|
||||
hprintln!("idle pend t0").ok();
|
||||
hprintln!("enter lock s2 {}", s);
|
||||
hprintln!("idle pend t0");
|
||||
rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2
|
||||
hprintln!("idle pend t1").ok();
|
||||
hprintln!("idle pend t1");
|
||||
rtic::pend(Interrupt::GPIOB); // t1 p3, no sharing
|
||||
hprintln!("idle pend t2").ok();
|
||||
hprintln!("idle pend t2");
|
||||
rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing
|
||||
hprintln!("idle still in lock s2 {}", s).ok();
|
||||
hprintln!("idle still in lock s2 {}", s);
|
||||
});
|
||||
hprintln!("\nidle exit").ok();
|
||||
hprintln!("\nidle exit");
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
|
||||
|
@ -82,9 +82,8 @@ mod app {
|
|||
"t0 p2 called {} time{}",
|
||||
*cx.local.times,
|
||||
if *cx.local.times > 1 { "s" } else { "" }
|
||||
)
|
||||
.ok();
|
||||
hprintln!("t0 p2 exit").ok();
|
||||
);
|
||||
hprintln!("t0 p2 exit");
|
||||
}
|
||||
|
||||
#[task(binds = GPIOB, priority = 3, local = [times: u32 = 0], shared = [s3, s4])]
|
||||
|
@ -96,19 +95,18 @@ mod app {
|
|||
"t1 p3 called {} time{}",
|
||||
*cx.local.times,
|
||||
if *cx.local.times > 1 { "s" } else { "" }
|
||||
)
|
||||
.ok();
|
||||
);
|
||||
|
||||
cx.shared.s4.lock(|s| {
|
||||
hprintln!("t1 enter lock s4 {}", s).ok();
|
||||
hprintln!("t1 pend t0").ok();
|
||||
hprintln!("t1 enter lock s4 {}", s);
|
||||
hprintln!("t1 pend t0");
|
||||
rtic::pend(Interrupt::GPIOA); // t0 p2, with shared ceiling 2
|
||||
hprintln!("t1 pend t2").ok();
|
||||
hprintln!("t1 pend t2");
|
||||
rtic::pend(Interrupt::GPIOC); // t2 p4, no sharing
|
||||
hprintln!("t1 still in lock s4 {}", s).ok();
|
||||
hprintln!("t1 still in lock s4 {}", s);
|
||||
});
|
||||
|
||||
hprintln!("t1 p3 exit").ok();
|
||||
hprintln!("t1 p3 exit");
|
||||
}
|
||||
|
||||
#[task(binds = GPIOC, priority = 4, local = [times: u32 = 0], shared = [s4])]
|
||||
|
@ -120,13 +118,12 @@ mod app {
|
|||
"t2 p4 called {} time{}",
|
||||
*cx.local.times,
|
||||
if *cx.local.times > 1 { "s" } else { "" }
|
||||
)
|
||||
.unwrap();
|
||||
);
|
||||
|
||||
cx.shared.s4.lock(|s| {
|
||||
hprintln!("enter lock s4 {}", s).ok();
|
||||
hprintln!("enter lock s4 {}", s);
|
||||
*s += 1;
|
||||
});
|
||||
hprintln!("t3 p4 exit").ok();
|
||||
hprintln!("t3 p4 exit");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ mod app {
|
|||
let b = cx.shared.b;
|
||||
let c = cx.shared.c;
|
||||
|
||||
hprintln!("foo: a = {}, b = {}, c = {}", a, b, c).unwrap();
|
||||
hprintln!("foo: a = {}, b = {}, c = {}", a, b, c);
|
||||
}
|
||||
|
||||
// De-structure-ing syntax
|
||||
|
@ -50,6 +50,6 @@ mod app {
|
|||
fn bar(cx: bar::Context) {
|
||||
let bar::SharedResources { a, b, c } = cx.shared;
|
||||
|
||||
hprintln!("bar: a = {}, b = {}, c = {}", a, b, c).unwrap();
|
||||
hprintln!("bar: a = {}, b = {}, c = {}", a, b, c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ use panic_semihosting as _;
|
|||
|
||||
// Free function implementing the interrupt bound task `foo`.
|
||||
fn foo(_: app::foo::Context) {
|
||||
hprintln!("foo called").ok();
|
||||
hprintln!("foo called");
|
||||
}
|
||||
|
||||
#[rtic::app(device = lm3s6965)]
|
||||
|
@ -29,21 +29,22 @@ mod app {
|
|||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
hprintln!("init").unwrap();
|
||||
hprintln!("init");
|
||||
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
||||
#[idle]
|
||||
fn idle(_: idle::Context) -> ! {
|
||||
hprintln!("idle").unwrap();
|
||||
hprintln!("idle");
|
||||
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
|
||||
loop {
|
||||
cortex_m::asm::nop();
|
||||
// Exit moved after nop to ensure that rtic::pend gets
|
||||
// to run before exiting
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use panic_semihosting as _;
|
|||
|
||||
// Free function implementing the spawnable task `foo`.
|
||||
fn foo(_c: app::foo::Context, x: i32, y: u32) {
|
||||
hprintln!("foo {}, {}", x, y).unwrap();
|
||||
hprintln!("foo {}, {}", x, y);
|
||||
if x == 2 {
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
|
|
@ -32,19 +32,22 @@ mod app {
|
|||
|
||||
#[task(binds = UART0, shared = [shared], local = [state: u32 = 0])]
|
||||
fn uart0(c: uart0::Context) {
|
||||
hprintln!("UART0(STATE = {})", *c.local.state).unwrap();
|
||||
hprintln!("UART0(STATE = {})", *c.local.state);
|
||||
|
||||
// second argument has type `shared::shared`
|
||||
super::advance(c.local.state, c.shared.shared);
|
||||
|
||||
rtic::pend(Interrupt::UART1);
|
||||
|
||||
// Exit moved after nop to ensure that rtic::pend gets
|
||||
// to run before exiting
|
||||
cortex_m::asm::nop();
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
||||
#[task(binds = UART1, priority = 2, shared = [shared], local = [state: u32 = 0])]
|
||||
fn uart1(c: uart1::Context) {
|
||||
hprintln!("UART1(STATE = {})", *c.local.state).unwrap();
|
||||
hprintln!("UART1(STATE = {})", *c.local.state);
|
||||
|
||||
// second argument has type `shared::shared`
|
||||
super::advance(c.local.state, c.shared.shared);
|
||||
|
@ -61,5 +64,5 @@ fn advance(state: &mut u32, mut shared: impl Mutex<T = u32>) {
|
|||
(old, *shared)
|
||||
});
|
||||
|
||||
hprintln!("shared: {} -> {}", old, new).unwrap();
|
||||
hprintln!("shared: {} -> {}", old, new);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ mod app {
|
|||
// `init` returns because interrupts are disabled
|
||||
rtic::pend(Interrupt::UART0); // equivalent to NVIC::pend
|
||||
|
||||
hprintln!("init").unwrap();
|
||||
hprintln!("init");
|
||||
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
@ -33,14 +33,15 @@ mod app {
|
|||
fn idle(_: idle::Context) -> ! {
|
||||
// interrupts are enabled again; the `UART0` handler runs at this point
|
||||
|
||||
hprintln!("idle").unwrap();
|
||||
hprintln!("idle");
|
||||
|
||||
rtic::pend(Interrupt::UART0);
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
|
||||
loop {
|
||||
// Exit moved after nop to ensure that rtic::pend gets
|
||||
// to run before exiting
|
||||
cortex_m::asm::nop();
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +54,6 @@ mod app {
|
|||
"UART0 called {} time{}",
|
||||
*cx.local.times,
|
||||
if *cx.local.times > 1 { "s" } else { "" }
|
||||
)
|
||||
.unwrap();
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ mod app {
|
|||
|
||||
#[init]
|
||||
fn init(mut cx: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
hprintln!("init").unwrap();
|
||||
hprintln!("init");
|
||||
|
||||
// Set the ARM SLEEPONEXIT bit to go to sleep after handling interrupts
|
||||
// See https://developer.arm.com/docs/100737/0100/power-management/sleep-mode/sleep-on-exit-bit
|
||||
|
@ -33,7 +33,7 @@ mod app {
|
|||
// Locals in idle have lifetime 'static
|
||||
let _x: &'static mut u32 = cx.local.x;
|
||||
|
||||
hprintln!("idle").unwrap();
|
||||
hprintln!("idle");
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ mod app {
|
|||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
hprintln!("init").unwrap();
|
||||
hprintln!("init");
|
||||
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ mod app {
|
|||
// Locals in idle have lifetime 'static
|
||||
let _x: &'static mut u32 = cx.local.x;
|
||||
|
||||
hprintln!("idle").unwrap();
|
||||
hprintln!("idle");
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ mod app {
|
|||
// to indicate that this is a critical seciton
|
||||
let _cs_token: bare_metal::CriticalSection = cx.cs;
|
||||
|
||||
hprintln!("init").unwrap();
|
||||
hprintln!("init");
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ mod app {
|
|||
let local_to_idle = cx.local.local_to_idle;
|
||||
*local_to_idle += 1;
|
||||
|
||||
hprintln!("idle: local_to_idle = {}", local_to_idle).unwrap();
|
||||
hprintln!("idle: local_to_idle = {}", local_to_idle);
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
|
||||
|
@ -69,7 +69,7 @@ mod app {
|
|||
// error: no `local_to_bar` field in `foo::LocalResources`
|
||||
// cx.local.local_to_bar += 1;
|
||||
|
||||
hprintln!("foo: local_to_foo = {}", local_to_foo).unwrap();
|
||||
hprintln!("foo: local_to_foo = {}", local_to_foo);
|
||||
}
|
||||
|
||||
// `local_to_bar` can only be accessed from this context
|
||||
|
@ -81,6 +81,6 @@ mod app {
|
|||
// error: no `local_to_foo` field in `bar::LocalResources`
|
||||
// cx.local.local_to_foo += 1;
|
||||
|
||||
hprintln!("bar: local_to_bar = {}", local_to_bar).unwrap();
|
||||
hprintln!("bar: local_to_bar = {}", local_to_bar);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ mod app {
|
|||
|
||||
*c.shared.counter += 1; // <- no lock API required
|
||||
let counter = *c.shared.counter;
|
||||
hprintln!(" foo = {}", counter).unwrap();
|
||||
hprintln!(" foo = {}", counter);
|
||||
}
|
||||
|
||||
#[task(shared = [counter])] // <- same priority
|
||||
|
@ -42,7 +42,7 @@ mod app {
|
|||
|
||||
*c.shared.counter += 1; // <- no lock API required
|
||||
let counter = *c.shared.counter;
|
||||
hprintln!(" bar = {}", counter).unwrap();
|
||||
hprintln!(" bar = {}", counter);
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ mod app {
|
|||
// when omitted priority is assumed to be `1`
|
||||
#[task(shared = [shared])]
|
||||
fn foo(mut c: foo::Context) {
|
||||
hprintln!("A").unwrap();
|
||||
hprintln!("A");
|
||||
|
||||
// the lower priority task requires a critical section to access the data
|
||||
c.shared.shared.lock(|shared| {
|
||||
|
@ -39,7 +39,7 @@ mod app {
|
|||
// bar will *not* run right now due to the critical section
|
||||
bar::spawn().unwrap();
|
||||
|
||||
hprintln!("B - shared = {}", *shared).unwrap();
|
||||
hprintln!("B - shared = {}", *shared);
|
||||
|
||||
// baz does not contend for `shared` so it's allowed to run now
|
||||
baz::spawn().unwrap();
|
||||
|
@ -47,7 +47,7 @@ mod app {
|
|||
|
||||
// critical section is over: bar can now start
|
||||
|
||||
hprintln!("E").unwrap();
|
||||
hprintln!("E");
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
@ -61,11 +61,11 @@ mod app {
|
|||
*shared
|
||||
});
|
||||
|
||||
hprintln!("D - shared = {}", shared).unwrap();
|
||||
hprintln!("D - shared = {}", shared);
|
||||
}
|
||||
|
||||
#[task(priority = 3)]
|
||||
fn baz(_: baz::Context) {
|
||||
hprintln!("C").unwrap();
|
||||
hprintln!("C");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ mod app {
|
|||
|
||||
#[task(local = [count: u32 = 0])]
|
||||
fn foo(cx: foo::Context) {
|
||||
hprintln!("foo").unwrap();
|
||||
hprintln!("foo");
|
||||
|
||||
bar::spawn(*cx.local.count).unwrap();
|
||||
*cx.local.count += 1;
|
||||
|
@ -34,14 +34,14 @@ mod app {
|
|||
|
||||
#[task]
|
||||
fn bar(_: bar::Context, x: u32) {
|
||||
hprintln!("bar({})", x).unwrap();
|
||||
hprintln!("bar({})", x);
|
||||
|
||||
baz::spawn(x + 1, x + 2).unwrap();
|
||||
}
|
||||
|
||||
#[task]
|
||||
fn baz(_: baz::Context, x: u32, y: u32) {
|
||||
hprintln!("baz({}, {})", x, y).unwrap();
|
||||
hprintln!("baz({}, {})", x, y);
|
||||
|
||||
if x + y > 4 {
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
|
|
|
@ -29,7 +29,7 @@ mod app {
|
|||
|
||||
#[task(capacity = 3)]
|
||||
fn foo(_c: foo::Context, x: i32, y: u32) {
|
||||
hprintln!("foo {}, {}", x, y).unwrap();
|
||||
hprintln!("foo {}, {}", x, y);
|
||||
if x == 2 {
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ mod app {
|
|||
*s2 += 1;
|
||||
*s3 += 1;
|
||||
|
||||
hprintln!("Multiple locks, s1: {}, s2: {}, s3: {}", *s1, *s2, *s3).unwrap();
|
||||
hprintln!("Multiple locks, s1: {}, s2: {}, s3: {}", *s1, *s2, *s3);
|
||||
});
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
|
|
|
@ -30,13 +30,13 @@ mod app {
|
|||
#[task(shared = [&key])]
|
||||
fn foo(cx: foo::Context) {
|
||||
let key: &u32 = cx.shared.key;
|
||||
hprintln!("foo(key = {:#x})", key).unwrap();
|
||||
hprintln!("foo(key = {:#x})", key);
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
||||
#[task(priority = 2, shared = [&key])]
|
||||
fn bar(cx: bar::Context) {
|
||||
hprintln!("bar(key = {:#x})", cx.shared.key).unwrap();
|
||||
hprintln!("bar(key = {:#x})", cx.shared.key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ mod app {
|
|||
|
||||
#[task(local = [cnt: u32 = 0])]
|
||||
fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) {
|
||||
hprintln!("foo {:?}", instant).ok();
|
||||
hprintln!("foo {:?}", instant);
|
||||
*cx.local.cnt += 1;
|
||||
|
||||
if *cx.local.cnt == 4 {
|
||||
|
|
|
@ -36,7 +36,7 @@ mod app {
|
|||
// Using the explicit type of the timer implementation
|
||||
#[task(local = [cnt: u32 = 0])]
|
||||
fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) {
|
||||
hprintln!("foo {:?}", instant).ok();
|
||||
hprintln!("foo {:?}", instant);
|
||||
*cx.local.cnt += 1;
|
||||
|
||||
if *cx.local.cnt == 4 {
|
||||
|
@ -52,7 +52,7 @@ mod app {
|
|||
// This remains agnostic to the timer implementation
|
||||
#[task(local = [cnt: u32 = 0])]
|
||||
fn bar(_cx: bar::Context, instant: <MyMono as rtic_monotonic::Monotonic>::Instant) {
|
||||
hprintln!("bar {:?}", instant).ok();
|
||||
hprintln!("bar {:?}", instant);
|
||||
|
||||
// Spawn a new message with 1s offset to spawned time
|
||||
let next_instant = instant + 1.secs();
|
||||
|
|
|
@ -35,7 +35,7 @@ mod app {
|
|||
|
||||
#[task(local = [cnt: u32 = 0])]
|
||||
fn foo(cx: foo::Context) {
|
||||
hprintln!("foo").ok();
|
||||
hprintln!("foo");
|
||||
*cx.local.cnt += 1;
|
||||
|
||||
if *cx.local.cnt == 4 {
|
||||
|
|
|
@ -56,7 +56,7 @@ mod app {
|
|||
|
||||
#[task]
|
||||
fn foo(_: foo::Context, x: Box<P>) {
|
||||
hprintln!("foo({:?})", x.as_ptr()).unwrap();
|
||||
hprintln!("foo({:?})", x.as_ptr());
|
||||
|
||||
// explicitly return the block to the pool
|
||||
drop(x);
|
||||
|
@ -66,7 +66,7 @@ mod app {
|
|||
|
||||
#[task(priority = 2)]
|
||||
fn bar(_: bar::Context, x: Box<P>) {
|
||||
hprintln!("bar({:?})", x.as_ptr()).unwrap();
|
||||
hprintln!("bar({:?})", x.as_ptr());
|
||||
|
||||
// this is done automatically so we can omit the call to `drop`
|
||||
// drop(x);
|
||||
|
|
|
@ -25,21 +25,21 @@ mod app {
|
|||
|
||||
#[task(priority = 1)]
|
||||
fn foo(_: foo::Context) {
|
||||
hprintln!("foo - start").unwrap();
|
||||
hprintln!("foo - start");
|
||||
baz::spawn().unwrap();
|
||||
hprintln!("foo - end").unwrap();
|
||||
hprintln!("foo - end");
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
||||
#[task(priority = 2)]
|
||||
fn bar(_: bar::Context) {
|
||||
hprintln!(" bar").unwrap();
|
||||
hprintln!(" bar");
|
||||
}
|
||||
|
||||
#[task(priority = 2)]
|
||||
fn baz(_: baz::Context) {
|
||||
hprintln!(" baz - start").unwrap();
|
||||
hprintln!(" baz - start");
|
||||
bar::spawn().unwrap();
|
||||
hprintln!(" baz - end").unwrap();
|
||||
hprintln!(" baz - end");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ mod app {
|
|||
#[inline(never)]
|
||||
#[task]
|
||||
fn foo(_: foo::Context) {
|
||||
hprintln!("foo").unwrap();
|
||||
hprintln!("foo");
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ mod app {
|
|||
*shared
|
||||
});
|
||||
|
||||
hprintln!("UART0: shared = {}", shared).unwrap();
|
||||
hprintln!("UART0: shared = {}", shared);
|
||||
}
|
||||
|
||||
// `shared` can be accessed from this context
|
||||
|
@ -66,6 +66,6 @@ mod app {
|
|||
*shared
|
||||
});
|
||||
|
||||
hprintln!("UART1: shared = {}", shared).unwrap();
|
||||
hprintln!("UART1: shared = {}", shared);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ mod app {
|
|||
// Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
|
||||
let mono = Systick::new(systick, 12_000_000);
|
||||
|
||||
hprintln!("init").ok();
|
||||
hprintln!("init");
|
||||
|
||||
// Schedule `foo` to run 1 second in the future
|
||||
foo::spawn_after(1.secs()).unwrap();
|
||||
|
@ -42,7 +42,7 @@ mod app {
|
|||
|
||||
#[task]
|
||||
fn foo(_: foo::Context) {
|
||||
hprintln!("foo").ok();
|
||||
hprintln!("foo");
|
||||
|
||||
// Schedule `bar` to run 2 seconds in the future (1 second after foo runs)
|
||||
bar::spawn_after(1.secs()).unwrap();
|
||||
|
@ -50,7 +50,7 @@ mod app {
|
|||
|
||||
#[task]
|
||||
fn bar(_: bar::Context) {
|
||||
hprintln!("bar").ok();
|
||||
hprintln!("bar");
|
||||
|
||||
// Schedule `baz` to run 1 seconds from now, but with a specific time instant.
|
||||
baz::spawn_at(monotonics::now() + 1.secs()).unwrap();
|
||||
|
@ -58,7 +58,7 @@ mod app {
|
|||
|
||||
#[task]
|
||||
fn baz(_: baz::Context) {
|
||||
hprintln!("baz").ok();
|
||||
hprintln!("baz");
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ mod app {
|
|||
fn idle(mut c: idle::Context) -> ! {
|
||||
loop {
|
||||
if let Some(byte) = c.shared.c.lock(|c| c.dequeue()) {
|
||||
hprintln!("received message: {}", byte).unwrap();
|
||||
hprintln!("received message: {}", byte);
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
} else {
|
||||
|
|
|
@ -19,7 +19,7 @@ mod app {
|
|||
|
||||
#[init]
|
||||
fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
|
||||
hprintln!("init").unwrap();
|
||||
hprintln!("init");
|
||||
foo::spawn().unwrap();
|
||||
|
||||
(Shared {}, Local {}, init::Monotonics())
|
||||
|
@ -27,7 +27,7 @@ mod app {
|
|||
|
||||
#[task]
|
||||
fn foo(_: foo::Context) {
|
||||
hprintln!("foo").unwrap();
|
||||
hprintln!("foo");
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ mod app {
|
|||
loop {
|
||||
// Lock-free access to the same underlying queue!
|
||||
if let Some(data) = c.local.c.dequeue() {
|
||||
hprintln!("received message: {}", data).unwrap();
|
||||
hprintln!("received message: {}", data);
|
||||
|
||||
// Run foo until data
|
||||
if data == 3 {
|
||||
|
|
|
@ -26,31 +26,31 @@ mod app {
|
|||
|
||||
#[task]
|
||||
fn foo(_: foo::Context) {
|
||||
hprintln!("foo - start").unwrap();
|
||||
hprintln!("foo - start");
|
||||
|
||||
// spawns `bar` onto the task scheduler
|
||||
// `foo` and `bar` have the same priority so `bar` will not run until
|
||||
// after `foo` terminates
|
||||
bar::spawn().unwrap();
|
||||
|
||||
hprintln!("foo - middle").unwrap();
|
||||
hprintln!("foo - middle");
|
||||
|
||||
// spawns `baz` onto the task scheduler
|
||||
// `baz` has higher priority than `foo` so it immediately preempts `foo`
|
||||
baz::spawn().unwrap();
|
||||
|
||||
hprintln!("foo - end").unwrap();
|
||||
hprintln!("foo - end");
|
||||
}
|
||||
|
||||
#[task]
|
||||
fn bar(_: bar::Context) {
|
||||
hprintln!("bar").unwrap();
|
||||
hprintln!("bar");
|
||||
|
||||
debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
|
||||
}
|
||||
|
||||
#[task(priority = 2)]
|
||||
fn baz(_: baz::Context) {
|
||||
hprintln!("baz").unwrap();
|
||||
hprintln!("baz");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue