mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 12:55:23 +01:00
rtfm-syntax refactor + heterogeneous multi-core support
This commit is contained in:
parent
fafeeb2727
commit
81275bfa4f
127 changed files with 4072 additions and 5848 deletions
7
ui/single/exception-invalid.rs
Normal file
7
ui/single/exception-invalid.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#![no_main]
|
||||
|
||||
#[rtfm::app(device = lm3s6965)]
|
||||
const APP: () = {
|
||||
#[exception]
|
||||
fn NonMaskableInt(_: NonMaskableInt::Context) {}
|
||||
};
|
||||
8
ui/single/exception-invalid.stderr
Normal file
8
ui/single/exception-invalid.stderr
Normal file
|
|
@ -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
|
||||
|
||||
10
ui/single/exception-systick-used.rs
Normal file
10
ui/single/exception-systick-used.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#![no_main]
|
||||
|
||||
#[rtfm::app(device = lm3s6965)]
|
||||
const APP: () = {
|
||||
#[exception]
|
||||
fn SysTick(_: SysTick::Context) {}
|
||||
|
||||
#[task(schedule = [foo])]
|
||||
fn foo(_: foo::Context) {}
|
||||
};
|
||||
8
ui/single/exception-systick-used.stderr
Normal file
8
ui/single/exception-systick-used.stderr
Normal file
|
|
@ -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
|
||||
|
||||
7
ui/single/extern-interrupt-not-enough.rs
Normal file
7
ui/single/extern-interrupt-not-enough.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#![no_main]
|
||||
|
||||
#[rtfm::app(device = lm3s6965)]
|
||||
const APP: () = {
|
||||
#[task]
|
||||
fn a(_: a::Context) {}
|
||||
};
|
||||
8
ui/single/extern-interrupt-not-enough.stderr
Normal file
8
ui/single/extern-interrupt-not-enough.stderr
Normal file
|
|
@ -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
|
||||
|
||||
11
ui/single/extern-interrupt-used.rs
Normal file
11
ui/single/extern-interrupt-used.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#![no_main]
|
||||
|
||||
#[rtfm::app(device = lm3s6965)]
|
||||
const APP: () = {
|
||||
#[interrupt(binds = UART0)]
|
||||
fn a(_: a::Context) {}
|
||||
|
||||
extern "C" {
|
||||
fn UART0();
|
||||
}
|
||||
};
|
||||
8
ui/single/extern-interrupt-used.stderr
Normal file
8
ui/single/extern-interrupt-used.stderr
Normal file
|
|
@ -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
|
||||
|
||||
50
ui/single/locals-cfg.rs
Normal file
50
ui/single/locals-cfg.rs
Normal file
|
|
@ -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();
|
||||
}
|
||||
};
|
||||
33
ui/single/locals-cfg.stderr
Normal file
33
ui/single/locals-cfg.stderr
Normal file
|
|
@ -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`.
|
||||
57
ui/single/resources-cfg.rs
Normal file
57
ui/single/resources-cfg.rs
Normal file
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
123
ui/single/resources-cfg.stderr
Normal file
123
ui/single/resources-cfg.stderr
Normal file
|
|
@ -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`.
|
||||
38
ui/single/task-priority-too-high.rs
Normal file
38
ui/single/task-priority-too-high.rs
Normal file
|
|
@ -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) {}
|
||||
};
|
||||
9
ui/single/task-priority-too-high.stderr
Normal file
9
ui/single/task-priority-too-high.stderr
Normal file
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue