mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-29 06:54:33 +01:00
Merge #748
748: Fix zero prio tasks when all async tasks have default (no) arguments r=datdenkikneit a=korken89 Without this fix the default tasks get priority 1 instead of the intended 0. Co-authored-by: Emil Fresk <emil.fresk@gmail.com>
This commit is contained in:
commit
21b0d97e17
10 changed files with 33 additions and 17 deletions
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
|
|
19
rtic-macros/ui/task-no-prio.rs
Normal file
19
rtic-macros/ui/task-no-prio.rs
Normal 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) {}
|
||||
}
|
5
rtic-macros/ui/task-no-prio.stderr
Normal file
5
rtic-macros/ui/task-no-prio.stderr
Normal 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) {}
|
||||
| ^^^^^
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -13,6 +13,6 @@ mod app {
|
|||
(Shared {}, Local {})
|
||||
}
|
||||
|
||||
#[task]
|
||||
#[task(priority = 1)]
|
||||
async fn a(_: a::Context) {}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue