embassy-rs / embassy

Modern embedded framework, using Rust and async.
https://embassy.dev
Apache License 2.0
5.31k stars 732 forks source link

embassy_stm32: `rcc::frequency()` is UB if called before `init()` #3099

Open GrantM11235 opened 3 months ago

GrantM11235 commented 3 months ago

rcc::frequency() is a public function, and there is nothing preventing a user from calling it before init(). Internally it calls unsafe { rcc::get_freqs() } which is UB if rcc::set_freqs() hasn't been called yet.