Fix zero prio tasks when all async tasks have default (no) arguments

This commit is contained in:
Emil Fresk 2023-05-10 14:24:32 +02:00
parent cfac6d1d90
commit 67d5ade4fd
10 changed files with 33 additions and 17 deletions

View file

@ -10,7 +10,7 @@ edition = "2021"
[dependencies.rtic]
path = "../../rtic"
version = "=2.0.0-alpha.1"
version = "=2.0.0-alpha.2"
features = ["thumbv6-backend"]
[dependencies.rtic-monotonics]

View file

@ -9,7 +9,7 @@ version = "0.1.0"
[dependencies.rtic]
path = "../../rtic"
version = "=2.0.0-alpha.1"
version = "=2.0.0-alpha.2"
features = ["thumbv7-backend"]
[dependencies.rtic-monotonics]

View file

@ -22,7 +22,7 @@ name = "rtic-macros"
readme = "../README.md"
repository = "https://github.com/rtic-rs/rtic"
version = "2.0.0-alpha.0"
version = "2.0.0-alpha.2"
[lib]
proc-macro = true

View file

@ -242,7 +242,7 @@ pub struct SoftwareTaskArgs {
impl Default for SoftwareTaskArgs {
fn default() -> Self {
Self {
priority: 1,
priority: 0,
local_resources: LocalResources::new(),
shared_resources: SharedResources::new(),
}

View file

@ -0,0 +1,19 @@
#![no_main]
#[rtic_macros::mock_app(device = mock)]
mod app {
#[shared]
struct Shared {}
#[local]
struct Local {}
#[init]
fn init(_: init::Context) -> (Shared, Local) {}
#[idle]
fn idle(_: idle::Context) -> ! {}
#[task]
async fn task1(_: task1::Context) {}
}

View file

@ -0,0 +1,5 @@
error: Async task "task1" has priority 0, but `#[idle]` is defined. 0-priority async tasks are only allowed if there is no `#[idle]`.
--> ui/task-no-prio.rs:18:14
|
18 | async fn task1(_: task1::Context) {}
| ^^^^^

View file

@ -22,7 +22,7 @@ name = "rtic"
readme = "../README.md"
repository = "https://github.com/rtic-rs/rtic"
version = "2.0.0-alpha.1"
version = "2.0.0-alpha.2"
[package.metadata.docs.rs]
features = ["rtic-macros/test-template"]
@ -36,7 +36,7 @@ bare-metal = "1.0.0"
#portable-atomic = { version = "0.3.19" }
atomic-polyfill = "1"
rtic-monotonics = { path = "../rtic-monotonics", version = "1.0.0-alpha.1", optional = true }
rtic-macros = { path = "../rtic-macros", version = "2.0.0-alpha.0" }
rtic-macros = { path = "../rtic-macros", version = "2.0.0-alpha.2" }
rtic-core = "1"
critical-section = "1"

View file

@ -34,15 +34,6 @@ mod app {
(Shared {}, Local {})
}
#[idle]
fn idle(_: idle::Context) -> ! {
// debug::exit(debug::EXIT_SUCCESS);
loop {
// hprintln!("idle");
cortex_m::asm::wfi(); // put the MCU in sleep mode until interrupt occurs
}
}
#[task]
async fn foo(_cx: foo::Context) {
hprintln!("hello from foo");

View file

@ -25,6 +25,7 @@ mod app {
(Shared {}, Local {})
}
#[idle]
fn idle(_: idle::Context) -> ! {
for _ in 0..3 {
@ -35,7 +36,7 @@ mod app {
loop {}
}
#[task]
#[task(priority = 1)]
async fn foo(_: foo::Context) {
hprintln!("foo");
}

View file

@ -13,6 +13,6 @@ mod app {
(Shared {}, Local {})
}
#[task]
#[task(priority = 1)]
async fn a(_: a::Context) {}
}