rtic: Can't use early, shared resource in init in `0.6.0-alpha.0`
The following example gives cannot find value priority in this scope.
#![no_std]
#![no_main]
use panic_halt as _;
#[rtic::app(device = atsamd51n)]
mod app {
#[resources]
struct Resources {
#[init(Default::default())]
ping_buf: [i16; 8],
#[init(Default::default())]
pong_buf: [i16; 8],
}
#[init(resources = [ping_buf, pong_buf])]
fn init(mut ctx: init::Context) -> init::LateResources {
init::LateResources{}
}
}
It looks like the generated code is trying to assign a priority for the lock, but there is no priority.
impl<'a> initResources<'a> {
#[inline(always)]
pub unsafe fn new() -> Self {
initResources {
ping_buf: resources::ping_buf::new(priority),
pong_buf: resources::pong_buf::new(priority),
}
}
}
That leads to another question. Why are locks necessary for early resources in init in the first place?
In the meantime, do you have any suggested workarounds? I need the static address of the buffers in init. I guess I could do it myself, outside of the Resources struct, but I’d rather not have to go that far.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (1 by maintainers)
Hi, unfortunately not. In
alpha.1we only got the new monotonic, the new resource syntax and fixes will start now after the cancel/reschedule PR.