diff options
| author | Dion Dokter <[email protected]> | 2024-12-25 22:54:48 +0100 |
|---|---|---|
| committer | Dion Dokter <[email protected]> | 2024-12-25 22:54:48 +0100 |
| commit | 595ce48eb2be88a42ceb33865c337020a328a4dd (patch) | |
| tree | 172a540a6ddb5c7b444866d8a9dcdb65203ba39a /embassy-stm32 | |
| parent | 92a489b6a126913129bedc3f8a1407256b3590d7 (diff) | |
Write the flag sooner with a known value
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 3c7f96bb1..857090303 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs | |||
| @@ -350,6 +350,11 @@ mod dual_core { | |||
| 350 | pub fn init_primary(config: Config, shared_data: &'static MaybeUninit<SharedData>) -> Peripherals { | 350 | pub fn init_primary(config: Config, shared_data: &'static MaybeUninit<SharedData>) -> Peripherals { |
| 351 | let shared_data = unsafe { shared_data.assume_init_ref() }; | 351 | let shared_data = unsafe { shared_data.assume_init_ref() }; |
| 352 | 352 | ||
| 353 | // Write the flag as soon as possible. Reading this flag uninitialized in the `init_secondary` | ||
| 354 | // is maybe unsound? Unclear. If it is indeed unsound, writing it sooner doesn't fix it all, | ||
| 355 | // but improves the odds of it going right | ||
| 356 | shared_data.init_flag.store(0, Ordering::SeqCst); | ||
| 357 | |||
| 353 | rcc::set_freqs_ptr(shared_data.clocks.get()); | 358 | rcc::set_freqs_ptr(shared_data.clocks.get()); |
| 354 | let p = init_hw(config); | 359 | let p = init_hw(config); |
| 355 | 360 | ||
