Merge pull request #2491 from openmv/boot_cache
Some checks failed
🔎 Check Code Formatting / formatting-check (push) Has been cancelled
🔥 Firmware Build / build-firmware (ARDUINO_GIGA) (push) Has been cancelled
🔥 Firmware Build / build-firmware (ARDUINO_NANO_33_BLE_SENSE) (push) Has been cancelled
🔥 Firmware Build / build-firmware (ARDUINO_NANO_RP2040_CONNECT) (push) Has been cancelled
🔥 Firmware Build / build-firmware (ARDUINO_NICLA_VISION) (push) Has been cancelled
🔥 Firmware Build / build-firmware (ARDUINO_PORTENTA_H7) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMV2) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMV3) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMV4) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMV4P) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMVPT) (push) Has been cancelled
🔥 Firmware Build / build-firmware (OPENMV_RT1060) (push) Has been cancelled
🔥 Firmware Build / code-size-report (push) Has been cancelled
🔥 Firmware Build / stable-release (push) Has been cancelled
🔥 Firmware Build / development-release (push) Has been cancelled

bootloader: Fix stm32 cache disable.
This commit is contained in:
Ibrahim Abdelkader 2024-11-08 15:48:55 +02:00 committed by GitHub
commit e51f511809
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,6 +55,18 @@ void USB2_IRQ_Handler(void) {
} }
int port_init(void) { int port_init(void) {
#ifdef __DCACHE_PRESENT
// Clean I-Cache if enabled.
if ((SCB->CCR & (uint32_t) SCB_CCR_IC_Msk)) {
SCB_InvalidateICache();
}
// Clean D-Cache if enabled.
if ((SCB->CCR & (uint32_t) SCB_CCR_DC_Msk)) {
SCB_CleanInvalidateDCache();
}
#endif
HAL_Init(); HAL_Init();
// Configure the system clocks. // Configure the system clocks.
@ -114,8 +126,15 @@ int port_deinit(void) {
USB_OTG_PHY_CLK_DISABLE(); USB_OTG_PHY_CLK_DISABLE();
#ifdef __DCACHE_PRESENT #ifdef __DCACHE_PRESENT
// Clean/invalidate any cached lines. // Disable I-Cache if enabled.
SCB_CleanInvalidateDCache(); if ((SCB->CCR & (uint32_t) SCB_CCR_IC_Msk)) {
SCB_DisableICache();
}
// Disable D-Cache if enabled.
if ((SCB->CCR & (uint32_t) SCB_CCR_DC_Msk)) {
SCB_DisableDCache();
}
#endif #endif
// Clear default regions and configure XIP regions (if any). // Clear default regions and configure XIP regions (if any).