aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/baseline.rs4
-rw-r--r--examples/binds.rs4
-rw-r--r--examples/capacity.rs4
-rw-r--r--examples/cfg.rs4
-rw-r--r--examples/destructure.rs4
-rw-r--r--examples/generics.rs4
-rw-r--r--examples/hardware.rs4
-rw-r--r--examples/idle.rs4
-rw-r--r--examples/init.rs4
-rw-r--r--examples/late.rs4
-rw-r--r--examples/lock.rs4
-rw-r--r--examples/message.rs4
-rw-r--r--examples/not-send.rs4
-rw-r--r--examples/not-sync.rs4
-rw-r--r--examples/only-shared-access.rs4
-rw-r--r--examples/periodic.rs4
-rw-r--r--examples/peripherals-taken.rs4
-rw-r--r--examples/pool.rs4
-rw-r--r--examples/preempt.rs4
-rw-r--r--examples/ramfunc.rs4
-rw-r--r--examples/resource.rs4
-rw-r--r--examples/schedule.rs4
-rw-r--r--examples/shared-with-init.rs4
-rw-r--r--examples/smallest.rs2
-rw-r--r--examples/t-binds.rs4
-rw-r--r--examples/t-cfg-resources.rs9
-rw-r--r--examples/t-cfg.rs4
-rw-r--r--examples/t-htask-main.rs4
-rw-r--r--examples/t-idle-main.rs4
-rw-r--r--examples/t-init-main.rs4
-rw-r--r--examples/t-late-not-send.rs4
-rw-r--r--examples/t-resource.rs4
-rw-r--r--examples/t-schedule.rs4
-rw-r--r--examples/t-spawn.rs4
-rw-r--r--examples/t-stask-main.rs4
-rw-r--r--examples/task.rs4
-rw-r--r--examples/types.rs4
37 files changed, 75 insertions, 76 deletions
diff --git a/examples/baseline.rs b/examples/baseline.rs
index f46b273d..2d75dfaa 100644
--- a/examples/baseline.rs
+++ b/examples/baseline.rs
@@ -11,7 +11,7 @@ use panic_semihosting as _;
// NOTE: does NOT properly work on QEMU
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
-const APP: () = {
+mod APP {
#[init(spawn = [foo])]
fn init(cx: init::Context) {
// omitted: initialization of `CYCCNT`
@@ -51,4 +51,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}
diff --git a/examples/binds.rs b/examples/binds.rs
index 82bf8964..920124cf 100644
--- a/examples/binds.rs
+++ b/examples/binds.rs
@@ -11,7 +11,7 @@ use panic_semihosting as _;
// `examples/interrupt.rs` rewritten to use `binds`
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn init(_: init::Context) {
rtic::pend(Interrupt::UART0);
@@ -45,4 +45,4 @@ const APP: () = {
)
.unwrap();
}
-};
+}
diff --git a/examples/capacity.rs b/examples/capacity.rs
index 00cec344..26c61a25 100644
--- a/examples/capacity.rs
+++ b/examples/capacity.rs
@@ -10,7 +10,7 @@ use lm3s6965::Interrupt;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn init(_: init::Context) {
rtic::pend(Interrupt::UART0);
@@ -44,4 +44,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}
diff --git a/examples/cfg.rs b/examples/cfg.rs
index 8eeeb2a9..626181de 100644
--- a/examples/cfg.rs
+++ b/examples/cfg.rs
@@ -11,7 +11,7 @@ use cortex_m_semihosting::hprintln;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
#[cfg(debug_assertions)] // <- `true` when using the `dev` profile
#[init(0)]
@@ -66,4 +66,4 @@ const APP: () = {
fn SSI0();
fn QEI0();
}
-};
+}
diff --git a/examples/destructure.rs b/examples/destructure.rs
index 1756bd9e..da0a4c1d 100644
--- a/examples/destructure.rs
+++ b/examples/destructure.rs
@@ -10,7 +10,7 @@ use lm3s6965::Interrupt;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
// Some resources to work with
#[init(0)]
@@ -44,4 +44,4 @@ const APP: () = {
hprintln!("UART0: a = {}, b = {}, c = {}", a, b, c).unwrap();
}
-};
+}
diff --git a/examples/generics.rs b/examples/generics.rs
index 40ab81ac..b67ed9ca 100644
--- a/examples/generics.rs
+++ b/examples/generics.rs
@@ -11,7 +11,7 @@ use panic_semihosting as _;
use rtic::{Exclusive, Mutex};
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
#[init(0)]
shared: u32,
@@ -49,7 +49,7 @@ const APP: () = {
// second argument has type `Exclusive<u32>`
advance(STATE, Exclusive(c.resources.shared));
}
-};
+}
// the second parameter is generic: it can be any type that implements the `Mutex` trait
fn advance(state: &mut u32, mut shared: impl Mutex<T = u32>) {
diff --git a/examples/hardware.rs b/examples/hardware.rs
index 8105a742..7926650c 100644
--- a/examples/hardware.rs
+++ b/examples/hardware.rs
@@ -10,7 +10,7 @@ use lm3s6965::Interrupt;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn init(_: init::Context) {
// Pends the UART0 interrupt but its handler won't run until *after*
@@ -49,4 +49,4 @@ const APP: () = {
)
.unwrap();
}
-};
+}
diff --git a/examples/idle.rs b/examples/idle.rs
index 3d28dac8..dbf7f983 100644
--- a/examples/idle.rs
+++ b/examples/idle.rs
@@ -9,7 +9,7 @@ use cortex_m_semihosting::{debug, hprintln};
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn init(_: init::Context) {
hprintln!("init").unwrap();
@@ -30,4 +30,4 @@ const APP: () = {
cortex_m::asm::nop();
}
}
-};
+}
diff --git a/examples/init.rs b/examples/init.rs
index 315969f0..c651136e 100644
--- a/examples/init.rs
+++ b/examples/init.rs
@@ -9,7 +9,7 @@ use cortex_m_semihosting::{debug, hprintln};
use panic_semihosting as _;
#[rtic::app(device = lm3s6965, peripherals = true)]
-const APP: () = {
+mod APP {
#[init]
fn init(cx: init::Context) {
static mut X: u32 = 0;
@@ -27,4 +27,4 @@ const APP: () = {
debug::exit(debug::EXIT_SUCCESS);
}
-};
+}
diff --git a/examples/late.rs b/examples/late.rs
index 60b9be00..8675c6ac 100644
--- a/examples/late.rs
+++ b/examples/late.rs
@@ -15,7 +15,7 @@ use lm3s6965::Interrupt;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
// Late resources
struct Resources {
p: Producer<'static, u32, U4>,
@@ -49,4 +49,4 @@ const APP: () = {
fn uart0(c: uart0::Context) {
c.resources.p.enqueue(42).unwrap();
}
-};
+}
diff --git a/examples/lock.rs b/examples/lock.rs
index 5e3bce25..4b16679e 100644
--- a/examples/lock.rs
+++ b/examples/lock.rs
@@ -10,7 +10,7 @@ use lm3s6965::Interrupt;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
#[init(0)]
shared: u32,
@@ -59,4 +59,4 @@ const APP: () = {
fn gpioc(_: gpioc::Context) {
hprintln!("C").unwrap();
}
-};
+}
diff --git a/examples/message.rs b/examples/message.rs
index 596f2449..3e9633bd 100644
--- a/examples/message.rs
+++ b/examples/message.rs
@@ -9,7 +9,7 @@ use cortex_m_semihosting::{debug, hprintln};
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init(spawn = [foo])]
fn init(c: init::Context) {
c.spawn.foo(/* no message */).unwrap();
@@ -49,4 +49,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}
diff --git a/examples/not-send.rs b/examples/not-send.rs
index 16a874dc..bcc049c3 100644
--- a/examples/not-send.rs
+++ b/examples/not-send.rs
@@ -16,7 +16,7 @@ pub struct NotSend {
}
#[app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
#[init(None)]
shared: Option<NotSend>,
@@ -60,4 +60,4 @@ const APP: () = {
fn SSI0();
fn QEI0();
}
-};
+}
diff --git a/examples/not-sync.rs b/examples/not-sync.rs
index a7eaac8e..0354ef10 100644
--- a/examples/not-sync.rs
+++ b/examples/not-sync.rs
@@ -15,7 +15,7 @@ pub struct NotSync {
}
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
#[init(NotSync { _0: PhantomData })]
shared: NotSync,
@@ -42,4 +42,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}
diff --git a/examples/only-shared-access.rs b/examples/only-shared-access.rs
index c022b037..fbc7bfd4 100644
--- a/examples/only-shared-access.rs
+++ b/examples/only-shared-access.rs
@@ -10,7 +10,7 @@ use lm3s6965::Interrupt;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
key: u32,
}
@@ -35,4 +35,4 @@ const APP: () = {
fn uart1(cx: uart1::Context) {
hprintln!("UART1(key = {:#x})", cx.resources.key).unwrap();
}
-};
+}
diff --git a/examples/periodic.rs b/examples/periodic.rs
index 405346e3..cd887ca5 100644
--- a/examples/periodic.rs
+++ b/examples/periodic.rs
@@ -13,7 +13,7 @@ const PERIOD: u32 = 8_000_000;
// NOTE: does NOT work on QEMU!
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
-const APP: () = {
+mod APP {
#[init(schedule = [foo])]
fn init(cx: init::Context) {
// omitted: initialization of `CYCCNT`
@@ -35,4 +35,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}
diff --git a/examples/peripherals-taken.rs b/examples/peripherals-taken.rs
index cd4ba0f0..a1bd6868 100644
--- a/examples/peripherals-taken.rs
+++ b/examples/peripherals-taken.rs
@@ -7,10 +7,10 @@ use cortex_m_semihosting::debug;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn main(_: main::Context) {
assert!(cortex_m::Peripherals::take().is_none());
debug::exit(debug::EXIT_SUCCESS);
}
-};
+}
diff --git a/examples/pool.rs b/examples/pool.rs
index 824d5bd8..eb65ed82 100644
--- a/examples/pool.rs
+++ b/examples/pool.rs
@@ -18,7 +18,7 @@ use rtic::app;
pool!(P: [u8; 128]);
#[app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn init(_: init::Context) {
static mut MEMORY: [u8; 512] = [0; 512];
@@ -66,4 +66,4 @@ const APP: () = {
fn SSI0();
fn QEI0();
}
-};
+}
diff --git a/examples/preempt.rs b/examples/preempt.rs
index 3cb11029..a20b36cc 100644
--- a/examples/preempt.rs
+++ b/examples/preempt.rs
@@ -9,7 +9,7 @@ use panic_semihosting as _;
use rtic::app;
#[app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn init(_: init::Context) {
rtic::pend(Interrupt::GPIOA);
@@ -34,4 +34,4 @@ const APP: () = {
rtic::pend(Interrupt::GPIOB);
hprintln!(" GPIOC - end").unwrap();
}
-};
+}
diff --git a/examples/ramfunc.rs b/examples/ramfunc.rs
index 1f95d496..cfe22e39 100644
--- a/examples/ramfunc.rs
+++ b/examples/ramfunc.rs
@@ -9,7 +9,7 @@ use cortex_m_semihosting::{debug, hprintln};
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init(spawn = [bar])]
fn init(c: init::Context) {
c.spawn.bar().unwrap();
@@ -38,4 +38,4 @@ const APP: () = {
#[link_section = ".data.UART1"]
fn UART1();
}
-};
+}
diff --git a/examples/resource.rs b/examples/resource.rs
index 2361fd00..a0954d60 100644
--- a/examples/resource.rs
+++ b/examples/resource.rs
@@ -10,7 +10,7 @@ use lm3s6965::Interrupt;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
// A resource
#[init(0)]
@@ -52,4 +52,4 @@ const APP: () = {
hprintln!("UART1: shared = {}", cx.resources.shared).unwrap();
}
-};
+}
diff --git a/examples/schedule.rs b/examples/schedule.rs
index 70a7a5e3..f2e7ed88 100644
--- a/examples/schedule.rs
+++ b/examples/schedule.rs
@@ -12,7 +12,7 @@ use rtic::cyccnt::{Instant, U32Ext as _};
// NOTE: does NOT work on QEMU!
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
-const APP: () = {
+mod APP {
#[init(schedule = [foo, bar])]
fn init(mut cx: init::Context) {
// Initialize (enable) the monotonic timer (CYCCNT)
@@ -50,4 +50,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}
diff --git a/examples/shared-with-init.rs b/examples/shared-with-init.rs
index bd55f7ef..03391bdd 100644
--- a/examples/shared-with-init.rs
+++ b/examples/shared-with-init.rs
@@ -13,7 +13,7 @@ use rtic::app;
pub struct MustBeSend;
#[app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
#[init(None)]
shared: Option<MustBeSend>,
@@ -37,4 +37,4 @@ const APP: () = {
debug::exit(debug::EXIT_SUCCESS);
}
}
-};
+}
diff --git a/examples/smallest.rs b/examples/smallest.rs
index ec3fa970..d6f3b66c 100644
--- a/examples/smallest.rs
+++ b/examples/smallest.rs
@@ -7,4 +7,4 @@ use panic_semihosting as _; // panic handler
use rtic::app;
#[app(device = lm3s6965)]
-const APP: () = {};
+mod APP {}
diff --git a/examples/t-binds.rs b/examples/t-binds.rs
index 588ac46f..8634c759 100644
--- a/examples/t-binds.rs
+++ b/examples/t-binds.rs
@@ -8,7 +8,7 @@
use panic_halt as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn init(_: init::Context) {}
@@ -23,7 +23,7 @@ const APP: () = {
fn bar(c: bar::Context) {
bar_trampoline(c)
}
-};
+}
#[allow(dead_code)]
fn foo_trampoline(_: foo::Context) {}
diff --git a/examples/t-cfg-resources.rs b/examples/t-cfg-resources.rs
index 4f7fd635..892d2114 100644
--- a/examples/t-cfg-resources.rs
+++ b/examples/t-cfg-resources.rs
@@ -6,7 +6,7 @@
use panic_halt as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
// A resource
#[init(0)]
@@ -15,8 +15,7 @@ const APP: () = {
// A conditionally compiled resource behind feature_x
#[cfg(feature = "feature_x")]
x: u32,
-
- dummy: (),
+ dummy: (), // dummy such that we have at least one late resource
}
#[init]
@@ -25,7 +24,7 @@ const APP: () = {
// The feature needs to be applied everywhere x is defined or used
#[cfg(feature = "feature_x")]
x: 0,
- dummy: (), // dummy such that we have at least one late resource
+ dummy: () // dummy such that we have at least one late resource
}
}
@@ -35,4 +34,4 @@ const APP: () = {
cortex_m::asm::nop();
}
}
-};
+}
diff --git a/examples/t-cfg.rs b/examples/t-cfg.rs
index b6c9e472..da9a4910 100644
--- a/examples/t-cfg.rs
+++ b/examples/t-cfg.rs
@@ -6,7 +6,7 @@
use panic_halt as _;
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
-const APP: () = {
+mod APP {
struct Resources {
#[cfg(never)]
#[init(0)]
@@ -52,4 +52,4 @@ const APP: () = {
fn SSI0();
fn QEI0();
}
-};
+}
diff --git a/examples/t-htask-main.rs b/examples/t-htask-main.rs
index c4bebf94..6143bbd7 100644
--- a/examples/t-htask-main.rs
+++ b/examples/t-htask-main.rs
@@ -7,7 +7,7 @@ use cortex_m_semihosting::debug;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn init(_: init::Context) {
rtic::pend(lm3s6965::Interrupt::UART0)
@@ -17,4 +17,4 @@ const APP: () = {
fn main(_: main::Context) {
debug::exit(debug::EXIT_SUCCESS);
}
-};
+}
diff --git a/examples/t-idle-main.rs b/examples/t-idle-main.rs
index 051a9ee8..89f93d0a 100644
--- a/examples/t-idle-main.rs
+++ b/examples/t-idle-main.rs
@@ -7,7 +7,7 @@ use cortex_m_semihosting::debug;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn init(_: init::Context) {}
@@ -18,4 +18,4 @@ const APP: () = {
cortex_m::asm::nop();
}
}
-};
+}
diff --git a/examples/t-init-main.rs b/examples/t-init-main.rs
index 6a6cd991..040c72fa 100644
--- a/examples/t-init-main.rs
+++ b/examples/t-init-main.rs
@@ -7,9 +7,9 @@ use cortex_m_semihosting::debug;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init]
fn main(_: main::Context) {
debug::exit(debug::EXIT_SUCCESS);
}
-};
+}
diff --git a/examples/t-late-not-send.rs b/examples/t-late-not-send.rs
index d2a9b63c..77990182 100644
--- a/examples/t-late-not-send.rs
+++ b/examples/t-late-not-send.rs
@@ -12,7 +12,7 @@ pub struct NotSend {
}
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
x: NotSend,
#[init(None)]
@@ -35,4 +35,4 @@ const APP: () = {
cortex_m::asm::nop();
}
}
-};
+}
diff --git a/examples/t-resource.rs b/examples/t-resource.rs
index 81ba1856..0864a8ab 100644
--- a/examples/t-resource.rs
+++ b/examples/t-resource.rs
@@ -8,7 +8,7 @@
use panic_halt as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
struct Resources {
#[init(0)]
o1: u32, // init
@@ -86,4 +86,4 @@ const APP: () = {
// no `Mutex` proxy when co-owned by cooperative (same priority) tasks
let _: &mut u32 = c.resources.s2;
}
-};
+}
diff --git a/examples/t-schedule.rs b/examples/t-schedule.rs
index 3854aad3..67536133 100644
--- a/examples/t-schedule.rs
+++ b/examples/t-schedule.rs
@@ -9,7 +9,7 @@ use panic_halt as _;
use rtic::cyccnt::{Instant, U32Ext as _};
#[rtic::app(device = lm3s6965, monotonic = rtic::cyccnt::CYCCNT)]
-const APP: () = {
+mod APP {
#[init(schedule = [foo, bar, baz])]
fn init(c: init::Context) {
let _: Result<(), ()> = c.schedule.foo(c.start + 10.cycles());
@@ -61,4 +61,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}
diff --git a/examples/t-spawn.rs b/examples/t-spawn.rs
index 35831ccf..7a64e1cc 100644
--- a/examples/t-spawn.rs
+++ b/examples/t-spawn.rs
@@ -8,7 +8,7 @@
use panic_halt as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init(spawn = [foo, bar, baz])]
fn init(c: init::Context) {
let _: Result<(), ()> = c.spawn.foo();
@@ -60,4 +60,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}
diff --git a/examples/t-stask-main.rs b/examples/t-stask-main.rs
index f2709404..edea4309 100644
--- a/examples/t-stask-main.rs
+++ b/examples/t-stask-main.rs
@@ -7,7 +7,7 @@ use cortex_m_semihosting::debug;
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init(spawn = [main])]
fn init(cx: init::Context) {
cx.spawn.main().ok();
@@ -24,4 +24,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}
diff --git a/examples/task.rs b/examples/task.rs
index 12c4ac83..e515c936 100644
--- a/examples/task.rs
+++ b/examples/task.rs
@@ -9,7 +9,7 @@ use cortex_m_semihosting::{debug, hprintln};
use panic_semihosting as _;
#[rtic::app(device = lm3s6965)]
-const APP: () = {
+mod APP {
#[init(spawn = [foo])]
fn init(c: init::Context) {
c.spawn.foo().unwrap();
@@ -52,4 +52,4 @@ const APP: () = {
fn SSI0();
fn QEI0();
}
-};
+}
diff --git a/examples/types.rs b/examples/types.rs
index 5233f868..eafc9b1d 100644
--- a/examples/types.rs
+++ b/examples/types.rs
@@ -10,7 +10,7 @@ use panic_semihosting as _;
use rtic::cyccnt;
#[rtic::app(device = lm3s6965, peripherals = true, monotonic = rtic::cyccnt::CYCCNT)]
-const APP: () = {
+mod APP {
struct Resources {
#[init(0)]
shared: u32,
@@ -60,4 +60,4 @@ const APP: () = {
extern "C" {
fn SSI0();
}
-};
+}