From 81275bfa4f41e2066770087f3a33cad4227eab41 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 13 Jun 2019 23:56:59 +0200 Subject: rtfm-syntax refactor + heterogeneous multi-core support --- ui/single/exception-invalid.rs | 7 ++ ui/single/exception-invalid.stderr | 8 ++ ui/single/exception-systick-used.rs | 10 +++ ui/single/exception-systick-used.stderr | 8 ++ ui/single/extern-interrupt-not-enough.rs | 7 ++ ui/single/extern-interrupt-not-enough.stderr | 8 ++ ui/single/extern-interrupt-used.rs | 11 +++ ui/single/extern-interrupt-used.stderr | 8 ++ ui/single/locals-cfg.rs | 50 +++++++++++ ui/single/locals-cfg.stderr | 33 +++++++ ui/single/resources-cfg.rs | 57 +++++++++++++ ui/single/resources-cfg.stderr | 123 +++++++++++++++++++++++++++ ui/single/task-priority-too-high.rs | 38 +++++++++ ui/single/task-priority-too-high.stderr | 9 ++ 14 files changed, 377 insertions(+) create mode 100644 ui/single/exception-invalid.rs create mode 100644 ui/single/exception-invalid.stderr create mode 100644 ui/single/exception-systick-used.rs create mode 100644 ui/single/exception-systick-used.stderr create mode 100644 ui/single/extern-interrupt-not-enough.rs create mode 100644 ui/single/extern-interrupt-not-enough.stderr create mode 100644 ui/single/extern-interrupt-used.rs create mode 100644 ui/single/extern-interrupt-used.stderr create mode 100644 ui/single/locals-cfg.rs create mode 100644 ui/single/locals-cfg.stderr create mode 100644 ui/single/resources-cfg.rs create mode 100644 ui/single/resources-cfg.stderr create mode 100644 ui/single/task-priority-too-high.rs create mode 100644 ui/single/task-priority-too-high.stderr (limited to 'ui/single') diff --git a/ui/single/exception-invalid.rs b/ui/single/exception-invalid.rs new file mode 100644 index 0000000..426cb67 --- /dev/null +++ b/ui/single/exception-invalid.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtfm::app(device = lm3s6965)] +const APP: () = { + #[exception] + fn NonMaskableInt(_: NonMaskableInt::Context) {} +}; diff --git a/ui/single/exception-invalid.stderr b/ui/single/exception-invalid.stderr new file mode 100644 index 0000000..f7fc292 --- /dev/null +++ b/ui/single/exception-invalid.stderr @@ -0,0 +1,8 @@ +error: only exceptions with configurable priority can be used as hardware tasks + --> $DIR/exception-invalid.rs:6:8 + | +6 | fn NonMaskableInt(_: NonMaskableInt::Context) {} + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/ui/single/exception-systick-used.rs b/ui/single/exception-systick-used.rs new file mode 100644 index 0000000..d30da1b --- /dev/null +++ b/ui/single/exception-systick-used.rs @@ -0,0 +1,10 @@ +#![no_main] + +#[rtfm::app(device = lm3s6965)] +const APP: () = { + #[exception] + fn SysTick(_: SysTick::Context) {} + + #[task(schedule = [foo])] + fn foo(_: foo::Context) {} +}; diff --git a/ui/single/exception-systick-used.stderr b/ui/single/exception-systick-used.stderr new file mode 100644 index 0000000..47786c6 --- /dev/null +++ b/ui/single/exception-systick-used.stderr @@ -0,0 +1,8 @@ +error: this exception can't be used because it's being used by the runtime + --> $DIR/exception-systick-used.rs:6:8 + | +6 | fn SysTick(_: SysTick::Context) {} + | ^^^^^^^ + +error: aborting due to previous error + diff --git a/ui/single/extern-interrupt-not-enough.rs b/ui/single/extern-interrupt-not-enough.rs new file mode 100644 index 0000000..39c5d8e --- /dev/null +++ b/ui/single/extern-interrupt-not-enough.rs @@ -0,0 +1,7 @@ +#![no_main] + +#[rtfm::app(device = lm3s6965)] +const APP: () = { + #[task] + fn a(_: a::Context) {} +}; diff --git a/ui/single/extern-interrupt-not-enough.stderr b/ui/single/extern-interrupt-not-enough.stderr new file mode 100644 index 0000000..43249c4 --- /dev/null +++ b/ui/single/extern-interrupt-not-enough.stderr @@ -0,0 +1,8 @@ +error: not enough `extern` interrupts to dispatch all software tasks (need: 1; given: 0) + --> $DIR/extern-interrupt-not-enough.rs:6:8 + | +6 | fn a(_: a::Context) {} + | ^ + +error: aborting due to previous error + diff --git a/ui/single/extern-interrupt-used.rs b/ui/single/extern-interrupt-used.rs new file mode 100644 index 0000000..25f34b3 --- /dev/null +++ b/ui/single/extern-interrupt-used.rs @@ -0,0 +1,11 @@ +#![no_main] + +#[rtfm::app(device = lm3s6965)] +const APP: () = { + #[interrupt(binds = UART0)] + fn a(_: a::Context) {} + + extern "C" { + fn UART0(); + } +}; diff --git a/ui/single/extern-interrupt-used.stderr b/ui/single/extern-interrupt-used.stderr new file mode 100644 index 0000000..8707b1d --- /dev/null +++ b/ui/single/extern-interrupt-used.stderr @@ -0,0 +1,8 @@ +error: `extern` interrupts can't be used as hardware tasks + --> $DIR/extern-interrupt-used.rs:5:25 + | +5 | #[interrupt(binds = UART0)] + | ^^^^^ + +error: aborting due to previous error + diff --git a/ui/single/locals-cfg.rs b/ui/single/locals-cfg.rs new file mode 100644 index 0000000..bcce5ca --- /dev/null +++ b/ui/single/locals-cfg.rs @@ -0,0 +1,50 @@ +#![no_main] + +#[rtfm::app(device = lm3s6965)] +const APP: () = { + #[init] + fn init(_: init::Context) { + #[cfg(never)] + static mut FOO: u32 = 0; + + FOO; + } + + #[idle] + fn idle(_: idle::Context) -> ! { + #[cfg(never)] + static mut FOO: u32 = 0; + + FOO; + + loop {} + } + + #[exception] + fn SVCall(_: SVCall::Context) { + #[cfg(never)] + static mut FOO: u32 = 0; + + FOO; + } + + #[interrupt] + fn UART0(_: UART0::Context) { + #[cfg(never)] + static mut FOO: u32 = 0; + + FOO; + } + + #[task] + fn foo(_: foo::Context) { + #[cfg(never)] + static mut FOO: u32 = 0; + + FOO; + } + + extern "C" { + fn UART1(); + } +}; diff --git a/ui/single/locals-cfg.stderr b/ui/single/locals-cfg.stderr new file mode 100644 index 0000000..fc324f1 --- /dev/null +++ b/ui/single/locals-cfg.stderr @@ -0,0 +1,33 @@ +error[E0425]: cannot find value `FOO` in this scope + --> $DIR/locals-cfg.rs:10:9 + | +10 | FOO; + | ^^^ not found in this scope + +error[E0425]: cannot find value `FOO` in this scope + --> $DIR/locals-cfg.rs:18:9 + | +18 | FOO; + | ^^^ not found in this scope + +error[E0425]: cannot find value `FOO` in this scope + --> $DIR/locals-cfg.rs:28:9 + | +28 | FOO; + | ^^^ not found in this scope + +error[E0425]: cannot find value `FOO` in this scope + --> $DIR/locals-cfg.rs:36:9 + | +36 | FOO; + | ^^^ not found in this scope + +error[E0425]: cannot find value `FOO` in this scope + --> $DIR/locals-cfg.rs:44:9 + | +44 | FOO; + | ^^^ not found in this scope + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/ui/single/resources-cfg.rs b/ui/single/resources-cfg.rs new file mode 100644 index 0000000..f8c3672 --- /dev/null +++ b/ui/single/resources-cfg.rs @@ -0,0 +1,57 @@ +#![no_main] + +#[rtfm::app(device = lm3s6965)] +const APP: () = { + #[cfg(never)] + static mut O1: u32 = 0; // init + #[cfg(never)] + static mut O2: u32 = 0; // idle + #[cfg(never)] + static mut O3: u32 = 0; // EXTI0 + #[cfg(never)] + static O4: u32 = 0; // idle + #[cfg(never)] + static O5: u32 = 0; // EXTI1 + #[cfg(never)] + static O6: u32 = 0; // init + + #[cfg(never)] + static mut S1: u32 = 0; // idle & EXTI0 + #[cfg(never)] + static mut S2: u32 = 0; // EXTI0 & EXTI1 + #[cfg(never)] + static S3: u32 = 0; + + #[init(resources = [O1, O4, O5, O6, S3])] + fn init(c: init::Context) { + c.resources.O1; + c.resources.O4; + c.resources.O5; + c.resources.O6; + c.resources.S3; + } + + #[idle(resources = [O2, O4, S1, S3])] + fn idle(c: idle::Context) -> ! { + c.resources.O2; + c.resources.O4; + c.resources.S1; + c.resources.S3; + + loop {} + } + + #[interrupt(resources = [O3, S1, S2, S3])] + fn UART0(c: UART0::Context) { + c.resources.O3; + c.resources.S1; + c.resources.S2; + c.resources.S3; + } + + #[interrupt(resources = [S2, O5])] + fn UART1(c: UART1::Context) { + c.resources.S2; + c.resources.O5; + } +}; diff --git a/ui/single/resources-cfg.stderr b/ui/single/resources-cfg.stderr new file mode 100644 index 0000000..88c34d2 --- /dev/null +++ b/ui/single/resources-cfg.stderr @@ -0,0 +1,123 @@ +error[E0609]: no field `O1` on type `initResources<'_>` + --> $DIR/resources-cfg.rs:27:21 + | +27 | c.resources.O1; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `O4` on type `initResources<'_>` + --> $DIR/resources-cfg.rs:28:21 + | +28 | c.resources.O4; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `O5` on type `initResources<'_>` + --> $DIR/resources-cfg.rs:29:21 + | +29 | c.resources.O5; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `O6` on type `initResources<'_>` + --> $DIR/resources-cfg.rs:30:21 + | +30 | c.resources.O6; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `S3` on type `initResources<'_>` + --> $DIR/resources-cfg.rs:31:21 + | +31 | c.resources.S3; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `O2` on type `idleResources<'_>` + --> $DIR/resources-cfg.rs:36:21 + | +36 | c.resources.O2; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `O4` on type `idleResources<'_>` + --> $DIR/resources-cfg.rs:37:21 + | +37 | c.resources.O4; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `S1` on type `idleResources<'_>` + --> $DIR/resources-cfg.rs:38:21 + | +38 | c.resources.S1; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `S3` on type `idleResources<'_>` + --> $DIR/resources-cfg.rs:39:21 + | +39 | c.resources.S3; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `O3` on type `UART0Resources<'_>` + --> $DIR/resources-cfg.rs:46:21 + | +46 | c.resources.O3; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `S1` on type `UART0Resources<'_>` + --> $DIR/resources-cfg.rs:47:21 + | +47 | c.resources.S1; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `S2` on type `UART0Resources<'_>` + --> $DIR/resources-cfg.rs:48:21 + | +48 | c.resources.S2; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `S3` on type `UART0Resources<'_>` + --> $DIR/resources-cfg.rs:49:21 + | +49 | c.resources.S3; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `S2` on type `UART1Resources<'_>` + --> $DIR/resources-cfg.rs:54:21 + | +54 | c.resources.S2; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error[E0609]: no field `O5` on type `UART1Resources<'_>` + --> $DIR/resources-cfg.rs:55:21 + | +55 | c.resources.O5; + | ^^ unknown field + | + = note: available fields are: `__marker__` + +error: aborting due to 15 previous errors + +For more information about this error, try `rustc --explain E0609`. diff --git a/ui/single/task-priority-too-high.rs b/ui/single/task-priority-too-high.rs new file mode 100644 index 0000000..c7c9dc9 --- /dev/null +++ b/ui/single/task-priority-too-high.rs @@ -0,0 +1,38 @@ +#![no_main] + +use rtfm::app; + +#[rtfm::app(device = lm3s6965)] +const APP: () = { + #[init] + fn init(_: init::Context) {} + + #[interrupt(priority = 1)] + fn GPIOA(_: GPIOA::Context) {} + + #[interrupt(priority = 2)] + fn GPIOB(_: GPIOB::Context) {} + + #[interrupt(priority = 3)] + fn GPIOC(_: GPIOC::Context) {} + + #[interrupt(priority = 4)] + fn GPIOD(_: GPIOD::Context) {} + + #[interrupt(priority = 5)] + fn GPIOE(_: GPIOE::Context) {} + + #[interrupt(priority = 6)] + fn UART0(_: UART0::Context) {} + + #[interrupt(priority = 7)] + fn UART1(_: UART1::Context) {} + + // OK, this is the maximum priority supported by the device + #[interrupt(priority = 8)] + fn SSI0(_: SSI0::Context) {} + + // this value is too high! + #[interrupt(priority = 9)] + fn I2C0(_: I2C0::Context) {} +}; diff --git a/ui/single/task-priority-too-high.stderr b/ui/single/task-priority-too-high.stderr new file mode 100644 index 0000000..b402a95 --- /dev/null +++ b/ui/single/task-priority-too-high.stderr @@ -0,0 +1,9 @@ +error[E0080]: evaluation of constant value failed + --> $DIR/task-priority-too-high.rs:5:1 + | +5 | #[rtfm::app(device = lm3s6965)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to subtract with overflow + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. -- cgit v1.2.3 From 4e51bb68b976c6bb6a9a989dc560d2a8123a84ca Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 20 Jun 2019 06:19:59 +0200 Subject: RFC #207 --- ui/single/exception-invalid.rs | 4 ++-- ui/single/exception-invalid.stderr | 4 ++-- ui/single/exception-systick-used.rs | 4 ++-- ui/single/exception-systick-used.stderr | 4 ++-- ui/single/extern-interrupt-used.rs | 2 +- ui/single/extern-interrupt-used.stderr | 6 +++--- ui/single/locals-cfg.rs | 8 ++++---- ui/single/resources-cfg.rs | 8 ++++---- ui/single/resources-cfg.stderr | 12 +++++------ ui/single/task-priority-too-high.rs | 36 ++++++++++++++++----------------- 10 files changed, 44 insertions(+), 44 deletions(-) (limited to 'ui/single') diff --git a/ui/single/exception-invalid.rs b/ui/single/exception-invalid.rs index 426cb67..54f5992 100644 --- a/ui/single/exception-invalid.rs +++ b/ui/single/exception-invalid.rs @@ -2,6 +2,6 @@ #[rtfm::app(device = lm3s6965)] const APP: () = { - #[exception] - fn NonMaskableInt(_: NonMaskableInt::Context) {} + #[task(binds = NonMaskableInt)] + fn nmi(_: nmi::Context) {} }; diff --git a/ui/single/exception-invalid.stderr b/ui/single/exception-invalid.stderr index f7fc292..306074b 100644 --- a/ui/single/exception-invalid.stderr +++ b/ui/single/exception-invalid.stderr @@ -1,8 +1,8 @@ error: only exceptions with configurable priority can be used as hardware tasks --> $DIR/exception-invalid.rs:6:8 | -6 | fn NonMaskableInt(_: NonMaskableInt::Context) {} - | ^^^^^^^^^^^^^^ +6 | fn nmi(_: nmi::Context) {} + | ^^^ error: aborting due to previous error diff --git a/ui/single/exception-systick-used.rs b/ui/single/exception-systick-used.rs index d30da1b..1155834 100644 --- a/ui/single/exception-systick-used.rs +++ b/ui/single/exception-systick-used.rs @@ -2,8 +2,8 @@ #[rtfm::app(device = lm3s6965)] const APP: () = { - #[exception] - fn SysTick(_: SysTick::Context) {} + #[task(binds = SysTick)] + fn sys_tick(_: sys_tick::Context) {} #[task(schedule = [foo])] fn foo(_: foo::Context) {} diff --git a/ui/single/exception-systick-used.stderr b/ui/single/exception-systick-used.stderr index 47786c6..e2ccbd3 100644 --- a/ui/single/exception-systick-used.stderr +++ b/ui/single/exception-systick-used.stderr @@ -1,8 +1,8 @@ error: this exception can't be used because it's being used by the runtime --> $DIR/exception-systick-used.rs:6:8 | -6 | fn SysTick(_: SysTick::Context) {} - | ^^^^^^^ +6 | fn sys_tick(_: sys_tick::Context) {} + | ^^^^^^^^ error: aborting due to previous error diff --git a/ui/single/extern-interrupt-used.rs b/ui/single/extern-interrupt-used.rs index 25f34b3..59f3806 100644 --- a/ui/single/extern-interrupt-used.rs +++ b/ui/single/extern-interrupt-used.rs @@ -2,7 +2,7 @@ #[rtfm::app(device = lm3s6965)] const APP: () = { - #[interrupt(binds = UART0)] + #[task(binds = UART0)] fn a(_: a::Context) {} extern "C" { diff --git a/ui/single/extern-interrupt-used.stderr b/ui/single/extern-interrupt-used.stderr index 8707b1d..2e084ca 100644 --- a/ui/single/extern-interrupt-used.stderr +++ b/ui/single/extern-interrupt-used.stderr @@ -1,8 +1,8 @@ error: `extern` interrupts can't be used as hardware tasks - --> $DIR/extern-interrupt-used.rs:5:25 + --> $DIR/extern-interrupt-used.rs:5:20 | -5 | #[interrupt(binds = UART0)] - | ^^^^^ +5 | #[task(binds = UART0)] + | ^^^^^ error: aborting due to previous error diff --git a/ui/single/locals-cfg.rs b/ui/single/locals-cfg.rs index bcce5ca..8761f72 100644 --- a/ui/single/locals-cfg.rs +++ b/ui/single/locals-cfg.rs @@ -20,16 +20,16 @@ const APP: () = { loop {} } - #[exception] - fn SVCall(_: SVCall::Context) { + #[task(binds = SVCall)] + fn svcall(_: svcall::Context) { #[cfg(never)] static mut FOO: u32 = 0; FOO; } - #[interrupt] - fn UART0(_: UART0::Context) { + #[task(binds = UART0)] + fn uart0(_: uart0::Context) { #[cfg(never)] static mut FOO: u32 = 0; diff --git a/ui/single/resources-cfg.rs b/ui/single/resources-cfg.rs index f8c3672..6f608fa 100644 --- a/ui/single/resources-cfg.rs +++ b/ui/single/resources-cfg.rs @@ -41,16 +41,16 @@ const APP: () = { loop {} } - #[interrupt(resources = [O3, S1, S2, S3])] - fn UART0(c: UART0::Context) { + #[task(binds = UART0, resources = [O3, S1, S2, S3])] + fn uart0(c: uart0::Context) { c.resources.O3; c.resources.S1; c.resources.S2; c.resources.S3; } - #[interrupt(resources = [S2, O5])] - fn UART1(c: UART1::Context) { + #[task(binds = UART1, resources = [S2, O5])] + fn uart1(c: uart1::Context) { c.resources.S2; c.resources.O5; } diff --git a/ui/single/resources-cfg.stderr b/ui/single/resources-cfg.stderr index 88c34d2..55e7ee0 100644 --- a/ui/single/resources-cfg.stderr +++ b/ui/single/resources-cfg.stderr @@ -70,7 +70,7 @@ error[E0609]: no field `S3` on type `idleResources<'_>` | = note: available fields are: `__marker__` -error[E0609]: no field `O3` on type `UART0Resources<'_>` +error[E0609]: no field `O3` on type `uart0Resources<'_>` --> $DIR/resources-cfg.rs:46:21 | 46 | c.resources.O3; @@ -78,7 +78,7 @@ error[E0609]: no field `O3` on type `UART0Resources<'_>` | = note: available fields are: `__marker__` -error[E0609]: no field `S1` on type `UART0Resources<'_>` +error[E0609]: no field `S1` on type `uart0Resources<'_>` --> $DIR/resources-cfg.rs:47:21 | 47 | c.resources.S1; @@ -86,7 +86,7 @@ error[E0609]: no field `S1` on type `UART0Resources<'_>` | = note: available fields are: `__marker__` -error[E0609]: no field `S2` on type `UART0Resources<'_>` +error[E0609]: no field `S2` on type `uart0Resources<'_>` --> $DIR/resources-cfg.rs:48:21 | 48 | c.resources.S2; @@ -94,7 +94,7 @@ error[E0609]: no field `S2` on type `UART0Resources<'_>` | = note: available fields are: `__marker__` -error[E0609]: no field `S3` on type `UART0Resources<'_>` +error[E0609]: no field `S3` on type `uart0Resources<'_>` --> $DIR/resources-cfg.rs:49:21 | 49 | c.resources.S3; @@ -102,7 +102,7 @@ error[E0609]: no field `S3` on type `UART0Resources<'_>` | = note: available fields are: `__marker__` -error[E0609]: no field `S2` on type `UART1Resources<'_>` +error[E0609]: no field `S2` on type `uart1Resources<'_>` --> $DIR/resources-cfg.rs:54:21 | 54 | c.resources.S2; @@ -110,7 +110,7 @@ error[E0609]: no field `S2` on type `UART1Resources<'_>` | = note: available fields are: `__marker__` -error[E0609]: no field `O5` on type `UART1Resources<'_>` +error[E0609]: no field `O5` on type `uart1Resources<'_>` --> $DIR/resources-cfg.rs:55:21 | 55 | c.resources.O5; diff --git a/ui/single/task-priority-too-high.rs b/ui/single/task-priority-too-high.rs index c7c9dc9..24cb11e 100644 --- a/ui/single/task-priority-too-high.rs +++ b/ui/single/task-priority-too-high.rs @@ -7,32 +7,32 @@ const APP: () = { #[init] fn init(_: init::Context) {} - #[interrupt(priority = 1)] - fn GPIOA(_: GPIOA::Context) {} + #[task(binds = GPIOA, priority = 1)] + fn gpioa(_: gpioa::Context) {} - #[interrupt(priority = 2)] - fn GPIOB(_: GPIOB::Context) {} + #[task(binds = GPIOB, priority = 2)] + fn gpiob(_: gpiob::Context) {} - #[interrupt(priority = 3)] - fn GPIOC(_: GPIOC::Context) {} + #[task(binds = GPIOC, priority = 3)] + fn gpioc(_: gpioc::Context) {} - #[interrupt(priority = 4)] - fn GPIOD(_: GPIOD::Context) {} + #[task(binds = GPIOD, priority = 4)] + fn gpiod(_: gpiod::Context) {} - #[interrupt(priority = 5)] - fn GPIOE(_: GPIOE::Context) {} + #[task(binds = GPIOE, priority = 5)] + fn gpioe(_: gpioe::Context) {} - #[interrupt(priority = 6)] - fn UART0(_: UART0::Context) {} + #[task(binds = UART0, priority = 6)] + fn uart0(_: uart0::Context) {} - #[interrupt(priority = 7)] - fn UART1(_: UART1::Context) {} + #[task(binds = UART1, priority = 7)] + fn uart1(_: uart1::Context) {} // OK, this is the maximum priority supported by the device - #[interrupt(priority = 8)] - fn SSI0(_: SSI0::Context) {} + #[task(binds = SSI0, priority = 8)] + fn ssi0(_: ssi0::Context) {} // this value is too high! - #[interrupt(priority = 9)] - fn I2C0(_: I2C0::Context) {} + #[task(binds = I2C0, priority = 9)] + fn i2c0(_: i2c0::Context) {} }; -- cgit v1.2.3 From 9195038c87703fc94b6e99f6de593886d51c2b19 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 10 Jul 2019 22:42:44 +0200 Subject: implement RFC #212 --- ui/single/resources-cfg.rs | 96 +++++++++++++++++++++++++----------------- ui/single/resources-cfg.stderr | 90 +++++++++++++++++++-------------------- 2 files changed, 102 insertions(+), 84 deletions(-) (limited to 'ui/single') diff --git a/ui/single/resources-cfg.rs b/ui/single/resources-cfg.rs index 6f608fa..906b3e2 100644 --- a/ui/single/resources-cfg.rs +++ b/ui/single/resources-cfg.rs @@ -2,56 +2,74 @@ #[rtfm::app(device = lm3s6965)] const APP: () = { - #[cfg(never)] - static mut O1: u32 = 0; // init - #[cfg(never)] - static mut O2: u32 = 0; // idle - #[cfg(never)] - static mut O3: u32 = 0; // EXTI0 - #[cfg(never)] - static O4: u32 = 0; // idle - #[cfg(never)] - static O5: u32 = 0; // EXTI1 - #[cfg(never)] - static O6: u32 = 0; // init - - #[cfg(never)] - static mut S1: u32 = 0; // idle & EXTI0 - #[cfg(never)] - static mut S2: u32 = 0; // EXTI0 & EXTI1 - #[cfg(never)] - static S3: u32 = 0; - - #[init(resources = [O1, O4, O5, O6, S3])] + struct Resources { + #[cfg(never)] + #[init(0)] + o1: u32, // init + + #[cfg(never)] + #[init(0)] + o2: u32, // idle + + #[cfg(never)] + #[init(0)] + o3: u32, // EXTI0 + + #[cfg(never)] + #[init(0)] + o4: u32, // idle + + #[cfg(never)] + #[init(0)] + o5: u32, // EXTI1 + + #[cfg(never)] + #[init(0)] + o6: u32, // init + + #[cfg(never)] + #[init(0)] + s1: u32, // idle & EXTI0 + + #[cfg(never)] + #[init(0)] + s2: u32, // EXTI0 & EXTI1 + + #[cfg(never)] + #[init(0)] + s3: u32, + } + + #[init(resources = [o1, o4, o5, o6, s3])] fn init(c: init::Context) { - c.resources.O1; - c.resources.O4; - c.resources.O5; - c.resources.O6; - c.resources.S3; + c.resources.o1; + c.resources.o4; + c.resources.o5; + c.resources.o6; + c.resources.s3; } - #[idle(resources = [O2, O4, S1, S3])] + #[idle(resources = [o2, &o4, s1, &s3])] fn idle(c: idle::Context) -> ! { - c.resources.O2; - c.resources.O4; - c.resources.S1; - c.resources.S3; + c.resources.o2; + c.resources.o4; + c.resources.s1; + c.resources.s3; loop {} } - #[task(binds = UART0, resources = [O3, S1, S2, S3])] + #[task(binds = UART0, resources = [o3, s1, s2, &s3])] fn uart0(c: uart0::Context) { - c.resources.O3; - c.resources.S1; - c.resources.S2; - c.resources.S3; + c.resources.o3; + c.resources.s1; + c.resources.s2; + c.resources.s3; } - #[task(binds = UART1, resources = [S2, O5])] + #[task(binds = UART1, resources = [s2, &o5])] fn uart1(c: uart1::Context) { - c.resources.S2; - c.resources.O5; + c.resources.s2; + c.resources.o5; } }; diff --git a/ui/single/resources-cfg.stderr b/ui/single/resources-cfg.stderr index 55e7ee0..a745e6e 100644 --- a/ui/single/resources-cfg.stderr +++ b/ui/single/resources-cfg.stderr @@ -1,119 +1,119 @@ -error[E0609]: no field `O1` on type `initResources<'_>` - --> $DIR/resources-cfg.rs:27:21 +error[E0609]: no field `o1` on type `initResources<'_>` + --> $DIR/resources-cfg.rs:45:21 | -27 | c.resources.O1; +45 | c.resources.o1; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `O4` on type `initResources<'_>` - --> $DIR/resources-cfg.rs:28:21 +error[E0609]: no field `o4` on type `initResources<'_>` + --> $DIR/resources-cfg.rs:46:21 | -28 | c.resources.O4; +46 | c.resources.o4; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `O5` on type `initResources<'_>` - --> $DIR/resources-cfg.rs:29:21 +error[E0609]: no field `o5` on type `initResources<'_>` + --> $DIR/resources-cfg.rs:47:21 | -29 | c.resources.O5; +47 | c.resources.o5; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `O6` on type `initResources<'_>` - --> $DIR/resources-cfg.rs:30:21 +error[E0609]: no field `o6` on type `initResources<'_>` + --> $DIR/resources-cfg.rs:48:21 | -30 | c.resources.O6; +48 | c.resources.o6; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `S3` on type `initResources<'_>` - --> $DIR/resources-cfg.rs:31:21 +error[E0609]: no field `s3` on type `initResources<'_>` + --> $DIR/resources-cfg.rs:49:21 | -31 | c.resources.S3; +49 | c.resources.s3; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `O2` on type `idleResources<'_>` - --> $DIR/resources-cfg.rs:36:21 +error[E0609]: no field `o2` on type `idleResources<'_>` + --> $DIR/resources-cfg.rs:54:21 | -36 | c.resources.O2; +54 | c.resources.o2; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `O4` on type `idleResources<'_>` - --> $DIR/resources-cfg.rs:37:21 +error[E0609]: no field `o4` on type `idleResources<'_>` + --> $DIR/resources-cfg.rs:55:21 | -37 | c.resources.O4; +55 | c.resources.o4; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `S1` on type `idleResources<'_>` - --> $DIR/resources-cfg.rs:38:21 +error[E0609]: no field `s1` on type `idleResources<'_>` + --> $DIR/resources-cfg.rs:56:21 | -38 | c.resources.S1; +56 | c.resources.s1; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `S3` on type `idleResources<'_>` - --> $DIR/resources-cfg.rs:39:21 +error[E0609]: no field `s3` on type `idleResources<'_>` + --> $DIR/resources-cfg.rs:57:21 | -39 | c.resources.S3; +57 | c.resources.s3; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `O3` on type `uart0Resources<'_>` - --> $DIR/resources-cfg.rs:46:21 +error[E0609]: no field `o3` on type `uart0Resources<'_>` + --> $DIR/resources-cfg.rs:64:21 | -46 | c.resources.O3; +64 | c.resources.o3; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `S1` on type `uart0Resources<'_>` - --> $DIR/resources-cfg.rs:47:21 +error[E0609]: no field `s1` on type `uart0Resources<'_>` + --> $DIR/resources-cfg.rs:65:21 | -47 | c.resources.S1; +65 | c.resources.s1; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `S2` on type `uart0Resources<'_>` - --> $DIR/resources-cfg.rs:48:21 +error[E0609]: no field `s2` on type `uart0Resources<'_>` + --> $DIR/resources-cfg.rs:66:21 | -48 | c.resources.S2; +66 | c.resources.s2; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `S3` on type `uart0Resources<'_>` - --> $DIR/resources-cfg.rs:49:21 +error[E0609]: no field `s3` on type `uart0Resources<'_>` + --> $DIR/resources-cfg.rs:67:21 | -49 | c.resources.S3; +67 | c.resources.s3; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `S2` on type `uart1Resources<'_>` - --> $DIR/resources-cfg.rs:54:21 +error[E0609]: no field `s2` on type `uart1Resources<'_>` + --> $DIR/resources-cfg.rs:72:21 | -54 | c.resources.S2; +72 | c.resources.s2; | ^^ unknown field | = note: available fields are: `__marker__` -error[E0609]: no field `O5` on type `uart1Resources<'_>` - --> $DIR/resources-cfg.rs:55:21 +error[E0609]: no field `o5` on type `uart1Resources<'_>` + --> $DIR/resources-cfg.rs:73:21 | -55 | c.resources.O5; +73 | c.resources.o5; | ^^ unknown field | = note: available fields are: `__marker__` -- cgit v1.2.3