aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32h755cm7
diff options
context:
space:
mode:
authorragarnoy <[email protected]>2025-05-10 10:04:34 +0200
committerragarnoy <[email protected]>2025-05-10 10:04:34 +0200
commit04c0bd84e6043ac35d2a20f1f4a789ccf79bb316 (patch)
treeb0058edc2c0cca2425848ae1aea25dfb7e82a526 /examples/stm32h755cm7
parentd9befca44f3e35c14fef85744d19bbacc4a76de3 (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')
-rw-r--r--examples/stm32h755cm7/Cargo.toml3
-rw-r--r--examples/stm32h755cm7/src/bin/intercore.rs18
2 files changed, 14 insertions, 7 deletions
diff --git a/examples/stm32h755cm7/Cargo.toml b/examples/stm32h755cm7/Cargo.toml
index 06a3b06af..2e34f0928 100644
--- a/examples/stm32h755cm7/Cargo.toml
+++ b/examples/stm32h755cm7/Cargo.toml
@@ -47,11 +47,10 @@ overflow-checks = true # <-
47 47
48# cargo build/run --release 48# cargo build/run --release
49[profile.release] 49[profile.release]
50codegen-units = 1 50codegen-units = 16
51debug = 2 51debug = 2
52debug-assertions = false # <- 52debug-assertions = false # <-
53incremental = false 53incremental = false
54lto = 'fat'
55opt-level = 3 # <- 54opt-level = 3 # <-
56overflow-checks = false # <- 55overflow-checks = false # <-
57 56
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 @@
4use core::mem::MaybeUninit; 4use core::mem::MaybeUninit;
5 5
6use cortex_m::asm; 6use cortex_m::asm;
7use cortex_m::peripheral::{MPU, SCB}; 7use cortex_m::peripheral::MPU;
8use defmt::*; 8use defmt::*;
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_stm32::{Config, SharedData}; 10use embassy_stm32::{Config, SharedData};
@@ -102,7 +102,7 @@ mod shared {
102static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); 102static 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
105fn configure_mpu_non_cacheable(mpu: &mut MPU, _scb: &mut SCB) { 105fn 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