aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rtic/examples/async-channel-done.rs5
-rw-r--r--rtic/examples/async-channel-no-receiver.rs5
-rw-r--r--rtic/examples/async-channel-no-sender.rs5
-rw-r--r--rtic/examples/async-channel-try.rs5
-rw-r--r--rtic/examples/async-channel.rs5
-rw-r--r--rtic/examples/async-delay.rs1
-rw-r--r--rtic/examples/async-infinite-loop.no_rs53
-rw-r--r--rtic/examples/async-task-multiple-prios.rs4
-rw-r--r--rtic/examples/async-task.rs4
-rw-r--r--rtic/examples/async-timeout.no_rs87
-rw-r--r--rtic/examples/async-timeout.rs1
-rw-r--r--rtic/examples/big-struct-opt.rs3
-rw-r--r--rtic/examples/binds.rs4
-rw-r--r--rtic/examples/cancel-reschedule.no_rs73
-rw-r--r--rtic/examples/capacity.no_rs49
-rw-r--r--rtic/examples/cfg-whole-task.no_rs94
-rw-r--r--rtic/examples/common.no_rs102
-rw-r--r--rtic/examples/common.rs9
-rw-r--r--rtic/examples/complex.rs6
-rw-r--r--rtic/examples/declared_locals.rs6
-rw-r--r--rtic/examples/destructure.rs6
-rw-r--r--rtic/examples/extern_binds.rs6
-rw-r--r--rtic/examples/extern_spawn.rs6
-rw-r--r--rtic/examples/generics.rs6
-rw-r--r--rtic/examples/hardware.rs6
-rw-r--r--rtic/examples/idle-wfi.rs6
-rw-r--r--rtic/examples/idle.rs6
-rw-r--r--rtic/examples/init.rs6
-rw-r--r--rtic/examples/locals.rs8
-rw-r--r--rtic/examples/lock-free.no_rs50
-rw-r--r--rtic/examples/lock-free.rs5
-rw-r--r--rtic/examples/lock.rs6
-rw-r--r--rtic/examples/message.no_rs52
-rw-r--r--rtic/examples/multilock.rs6
-rw-r--r--rtic/examples/not-sync.rs5
-rw-r--r--rtic/examples/only-shared-access.rs6
-rw-r--r--rtic/examples/periodic-at.no_rs49
-rw-r--r--rtic/examples/periodic-at2.no_rs61
-rw-r--r--rtic/examples/periodic.no_rs48
-rw-r--r--rtic/examples/peripherals-taken.rs6
-rw-r--r--rtic/examples/pool.rs3
-rw-r--r--rtic/examples/preempt.rs4
-rw-r--r--rtic/examples/ramfunc.rs4
-rw-r--r--rtic/examples/resource-user-struct.rs6
-rw-r--r--rtic/examples/schedule.no_rs64
-rw-r--r--rtic/examples/shared.rs6
-rw-r--r--rtic/examples/smallest.rs2
-rw-r--r--rtic/examples/spawn.rs6
-rw-r--r--rtic/examples/spawn_arguments.rs7
-rw-r--r--rtic/examples/spawn_err.rs8
-rw-r--r--rtic/examples/spawn_loop.rs8
-rw-r--r--rtic/examples/static.rs6
-rw-r--r--rtic/examples/t-binds.rs6
-rw-r--r--rtic/examples/t-cfg-resources.rs2
-rw-r--r--rtic/examples/t-htask-main.rs8
-rw-r--r--rtic/examples/t-idle-main.rs6
-rw-r--r--rtic/examples/t-late-not-send.rs2
-rw-r--r--rtic/examples/t-schedule.no_rs136
-rw-r--r--rtic/examples/t-spawn.no_rs69
-rw-r--r--rtic/examples/task.rs6
-rw-r--r--rtic/examples/zero-prio-task.rs4
-rw-r--r--rtic/examples/zero-prio-task_err.no_rs66
62 files changed, 135 insertions, 1165 deletions
diff --git a/rtic/examples/async-channel-done.rs b/rtic/examples/async-channel-done.rs
index 1c32d32b..04d94ff6 100644
--- a/rtic/examples/async-channel-done.rs
+++ b/rtic/examples/async-channel-done.rs
@@ -1,9 +1,10 @@
//! examples/async-channel-done.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/async-channel-no-receiver.rs b/rtic/examples/async-channel-no-receiver.rs
index 02e6a22c..ccf00703 100644
--- a/rtic/examples/async-channel-no-receiver.rs
+++ b/rtic/examples/async-channel-no-receiver.rs
@@ -1,9 +1,10 @@
//! examples/async-channel-no-receiver.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/async-channel-no-sender.rs b/rtic/examples/async-channel-no-sender.rs
index 0bdc7cb5..0705ecdb 100644
--- a/rtic/examples/async-channel-no-sender.rs
+++ b/rtic/examples/async-channel-no-sender.rs
@@ -1,9 +1,10 @@
//! examples/async-channel-no-sender.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/async-channel-try.rs b/rtic/examples/async-channel-try.rs
index 4c369edb..26c8a4fb 100644
--- a/rtic/examples/async-channel-try.rs
+++ b/rtic/examples/async-channel-try.rs
@@ -1,9 +1,10 @@
//! examples/async-channel-try.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/async-channel.rs b/rtic/examples/async-channel.rs
index 58eeee87..d85b3b55 100644
--- a/rtic/examples/async-channel.rs
+++ b/rtic/examples/async-channel.rs
@@ -1,9 +1,10 @@
//! examples/async-channel.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/async-delay.rs b/rtic/examples/async-delay.rs
index 03206aeb..ba6ec541 100644
--- a/rtic/examples/async-delay.rs
+++ b/rtic/examples/async-delay.rs
@@ -3,6 +3,7 @@
#![no_main]
#![no_std]
#![deny(warnings)]
+#![deny(unsafe_code)]
#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
diff --git a/rtic/examples/async-infinite-loop.no_rs b/rtic/examples/async-infinite-loop.no_rs
deleted file mode 100644
index a95f9986..00000000
--- a/rtic/examples/async-infinite-loop.no_rs
+++ /dev/null
@@ -1,53 +0,0 @@
-#![no_main]
-#![no_std]
-#![feature(type_alias_impl_trait)]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
- use systick_monotonic::*;
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[monotonic(binds = SysTick, default = true)]
- type MyMono = Systick<100>;
-
- #[init]
- fn init(cx: init::Context) -> (Shared, Local) {
- hprintln!("init").unwrap();
-
- foo::spawn().ok();
-
- (Shared {}, Local {})
- }
-
- #[idle]
- fn idle(_: idle::Context) -> ! {
- loop {
- cortex_m::asm::wfi(); // put the MCU in sleep mode until interrupt occurs
- }
- }
-
- // Infinite loops are not allowed in RTIC, however in async tasks they are - if there is an
- // await inside the loop.
- #[task]
- async fn foo(_cx: foo::Context) {
- let mut i = 0;
- loop {
- if i == 5 {
- debug::exit(debug::EXIT_SUCCESS);
- }
-
- hprintln!("hello from async {}", i).ok();
- monotonics::delay(100.millis()).await; // This makes it okey!
-
- i += 1;
- }
- }
-}
diff --git a/rtic/examples/async-task-multiple-prios.rs b/rtic/examples/async-task-multiple-prios.rs
index 5c9674d7..88f4cf45 100644
--- a/rtic/examples/async-task-multiple-prios.rs
+++ b/rtic/examples/async-task-multiple-prios.rs
@@ -2,8 +2,10 @@
#![no_main]
#![no_std]
-#![feature(type_alias_impl_trait)]
+#![deny(warnings)]
+#![deny(unsafe_code)]
#![deny(missing_docs)]
+#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/async-task.rs b/rtic/examples/async-task.rs
index 7730c54d..b70151a2 100644
--- a/rtic/examples/async-task.rs
+++ b/rtic/examples/async-task.rs
@@ -2,8 +2,10 @@
#![no_main]
#![no_std]
-#![feature(type_alias_impl_trait)]
+#![deny(warnings)]
+#![deny(unsafe_code)]
#![deny(missing_docs)]
+#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/async-timeout.no_rs b/rtic/examples/async-timeout.no_rs
deleted file mode 100644
index 3f68df74..00000000
--- a/rtic/examples/async-timeout.no_rs
+++ /dev/null
@@ -1,87 +0,0 @@
-#![no_main]
-#![no_std]
-#![feature(type_alias_impl_trait)]
-
-use panic_semihosting as _;
-
-// NOTES:
-//
-// - Async tasks cannot have `#[lock_free]` resources, as they can interleve and each async
-// task can have a mutable reference stored.
-// - Spawning an async task equates to it being polled once.
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0, UART0], peripherals = true)]
-mod app {
- use core::{
- future::Future,
- pin::Pin,
- task::{Context, Poll},
- };
- use cortex_m_semihosting::{debug, hprintln};
- use systick_monotonic::*;
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[monotonic(binds = SysTick, default = true)]
- type MyMono = Systick<100>;
-
- #[init]
- fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
- hprintln!("init").unwrap();
-
- foo::spawn().ok();
- bar::spawn().ok();
-
- (
- Shared {},
- Local {},
- init::Monotonics(Systick::new(cx.core.SYST, 12_000_000)),
- )
- }
-
- #[idle]
- fn idle(_: idle::Context) -> ! {
- loop {
- cortex_m::asm::wfi(); // put the MCU in sleep mode until interrupt occurs
- }
- }
-
- #[task]
- async fn foo(_cx: foo::Context) {
- hprintln!("hello from foo").ok();
-
- // This will not timeout
- match monotonics::timeout_after(monotonics::delay(100.millis()), 200.millis()).await {
- Ok(_) => hprintln!("foo no timeout").ok(),
- Err(_) => hprintln!("foo timeout").ok(),
- };
- }
-
- #[task]
- async fn bar(_cx: bar::Context) {
- hprintln!("hello from bar").ok();
-
- // This will timeout
- match monotonics::timeout_after(NeverEndingFuture {}, 300.millis()).await {
- Ok(_) => hprintln!("bar no timeout").ok(),
- Err(_) => hprintln!("bar timeout").ok(),
- };
-
- debug::exit(debug::EXIT_SUCCESS);
- }
-
- pub struct NeverEndingFuture {}
-
- impl Future for NeverEndingFuture {
- type Output = ();
-
- fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Self::Output> {
- // Never finish
- Poll::Pending
- }
- }
-}
diff --git a/rtic/examples/async-timeout.rs b/rtic/examples/async-timeout.rs
index 810bdeb8..fda385aa 100644
--- a/rtic/examples/async-timeout.rs
+++ b/rtic/examples/async-timeout.rs
@@ -3,6 +3,7 @@
#![no_main]
#![no_std]
#![deny(warnings)]
+#![deny(unsafe_code)]
#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
diff --git a/rtic/examples/big-struct-opt.rs b/rtic/examples/big-struct-opt.rs
index 408a2dec..4326247a 100644
--- a/rtic/examples/big-struct-opt.rs
+++ b/rtic/examples/big-struct-opt.rs
@@ -5,8 +5,9 @@
#![no_main]
#![no_std]
-#![feature(type_alias_impl_trait)]
+#![deny(warnings)]
#![deny(missing_docs)]
+#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/binds.rs b/rtic/examples/binds.rs
index cf078ffe..b101d541 100644
--- a/rtic/examples/binds.rs
+++ b/rtic/examples/binds.rs
@@ -1,9 +1,9 @@
//! examples/binds.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/cancel-reschedule.no_rs b/rtic/examples/cancel-reschedule.no_rs
deleted file mode 100644
index a38a9c4e..00000000
--- a/rtic/examples/cancel-reschedule.no_rs
+++ /dev/null
@@ -1,73 +0,0 @@
-//! examples/cancel-reschedule.rs
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
- use systick_monotonic::*;
-
- #[monotonic(binds = SysTick, default = true)]
- type MyMono = Systick<100>; // 100 Hz / 10 ms granularity
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
- let systick = cx.core.SYST;
-
- // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
- let mono = Systick::new(systick, 12_000_000);
-
- hprintln!("init").ok();
-
- // Schedule `foo` to run 1 second in the future
- foo::spawn_after(1.secs()).unwrap();
-
- (
- Shared {},
- Local {},
- init::Monotonics(mono), // Give the monotonic to RTIC
- )
- }
-
- #[task]
- fn foo(_: foo::Context) {
- hprintln!("foo").ok();
-
- // Schedule `bar` to run 2 seconds in the future (1 second after foo runs)
- let spawn_handle = baz::spawn_after(2.secs()).unwrap();
- bar::spawn_after(1.secs(), spawn_handle, false).unwrap(); // Change to true
- }
-
- #[task]
- fn bar(_: bar::Context, baz_handle: baz::SpawnHandle, do_reschedule: bool) {
- hprintln!("bar").ok();
-
- if do_reschedule {
- // Reschedule baz 2 seconds from now, instead of the original 1 second
- // from now.
- baz_handle.reschedule_after(2.secs()).unwrap();
- // Or baz_handle.reschedule_at(/* time */)
- } else {
- // Or cancel it
- baz_handle.cancel().unwrap();
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
- }
- }
-
- #[task]
- fn baz(_: baz::Context) {
- hprintln!("baz").ok();
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
- }
-}
diff --git a/rtic/examples/capacity.no_rs b/rtic/examples/capacity.no_rs
deleted file mode 100644
index a6172698..00000000
--- a/rtic/examples/capacity.no_rs
+++ /dev/null
@@ -1,49 +0,0 @@
-//! examples/capacity.rs
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
- use lm3s6965::Interrupt;
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- rtic::pend(Interrupt::UART0);
-
- (Shared {}, Local {}, init::Monotonics())
- }
-
- #[task(binds = UART0)]
- fn uart0(_: uart0::Context) {
- foo::spawn(0).unwrap();
- foo::spawn(1).unwrap();
- foo::spawn(2).unwrap();
- foo::spawn(3).unwrap();
-
- bar::spawn().unwrap();
- }
-
- #[task(capacity = 4)]
- fn foo(_: foo::Context, x: u32) {
- hprintln!("foo({})", x).unwrap();
- }
-
- #[task]
- fn bar(_: bar::Context) {
- hprintln!("bar").unwrap();
-
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
- }
-}
diff --git a/rtic/examples/cfg-whole-task.no_rs b/rtic/examples/cfg-whole-task.no_rs
deleted file mode 100644
index f41866db..00000000
--- a/rtic/examples/cfg-whole-task.no_rs
+++ /dev/null
@@ -1,94 +0,0 @@
-//! examples/cfg-whole-task.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;
-
- #[shared]
- struct Shared {
- count: u32,
- #[cfg(never)]
- unused: u32,
- }
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- foo::spawn().unwrap();
- foo::spawn().unwrap();
-
- (
- Shared {
- count: 0,
- #[cfg(never)]
- unused: 1,
- },
- Local {},
- init::Monotonics(),
- )
- }
-
- #[idle]
- fn idle(_: idle::Context) -> ! {
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
-
- loop {
- cortex_m::asm::nop();
- }
- }
-
- #[task(capacity = 2, shared = [count])]
- fn foo(mut _cx: foo::Context) {
- #[cfg(debug_assertions)]
- {
- _cx.shared.count.lock(|count| *count += 1);
-
- log::spawn(_cx.shared.count.lock(|count| *count)).unwrap();
- }
-
- // this wouldn't compile in `release` mode
- // *_cx.shared.count += 1;
-
- // ..
- }
-
- // The whole task should disappear,
- // currently still present in the Tasks enum
- #[cfg(never)]
- #[task(capacity = 2, shared = [count])]
- fn foo2(mut _cx: foo2::Context) {
- #[cfg(debug_assertions)]
- {
- _cx.shared.count.lock(|count| *count += 10);
-
- log::spawn(_cx.shared.count.lock(|count| *count)).unwrap();
- }
-
- // this wouldn't compile in `release` mode
- // *_cx.shared.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();
- }
-}
diff --git a/rtic/examples/common.no_rs b/rtic/examples/common.no_rs
deleted file mode 100644
index 1fe671e6..00000000
--- a/rtic/examples/common.no_rs
+++ /dev/null
@@ -1,102 +0,0 @@
-//! examples/common.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, hprintln};
- use systick_monotonic::*; // Implements the `Monotonic` trait
-
- // A monotonic timer to enable scheduling in RTIC
- #[monotonic(binds = SysTick, default = true)]
- type MyMono = Systick<100>; // 100 Hz / 10 ms granularity
-
- // Resources shared between tasks
- #[shared]
- struct Shared {
- s1: u32,
- s2: i32,
- }
-
- // Local resources to specific tasks (cannot be shared)
- #[local]
- struct Local {
- l1: u8,
- l2: i8,
- }
-
- #[init]
- fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
- let systick = cx.core.SYST;
-
- // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
- let mono = Systick::new(systick, 12_000_000);
-
- // Spawn the task `foo` directly after `init` finishes
- foo::spawn().unwrap();
-
- // Spawn the task `bar` 1 second after `init` finishes, this is enabled
- // by the `#[monotonic(..)]` above
- bar::spawn_after(1.secs()).unwrap();
-
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
-
- (
- // Initialization of shared resources
- Shared { s1: 0, s2: 1 },
- // Initialization of task local resources
- Local { l1: 2, l2: 3 },
- // Move the monotonic timer to the RTIC run-time, this enables
- // scheduling
- init::Monotonics(mono),
- )
- }
-
- // Background task, runs whenever no other tasks are running
- #[idle]
- fn idle(_: idle::Context) -> ! {
- loop {
- continue;
- }
- }
-
- // Software task, not bound to a hardware interrupt.
- // This task takes the task local resource `l1`
- // The resources `s1` and `s2` are shared between all other tasks.
- #[task(shared = [s1, s2], local = [l1])]
- fn foo(_: foo::Context) {
- // This task is only spawned once in `init`, hence this task will run
- // only once
-
- hprintln!("foo").ok();
- }
-
- // Software task, also not bound to a hardware interrupt
- // This task takes the task local resource `l2`
- // The resources `s1` and `s2` are shared between all other tasks.
- #[task(shared = [s1, s2], local = [l2])]
- fn bar(_: bar::Context) {
- hprintln!("bar").ok();
-
- // Run `bar` once per second
- bar::spawn_after(1.secs()).unwrap();
- }
-
- // Hardware task, bound to a hardware interrupt
- // The resources `s1` and `s2` are shared between all other tasks.
- #[task(binds = UART0, priority = 3, shared = [s1, s2])]
- fn uart0_interrupt(_: uart0_interrupt::Context) {
- // This task is bound to the interrupt `UART0` and will run
- // whenever the interrupt fires
-
- // Note that RTIC does NOT clear the interrupt flag, this is up to the
- // user
-
- hprintln!("UART0 interrupt!").ok();
- }
-}
diff --git a/rtic/examples/common.rs b/rtic/examples/common.rs
index f07b69c5..ed6cb7dd 100644
--- a/rtic/examples/common.rs
+++ b/rtic/examples/common.rs
@@ -1,10 +1,11 @@
//! examples/common.rs
-#![feature(type_alias_impl_trait)]
-#![deny(unsafe_code)]
-#![deny(missing_docs)]
-#![deny(warnings)]
+
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
+#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/complex.rs b/rtic/examples/complex.rs
index c1e9c6c6..a4fe659f 100644
--- a/rtic/examples/complex.rs
+++ b/rtic/examples/complex.rs
@@ -1,10 +1,10 @@
//! examples/complex.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/declared_locals.rs b/rtic/examples/declared_locals.rs
index c8451910..b1bb9f4d 100644
--- a/rtic/examples/declared_locals.rs
+++ b/rtic/examples/declared_locals.rs
@@ -1,10 +1,10 @@
//! examples/declared_locals.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/destructure.rs b/rtic/examples/destructure.rs
index 81eff3b4..b5d564bc 100644
--- a/rtic/examples/destructure.rs
+++ b/rtic/examples/destructure.rs
@@ -1,10 +1,10 @@
//! examples/destructure.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/extern_binds.rs b/rtic/examples/extern_binds.rs
index 142a11d0..f03a8a9c 100644
--- a/rtic/examples/extern_binds.rs
+++ b/rtic/examples/extern_binds.rs
@@ -1,10 +1,10 @@
//! examples/extern_binds.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use cortex_m_semihosting::hprintln;
use panic_semihosting as _;
diff --git a/rtic/examples/extern_spawn.rs b/rtic/examples/extern_spawn.rs
index b2b95b9d..2ab5550c 100644
--- a/rtic/examples/extern_spawn.rs
+++ b/rtic/examples/extern_spawn.rs
@@ -1,10 +1,10 @@
//! examples/extern_spawn.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use cortex_m_semihosting::{debug, hprintln};
diff --git a/rtic/examples/generics.rs b/rtic/examples/generics.rs
index 2f23cce9..dd042a31 100644
--- a/rtic/examples/generics.rs
+++ b/rtic/examples/generics.rs
@@ -1,10 +1,10 @@
//! examples/generics.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use cortex_m_semihosting::hprintln;
use panic_semihosting as _;
diff --git a/rtic/examples/hardware.rs b/rtic/examples/hardware.rs
index 62ae0d66..b4c6b6c9 100644
--- a/rtic/examples/hardware.rs
+++ b/rtic/examples/hardware.rs
@@ -1,10 +1,10 @@
//! examples/hardware.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/idle-wfi.rs b/rtic/examples/idle-wfi.rs
index 8134ce3e..72aaa952 100644
--- a/rtic/examples/idle-wfi.rs
+++ b/rtic/examples/idle-wfi.rs
@@ -1,10 +1,10 @@
//! examples/idle-wfi.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/idle.rs b/rtic/examples/idle.rs
index 0c4bd044..41498185 100644
--- a/rtic/examples/idle.rs
+++ b/rtic/examples/idle.rs
@@ -1,10 +1,10 @@
//! examples/idle.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/init.rs b/rtic/examples/init.rs
index c3081bf8..634d309d 100644
--- a/rtic/examples/init.rs
+++ b/rtic/examples/init.rs
@@ -1,10 +1,10 @@
//! examples/init.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/locals.rs b/rtic/examples/locals.rs
index ec3d59d8..2408f90c 100644
--- a/rtic/examples/locals.rs
+++ b/rtic/examples/locals.rs
@@ -1,11 +1,11 @@
//! examples/locals.rs
-#![feature(type_alias_impl_trait)]
-#![deny(unsafe_code)]
-#![deny(missing_docs)]
-#![deny(warnings)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
+#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/lock-free.no_rs b/rtic/examples/lock-free.no_rs
deleted file mode 100644
index 053307c1..00000000
--- a/rtic/examples/lock-free.no_rs
+++ /dev/null
@@ -1,50 +0,0 @@
-//! examples/lock-free.rs
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-#![feature(type_alias_impl_trait)]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [GPIOA])]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
-
- #[shared]
- struct Shared {
- #[lock_free] // <- lock-free shared resource
- counter: u64,
- }
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local) {
- foo::spawn().unwrap();
-
- (Shared { counter: 0 }, Local {})
- }
-
- #[task(shared = [counter])] // <- same priority
- async fn foo(c: foo::Context) {
- bar::spawn().unwrap();
-
- *c.shared.counter += 1; // <- no lock API required
- let counter = *c.shared.counter;
- hprintln!(" foo = {}", counter).unwrap();
- }
-
- #[task(shared = [counter])] // <- same priority
- async fn bar(c: bar::Context) {
- foo::spawn().unwrap();
-
- *c.shared.counter += 1; // <- no lock API required
- let counter = *c.shared.counter;
- hprintln!(" bar = {}", counter).unwrap();
-
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
- }
-}
diff --git a/rtic/examples/lock-free.rs b/rtic/examples/lock-free.rs
index 3e096040..c17d70d3 100644
--- a/rtic/examples/lock-free.rs
+++ b/rtic/examples/lock-free.rs
@@ -1,9 +1,10 @@
//! examples/lock-free.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/lock.rs b/rtic/examples/lock.rs
index 203ae6f4..c09d99db 100644
--- a/rtic/examples/lock.rs
+++ b/rtic/examples/lock.rs
@@ -1,10 +1,10 @@
//! examples/lock.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/message.no_rs b/rtic/examples/message.no_rs
deleted file mode 100644
index 76c5675a..00000000
--- a/rtic/examples/message.no_rs
+++ /dev/null
@@ -1,52 +0,0 @@
-//! examples/message.rs
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- foo::spawn(/* no message */).unwrap();
-
- (Shared {}, Local {}, init::Monotonics())
- }
-
- #[task(local = [count: u32 = 0])]
- fn foo(cx: foo::Context) {
- hprintln!("foo").unwrap();
-
- bar::spawn(*cx.local.count).unwrap();
- *cx.local.count += 1;
- }
-
- #[task]
- fn bar(_: bar::Context, x: u32) {
- hprintln!("bar({})", x).unwrap();
-
- baz::spawn(x + 1, x + 2).unwrap();
- }
-
- #[task]
- fn baz(_: baz::Context, x: u32, y: u32) {
- hprintln!("baz({}, {})", x, y).unwrap();
-
- if x + y > 4 {
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
- }
-
- foo::spawn().unwrap();
- }
-}
diff --git a/rtic/examples/multilock.rs b/rtic/examples/multilock.rs
index 6208cacc..ba9588bf 100644
--- a/rtic/examples/multilock.rs
+++ b/rtic/examples/multilock.rs
@@ -1,10 +1,10 @@
//! examples/mutlilock.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/not-sync.rs b/rtic/examples/not-sync.rs
index 6d1ddaea..cd6b0bf5 100644
--- a/rtic/examples/not-sync.rs
+++ b/rtic/examples/not-sync.rs
@@ -1,10 +1,9 @@
//! `examples/not-sync.rs`
-// #![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use core::marker::PhantomData;
diff --git a/rtic/examples/only-shared-access.rs b/rtic/examples/only-shared-access.rs
index 1d006e63..23ae67ef 100644
--- a/rtic/examples/only-shared-access.rs
+++ b/rtic/examples/only-shared-access.rs
@@ -1,10 +1,10 @@
//! examples/only-shared-access.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/periodic-at.no_rs b/rtic/examples/periodic-at.no_rs
deleted file mode 100644
index ca68ed5e..00000000
--- a/rtic/examples/periodic-at.no_rs
+++ /dev/null
@@ -1,49 +0,0 @@
-//! examples/periodic-at.rs
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
- use systick_monotonic::*;
-
- #[monotonic(binds = SysTick, default = true)]
- type MyMono = Systick<100>; // 100 Hz / 10 ms granularity
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
- let systick = cx.core.SYST;
-
- // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
- let mut mono = Systick::new(systick, 12_000_000);
-
- foo::spawn_after(1.secs(), mono.now()).unwrap();
-
- (Shared {}, Local {}, init::Monotonics(mono))
- }
-
- #[task(local = [cnt: u32 = 0])]
- fn foo(cx: foo::Context, instant: fugit::TimerInstantU64<100>) {
- hprintln!("foo {:?}", instant).ok();
- *cx.local.cnt += 1;
-
- if *cx.local.cnt == 4 {
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
- }
-
- // Periodic every 100 milliseconds
- let next_instant = instant + 100.millis();
- foo::spawn_at(next_instant, next_instant).unwrap();
- }
-}
diff --git a/rtic/examples/periodic-at2.no_rs b/rtic/examples/periodic-at2.no_rs
deleted file mode 100644
index ec9adcc5..00000000
--- a/rtic/examples/periodic-at2.no_rs
+++ /dev/null
@@ -1,61 +0,0 @@
-//! examples/periodic-at2.rs
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
- use systick_monotonic::*;
-
- #[monotonic(binds = SysTick, default = true)]
- type MyMono = Systick<100>; // 100 Hz / 10 ms granularity
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
- let systick = cx.core.SYST;
-
- // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
- let mut mono = Systick::new(systick, 12_000_000);
-
- foo::spawn_after(200.millis(), mono.now()).unwrap();
-
- (Shared {}, Local {}, init::Monotonics(mono))
- }
-
- // 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();
- *cx.local.cnt += 1;
-
- if *cx.local.cnt == 4 {
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
- }
-
- // Spawn a new message with 100 ms offset to spawned time
- let next_instant = instant + 100.millis();
- bar::spawn_at(next_instant, next_instant).unwrap();
- }
-
- // Using the Instant from the Monotonic trait
- // 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();
-
- // Spawn a new message with 200ms offset to spawned time
- let next_instant = instant + 200.millis();
- foo::spawn_at(next_instant, next_instant).unwrap();
- }
-}
diff --git a/rtic/examples/periodic.no_rs b/rtic/examples/periodic.no_rs
deleted file mode 100644
index 2f9e8e6a..00000000
--- a/rtic/examples/periodic.no_rs
+++ /dev/null
@@ -1,48 +0,0 @@
-//! examples/periodic.rs
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
- use systick_monotonic::*;
-
- #[monotonic(binds = SysTick, default = true)]
- type MyMono = Systick<100>; // 100 Hz / 10 ms granularity
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
- let systick = cx.core.SYST;
-
- // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
- let mono = Systick::new(systick, 12_000_000);
-
- foo::spawn_after(100.millis()).unwrap();
-
- (Shared {}, Local {}, init::Monotonics(mono))
- }
-
- #[task(local = [cnt: u32 = 0])]
- fn foo(cx: foo::Context) {
- hprintln!("foo").ok();
- *cx.local.cnt += 1;
-
- if *cx.local.cnt == 4 {
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
- }
-
- // Periodic every 100ms
- foo::spawn_after(100.millis()).unwrap();
- }
-}
diff --git a/rtic/examples/peripherals-taken.rs b/rtic/examples/peripherals-taken.rs
index 2f710e90..2f630013 100644
--- a/rtic/examples/peripherals-taken.rs
+++ b/rtic/examples/peripherals-taken.rs
@@ -1,10 +1,10 @@
//! examples/peripherals-taken.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/pool.rs b/rtic/examples/pool.rs
index e597ec69..92c10c43 100644
--- a/rtic/examples/pool.rs
+++ b/rtic/examples/pool.rs
@@ -1,9 +1,8 @@
//! examples/pool.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
#![no_main]
#![no_std]
+#![deny(warnings)]
#![feature(type_alias_impl_trait)]
use heapless::{
diff --git a/rtic/examples/preempt.rs b/rtic/examples/preempt.rs
index 4b11907c..f1a92b02 100644
--- a/rtic/examples/preempt.rs
+++ b/rtic/examples/preempt.rs
@@ -2,8 +2,10 @@
#![no_main]
#![no_std]
-#![feature(type_alias_impl_trait)]
+#![deny(warnings)]
+#![deny(unsafe_code)]
#![deny(missing_docs)]
+#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
use rtic::app;
diff --git a/rtic/examples/ramfunc.rs b/rtic/examples/ramfunc.rs
index e2e7f67b..11349268 100644
--- a/rtic/examples/ramfunc.rs
+++ b/rtic/examples/ramfunc.rs
@@ -1,9 +1,9 @@
//! examples/ramfunc.rs
+//! TODO: verify that ram-sections are properly used
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/resource-user-struct.rs b/rtic/examples/resource-user-struct.rs
index fcbacaea..cad42d7a 100644
--- a/rtic/examples/resource-user-struct.rs
+++ b/rtic/examples/resource-user-struct.rs
@@ -1,10 +1,10 @@
//! examples/resource.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/schedule.no_rs b/rtic/examples/schedule.no_rs
deleted file mode 100644
index 5bad5a30..00000000
--- a/rtic/examples/schedule.no_rs
+++ /dev/null
@@ -1,64 +0,0 @@
-//! examples/schedule.rs
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
- use systick_monotonic::*;
-
- #[monotonic(binds = SysTick, default = true)]
- type MyMono = Systick<100>; // 100 Hz / 10 ms granularity
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
- let systick = cx.core.SYST;
-
- // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
- let mono = Systick::new(systick, 12_000_000);
-
- hprintln!("init").ok();
-
- // Schedule `foo` to run 1 second in the future
- foo::spawn_after(1.secs()).unwrap();
-
- (
- Shared {},
- Local {},
- init::Monotonics(mono), // Give the monotonic to RTIC
- )
- }
-
- #[task]
- fn foo(_: foo::Context) {
- hprintln!("foo").ok();
-
- // Schedule `bar` to run 2 seconds in the future (1 second after foo runs)
- bar::spawn_after(1.secs()).unwrap();
- }
-
- #[task]
- fn bar(_: bar::Context) {
- hprintln!("bar").ok();
-
- // Schedule `baz` to run 1 seconds from now, but with a specific time instant.
- baz::spawn_at(monotonics::now() + 1.secs()).unwrap();
- }
-
- #[task]
- fn baz(_: baz::Context) {
- hprintln!("baz").ok();
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
- }
-}
diff --git a/rtic/examples/shared.rs b/rtic/examples/shared.rs
index d0633fbd..79ebab86 100644
--- a/rtic/examples/shared.rs
+++ b/rtic/examples/shared.rs
@@ -1,10 +1,10 @@
//! examples/late.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/smallest.rs b/rtic/examples/smallest.rs
index e54ae448..fee3f05d 100644
--- a/rtic/examples/smallest.rs
+++ b/rtic/examples/smallest.rs
@@ -2,6 +2,8 @@
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
#![deny(missing_docs)]
use panic_semihosting as _; // panic handler
diff --git a/rtic/examples/spawn.rs b/rtic/examples/spawn.rs
index d30ecf1b..58f9bc00 100644
--- a/rtic/examples/spawn.rs
+++ b/rtic/examples/spawn.rs
@@ -1,10 +1,10 @@
//! examples/spawn.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/spawn_arguments.rs b/rtic/examples/spawn_arguments.rs
index 01f1a654..5ca700fb 100644
--- a/rtic/examples/spawn_arguments.rs
+++ b/rtic/examples/spawn_arguments.rs
@@ -1,9 +1,10 @@
-//! examples/message_passing.rs
+//! examples/spawn_arguments.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/spawn_err.rs b/rtic/examples/spawn_err.rs
index ee9904ae..abe62953 100644
--- a/rtic/examples/spawn_err.rs
+++ b/rtic/examples/spawn_err.rs
@@ -1,10 +1,10 @@
-//! examples/spawn.rs
+//! examples/spawn_err.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/spawn_loop.rs b/rtic/examples/spawn_loop.rs
index c1ad04e3..9328a942 100644
--- a/rtic/examples/spawn_loop.rs
+++ b/rtic/examples/spawn_loop.rs
@@ -1,10 +1,10 @@
-//! examples/spawn.rs
+//! examples/spawn_loop.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/static.rs b/rtic/examples/static.rs
index 7f656f45..a98e2e5e 100644
--- a/rtic/examples/static.rs
+++ b/rtic/examples/static.rs
@@ -1,10 +1,10 @@
//! examples/static.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/t-binds.rs b/rtic/examples/t-binds.rs
index bdeb3917..01c262cf 100644
--- a/rtic/examples/t-binds.rs
+++ b/rtic/examples/t-binds.rs
@@ -1,10 +1,10 @@
//! [compile-pass] Check that `binds` works as advertised
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/t-cfg-resources.rs b/rtic/examples/t-cfg-resources.rs
index 03287009..2ddfae73 100644
--- a/rtic/examples/t-cfg-resources.rs
+++ b/rtic/examples/t-cfg-resources.rs
@@ -2,6 +2,8 @@
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/t-htask-main.rs b/rtic/examples/t-htask-main.rs
index 8f885bc1..61280f80 100644
--- a/rtic/examples/t-htask-main.rs
+++ b/rtic/examples/t-htask-main.rs
@@ -1,10 +1,10 @@
-//! examples/h-task-main.rs
+//! examples/t-task-main.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/t-idle-main.rs b/rtic/examples/t-idle-main.rs
index 43215cf7..88566a98 100644
--- a/rtic/examples/t-idle-main.rs
+++ b/rtic/examples/t-idle-main.rs
@@ -1,10 +1,10 @@
//! examples/t-idle-main.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
use panic_semihosting as _;
diff --git a/rtic/examples/t-late-not-send.rs b/rtic/examples/t-late-not-send.rs
index 44d1d855..be5cc66b 100644
--- a/rtic/examples/t-late-not-send.rs
+++ b/rtic/examples/t-late-not-send.rs
@@ -2,6 +2,8 @@
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
#![deny(missing_docs)]
use core::marker::PhantomData;
diff --git a/rtic/examples/t-schedule.no_rs b/rtic/examples/t-schedule.no_rs
deleted file mode 100644
index 5ec42087..00000000
--- a/rtic/examples/t-schedule.no_rs
+++ /dev/null
@@ -1,136 +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 {
- use cortex_m_semihosting::debug;
- use systick_monotonic::*;
-
- #[monotonic(binds = SysTick, default = true)]
- type MyMono = Systick<100>; // 100 Hz / 10 ms granularity
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(cx: init::Context) -> (Shared, Local, init::Monotonics) {
- let systick = cx.core.SYST;
-
- // Initialize the monotonic (SysTick rate in QEMU is 12 MHz)
- let mono = Systick::new(systick, 12_000_000);
-
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
-
- (Shared {}, Local {}, init::Monotonics(mono))
- }
-
- #[idle]
- fn idle(_: idle::Context) -> ! {
- // Task without message passing
-
- // Not default
- let _: Result<foo::MyMono::SpawnHandle, ()> =
- foo::MyMono::spawn_at(monotonics::MyMono::now());
- let handle: Result<foo::MyMono::SpawnHandle, ()> = foo::MyMono::spawn_after(1.secs());
- let _: Result<foo::MyMono::SpawnHandle, ()> = handle.unwrap().reschedule_after(1.secs());
-
- let handle: Result<foo::MyMono::SpawnHandle, ()> = foo::MyMono::spawn_after(1.secs());
- let _: Result<foo::MyMono::SpawnHandle, ()> =
- handle.unwrap().reschedule_at(monotonics::MyMono::now());
-
- let handle: Result<foo::MyMono::SpawnHandle, ()> = foo::MyMono::spawn_after(1.secs());
- let _: Result<(), ()> = handle.unwrap().cancel();
-
- // Using default
- let _: Result<foo::SpawnHandle, ()> = foo::spawn_at(monotonics::now());
- let handle: Result<foo::SpawnHandle, ()> = foo::spawn_after(1.secs());
- let _: Result<foo::SpawnHandle, ()> = handle.unwrap().reschedule_after(1.secs());
-
- let handle: Result<foo::SpawnHandle, ()> = foo::spawn_after(1.secs());
- let _: Result<foo::SpawnHandle, ()> =
- handle.unwrap().reschedule_at(monotonics::MyMono::now());
-
- let handle: Result<foo::SpawnHandle, ()> = foo::spawn_after(1.secs());
- let _: Result<(), ()> = handle.unwrap().cancel();
-
- // Task with single message passing
-
- // Not default
- let _: Result<bar::MyMono::SpawnHandle, u32> =
- bar::MyMono::spawn_at(monotonics::MyMono::now(), 0);
- let handle: Result<bar::MyMono::SpawnHandle, u32> = bar::MyMono::spawn_after(1.secs(), 1);
- let _: Result<bar::MyMono::SpawnHandle, ()> = handle.unwrap().reschedule_after(1.secs());
-
- let handle: Result<bar::MyMono::SpawnHandle, u32> = bar::MyMono::spawn_after(1.secs(), 1);
- let _: Result<bar::MyMono::SpawnHandle, ()> =
- handle.unwrap().reschedule_at(monotonics::MyMono::now());
-
- let handle: Result<bar::MyMono::SpawnHandle, u32> = bar::MyMono::spawn_after(1.secs(), 1);
- let _: Result<u32, ()> = handle.unwrap().cancel();
-
- // Using default
- let _: Result<bar::SpawnHandle, u32> = bar::spawn_at(monotonics::MyMono::now(), 0);
- let handle: Result<bar::SpawnHandle, u32> = bar::spawn_after(1.secs(), 1);
- let _: Result<bar::SpawnHandle, ()> = handle.unwrap().reschedule_after(1.secs());
-
- let handle: Result<bar::SpawnHandle, u32> = bar::spawn_after(1.secs(), 1);
- let _: Result<bar::SpawnHandle, ()> =
- handle.unwrap().reschedule_at(monotonics::MyMono::now());
-
- let handle: Result<bar::SpawnHandle, u32> = bar::spawn_after(1.secs(), 1);
- let _: Result<u32, ()> = handle.unwrap().cancel();
-
- // Task with multiple message passing
-
- // Not default
- let _: Result<baz::MyMono::SpawnHandle, (u32, u32)> =
- baz::MyMono::spawn_at(monotonics::MyMono::now(), 0, 1);
- let handle: Result<baz::MyMono::SpawnHandle, (u32, u32)> =
- baz::MyMono::spawn_after(1.secs(), 1, 2);
- let _: Result<baz::MyMono::SpawnHandle, ()> = handle.unwrap().reschedule_after(1.secs());
-
- let handle: Result<baz::MyMono::SpawnHandle, (u32, u32)> =
- baz::MyMono::spawn_after(1.secs(), 1, 2);
- let _: Result<baz::MyMono::SpawnHandle, ()> =
- handle.unwrap().reschedule_at(monotonics::MyMono::now());
-
- let handle: Result<baz::MyMono::SpawnHandle, (u32, u32)> =
- baz::MyMono::spawn_after(1.secs(), 1, 2);
- let _: Result<(u32, u32), ()> = handle.unwrap().cancel();
-
- // Using default
- let _: Result<baz::SpawnHandle, (u32, u32)> =
- baz::spawn_at(monotonics::MyMono::now(), 0, 1);
- let handle: Result<baz::SpawnHandle, (u32, u32)> = baz::spawn_after(1.secs(), 1, 2);
- let _: Result<baz::SpawnHandle, ()> = handle.unwrap().reschedule_after(1.secs());
-
- let handle: Result<baz::SpawnHandle, (u32, u32)> = baz::spawn_after(1.secs(), 1, 2);
- let _: Result<baz::SpawnHandle, ()> =
- handle.unwrap().reschedule_at(monotonics::MyMono::now());
-
- let handle: Result<baz::SpawnHandle, (u32, u32)> = baz::spawn_after(1.secs(), 1, 2);
- let _: Result<(u32, u32), ()> = handle.unwrap().cancel();
-
- loop {
- cortex_m::asm::nop();
- }
- }
-
- #[task]
- fn foo(_: foo::Context) {}
-
- #[task]
- fn bar(_: bar::Context, _x: u32) {}
-
- #[task]
- fn baz(_: baz::Context, _x: u32, _y: u32) {}
-}
diff --git a/rtic/examples/t-spawn.no_rs b/rtic/examples/t-spawn.no_rs
deleted file mode 100644
index dad0c83a..00000000
--- a/rtic/examples/t-spawn.no_rs
+++ /dev/null
@@ -1,69 +0,0 @@
-//! [compile-pass] Check code generation of `spawn`
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-#![feature(type_alias_impl_trait)]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::debug;
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local) {
- let _: Result<(), ()> = foo::spawn();
- let _: Result<(), u32> = bar::spawn(0);
- let _: Result<(), (u32, u32)> = baz::spawn(0, 1);
-
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
-
- (Shared {}, Local {})
- }
-
- #[idle]
- fn idle(_: idle::Context) -> ! {
- let _: Result<(), ()> = foo::spawn();
- let _: Result<(), u32> = bar::spawn(0);
- let _: Result<(), (u32, u32)> = baz::spawn(0, 1);
-
- loop {
- cortex_m::asm::nop();
- }
- }
-
- #[task(binds = SVCall)]
- fn svcall(_: svcall::Context) {
- let _: Result<(), ()> = foo::spawn();
- let _: Result<(), u32> = bar::spawn(0);
- let _: Result<(), (u32, u32)> = baz::spawn(0, 1);
- }
-
- #[task(binds = UART0)]
- fn uart0(_: uart0::Context) {
- let _: Result<(), ()> = foo::spawn();
- let _: Result<(), u32> = bar::spawn(0);
- let _: Result<(), (u32, u32)> = baz::spawn(0, 1);
- }
-
- #[task]
- async fn foo(_: foo::Context) {
- let _: Result<(), ()> = foo::spawn();
- let _: Result<(), u32> = bar::spawn(0);
- let _: Result<(), (u32, u32)> = baz::spawn(0, 1);
- }
-
- #[task]
- async fn bar(_: bar::Context, _x: u32) {}
-
- #[task]
- async fn baz(_: baz::Context, _x: u32, _y: u32) {}
-}
diff --git a/rtic/examples/task.rs b/rtic/examples/task.rs
index ab6a1e0e..9b06bb49 100644
--- a/rtic/examples/task.rs
+++ b/rtic/examples/task.rs
@@ -1,10 +1,10 @@
//! examples/task.rs
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![deny(missing_docs)]
#![no_main]
#![no_std]
+#![deny(warnings)]
+#![deny(unsafe_code)]
+#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use panic_semihosting as _;
diff --git a/rtic/examples/zero-prio-task.rs b/rtic/examples/zero-prio-task.rs
index c810e8fa..dbe1959e 100644
--- a/rtic/examples/zero-prio-task.rs
+++ b/rtic/examples/zero-prio-task.rs
@@ -2,8 +2,10 @@
#![no_main]
#![no_std]
-#![feature(type_alias_impl_trait)]
+#![deny(warnings)]
+#![deny(unsafe_code)]
#![deny(missing_docs)]
+#![feature(type_alias_impl_trait)]
use core::marker::PhantomData;
use panic_semihosting as _;
diff --git a/rtic/examples/zero-prio-task_err.no_rs b/rtic/examples/zero-prio-task_err.no_rs
deleted file mode 100644
index ab67d82e..00000000
--- a/rtic/examples/zero-prio-task_err.no_rs
+++ /dev/null
@@ -1,66 +0,0 @@
-//! examples/zero-prio-task.rs
-
-#![no_main]
-#![no_std]
-#![feature(type_alias_impl_trait)]
-#![deny(missing_docs)]
-
-use core::marker::PhantomData;
-use panic_semihosting as _;
-
-/// Does not impl send
-pub struct NotSend {
- _0: PhantomData<*const ()>,
-}
-
-#[rtic::app(device = lm3s6965, peripherals = true)]
-mod app {
- use super::NotSend;
- use core::marker::PhantomData;
- use cortex_m_semihosting::{debug, hprintln};
-
- #[shared]
- struct Shared {
- x: NotSend,
- }
-
- #[local]
- struct Local {
- y: NotSend,
- }
-
- #[init]
- fn init(_cx: init::Context) -> (Shared, Local) {
- hprintln!("init");
-
- async_task::spawn().unwrap();
- async_task2::spawn().unwrap();
-
- (
- Shared {
- x: NotSend { _0: PhantomData },
- },
- Local {
- y: NotSend { _0: PhantomData },
- },
- )
- }
-
- #[task(priority = 0, shared = [x], local = [y])]
- async fn async_task(_: async_task::Context) {
- hprintln!("hello from async");
- }
-
- #[task(priority = 0, shared = [x])]
- async fn async_task2(_: async_task2::Context) {
- hprintln!("hello from async2");
- }
-
- #[idle(shared = [x])]
- fn idle(_: idle::Context) -> ! {
- hprintln!("hello from idle");
-
- debug::exit(debug::EXIT_SUCCESS); // Exit QEMU simulator
- loop {}
- }
-}