-
Notifications
You must be signed in to change notification settings - Fork 175
Description
Hello!
When using cortex-m-rtfm, I found it incredibly useful and intuitive that the peripherals from the respective device crate are passed into the init
function. It's like taking argc
and argv
parameters in a main
function.
Would it be possible to have the same for #[entry]
-attributed functions? The current Peripheral API, introduced in the [RFC] Peripherals as scoped singletons is comparably clumsy. I dislike that global initialisation flag and the panicky unwrapping of the Option
, and even in case the optimiser is able to eliminate them (I haven't checked) it would be cleaner code if one could just omit the static mut DEVICE_PERIPHERALS: bool
from the device crates. I am hoping for something like
#[entry]
fn main(peripherals: stm32f30x::Peripherals) -> ! {
// initialization
loop {
// application logic
}
}
I'm not sure whether this is feasible at all (especially regarding the dependency hierarchy between cortext-m-rt and the device crates), where the right place to discuss this is (svd2rust? embedded-wg?) and what needs to be done to make this happen (should this be a RFC?). Please provide some guidance :-)