mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-23 12:12:50 +01:00
Improve error output for prios > dispatchers (#943)
* Improve error output for prios > dispatchers * Update changelog
This commit is contained in:
parent
6865b69616
commit
9bfd5a3bb2
2 changed files with 22 additions and 4 deletions
|
@ -7,6 +7,10 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Improve error output for prios > dispatchers
|
||||||
|
|
||||||
## [v2.1.0] - 2024-02-27
|
## [v2.1.0] - 2024-02-27
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl ops::Deref for Analysis {
|
||||||
|
|
||||||
// Assign an interrupt to each priority level
|
// Assign an interrupt to each priority level
|
||||||
pub fn app(analysis: analyze::Analysis, app: &App) -> Analysis {
|
pub fn app(analysis: analyze::Analysis, app: &App) -> Analysis {
|
||||||
let mut available_interrupt = app.args.dispatchers.clone();
|
let mut available_dispatchers = app.args.dispatchers.clone();
|
||||||
|
|
||||||
// the set of priorities (each priority only once)
|
// the set of priorities (each priority only once)
|
||||||
let priorities = app
|
let priorities = app
|
||||||
|
@ -35,12 +35,26 @@ pub fn app(analysis: analyze::Analysis, app: &App) -> Analysis {
|
||||||
|
|
||||||
// map from priorities to interrupts (holding name and attributes)
|
// map from priorities to interrupts (holding name and attributes)
|
||||||
|
|
||||||
let interrupts: BTreeMap<Priority, _> = priorities
|
let nonzero_priorities = priorities
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|prio| **prio > 0) // 0 prio tasks are run in main
|
// 0 prio tasks are run in main
|
||||||
|
.filter(|prio| **prio > 0);
|
||||||
|
assert!(
|
||||||
|
available_dispatchers.len() >= nonzero_priorities.clone().count(),
|
||||||
|
"The number of dispatchers must be equal to or greater than the number of distinct task priorities."
|
||||||
|
);
|
||||||
|
let interrupts: BTreeMap<Priority, _> = nonzero_priorities
|
||||||
.copied()
|
.copied()
|
||||||
.rev()
|
.rev()
|
||||||
.map(|p| (p, available_interrupt.pop().expect("UNREACHABLE")))
|
.map(|p| {
|
||||||
|
(
|
||||||
|
p,
|
||||||
|
available_dispatchers
|
||||||
|
.pop()
|
||||||
|
// EXPECT: covered by above assertion
|
||||||
|
.expect("UNREACHABLE"),
|
||||||
|
)
|
||||||
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let max_async_prio = app
|
let max_async_prio = app
|
||||||
|
|
Loading…
Reference in a new issue