Closed
Description
Comparing something like:
Notably:
Send
is omitted fromcortex_m::ITM
- mutable access (in the form of
ptr() -> *mut RegisterBlock
andDerefMut
are removed fromstm32f103xx::TIM6
I ran into this while trying to pass around ITM
in cortex_m_rtfm
, which wants Send
on resources
:
error[E0277]: the trait bound `*const (): core::marker::Send` is not satisfied in `cortex_m::peripheral::ITM`
--> src/main.rs:16:1
|
16 | / app! {
17 | | device: stm32f429,
18 | |
19 | | resources: {
... |
29 | | },
30 | | }
| |_^ `*const ()` cannot be sent between threads safely
|
= help: within `cortex_m::peripheral::ITM`, the trait `core::marker::Send` is not implemented for `*const ()`
= note: required because it appears within the type `core::marker::PhantomData<*const ()>`
= note: required because it appears within the type `cortex_m::peripheral::ITM`
I've used a quick wrapper to workaround:
...
use core::ops::{Deref,DerefMut};
pub struct ITM(cortex_m::peripheral::ITM);
impl Deref for ITM {
type Target = cortex_m::peripheral::ITM;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for ITM {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
unsafe impl Send for ITM {}
...
app! {
...
resources: {
static R_ITM: ITM;
...
},
tasks: {
TIM7: {
path: periodic,
resources: [R_ITM, ...],
},
},
}
...
fn init(mut p: init::Peripherals) -> init::LateResources {
...
init::LateResources {
R_ITM: ITM(p.core.ITM),
R_TIM7: tim,
}
}
...
Metadata
Metadata
Assignees
Labels
No labels