From af7bccbfbbd1e390a8465af957703874d561e3bb Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Wed, 19 Feb 2020 19:46:16 +0200 Subject: [PATCH] Disable, clean and invalidate before enabling the cache. --- src/omv/stm32fxxx_hal_msp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/omv/stm32fxxx_hal_msp.c b/src/omv/stm32fxxx_hal_msp.c index 077eaf8d6..23a513df0 100644 --- a/src/omv/stm32fxxx_hal_msp.c +++ b/src/omv/stm32fxxx_hal_msp.c @@ -68,11 +68,15 @@ void HAL_MspInit(void) /* Enable I/D cache */ #if defined(MCU_SERIES_F7) ||\ defined(MCU_SERIES_H7) - // Invalidate CPU cache + /* Disable and Invalidate I-Cache */ + SCB_DisableICache(); SCB_InvalidateICache(); - SCB_InvalidateDCache(); - // Enable the CPU Cache + /* Disable, Clean and Invalidate D-Cache */ + SCB_DisableDCache(); + SCB_CleanInvalidateDCache(); + + // Enable the CPU Caches SCB_EnableICache(); SCB_EnableDCache(); #endif