diff options
| author | ragarnoy <[email protected]> | 2025-05-10 10:04:34 +0200 |
|---|---|---|
| committer | ragarnoy <[email protected]> | 2025-05-10 10:04:34 +0200 |
| commit | 04c0bd84e6043ac35d2a20f1f4a789ccf79bb316 (patch) | |
| tree | b0058edc2c0cca2425848ae1aea25dfb7e82a526 /examples/stm32h755cm7/src/bin/intercore.rs | |
| parent | d9befca44f3e35c14fef85744d19bbacc4a76de3 (diff) | |
fix release mode that was broken by lto and codegen units (there are probably things that can be done to be able to keep lto, I haven't found yet)
Diffstat (limited to 'examples/stm32h755cm7/src/bin/intercore.rs')
| -rw-r--r-- | examples/stm32h755cm7/src/bin/intercore.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/examples/stm32h755cm7/src/bin/intercore.rs b/examples/stm32h755cm7/src/bin/intercore.rs index f01d6a6b7..f1fbd29bc 100644 --- a/examples/stm32h755cm7/src/bin/intercore.rs +++ b/examples/stm32h755cm7/src/bin/intercore.rs | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | use core::mem::MaybeUninit; | 4 | use core::mem::MaybeUninit; |
| 5 | 5 | ||
| 6 | use cortex_m::asm; | 6 | use cortex_m::asm; |
| 7 | use cortex_m::peripheral::{MPU, SCB}; | 7 | use cortex_m::peripheral::MPU; |
| 8 | use defmt::*; | 8 | use defmt::*; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_stm32::{Config, SharedData}; | 10 | use embassy_stm32::{Config, SharedData}; |
| @@ -102,7 +102,7 @@ mod shared { | |||
| 102 | static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); | 102 | static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); |
| 103 | 103 | ||
| 104 | // Function to configure MPU with your provided settings | 104 | // Function to configure MPU with your provided settings |
| 105 | fn configure_mpu_non_cacheable(mpu: &mut MPU, _scb: &mut SCB) { | 105 | fn configure_mpu_non_cacheable(mpu: &mut MPU) { |
| 106 | // Ensure all operations complete before reconfiguring MPU/caches | 106 | // Ensure all operations complete before reconfiguring MPU/caches |
| 107 | asm::dmb(); | 107 | asm::dmb(); |
| 108 | unsafe { | 108 | unsafe { |
| @@ -147,11 +147,19 @@ async fn main(_spawner: Spawner) -> ! { | |||
| 147 | // Configure MPU to make SRAM4 non-cacheable | 147 | // Configure MPU to make SRAM4 non-cacheable |
| 148 | { | 148 | { |
| 149 | let mut cp = cortex_m::Peripherals::take().unwrap(); | 149 | let mut cp = cortex_m::Peripherals::take().unwrap(); |
| 150 | let mpu = &mut cp.MPU; | ||
| 151 | let scb = &mut cp.SCB; | 150 | let scb = &mut cp.SCB; |
| 152 | 151 | ||
| 153 | // Configure MPU without disabling caches | 152 | scb.disable_icache(); |
| 154 | configure_mpu_non_cacheable(mpu, scb); | 153 | scb.disable_dcache(&mut cp.CPUID); |
| 154 | |||
| 155 | // 2. MPU setup | ||
| 156 | configure_mpu_non_cacheable(&mut cp.MPU); | ||
| 157 | |||
| 158 | // 3. re-enable caches | ||
| 159 | scb.enable_icache(); | ||
| 160 | scb.enable_dcache(&mut cp.CPUID); | ||
| 161 | asm::dsb(); | ||
| 162 | asm::isb(); | ||
| 155 | } | 163 | } |
| 156 | 164 | ||
| 157 | // Configure the clocks | 165 | // Configure the clocks |
