Add flag to disable the cache for testing.

This commit is contained in:
iabdalkader 2020-11-15 18:29:12 +02:00
parent 69cb030c44
commit 2b267bc2f2

View File

@ -66,23 +66,27 @@ void HAL_MspInit(void)
#endif #endif
/* Enable I/D cache */ /* Enable I/D cache */
#if defined(MCU_SERIES_F7) ||\ #if defined(MCU_SERIES_F7) || defined(MCU_SERIES_H7)
defined(MCU_SERIES_H7) #ifdef OMV_DISABLE_CACHE
if (SCB->CCR & (uint32_t)SCB_CCR_IC_Msk) { // Disable caches for testing.
/* Disable and Invalidate I-Cache */
SCB_DisableICache(); SCB_DisableICache();
SCB_InvalidateICache();
}
if (SCB->CCR & (uint32_t)SCB_CCR_DC_Msk) {
/* Disable, Clean and Invalidate D-Cache */
SCB_DisableDCache(); SCB_DisableDCache();
SCB_CleanInvalidateDCache(); #else
// Enable caches if not enabled, or clean and invalidate.
if (!(SCB->CCR & (uint32_t)SCB_CCR_IC_Msk)) {
SCB_EnableICache();
} else {
SCB_InvalidateICache();
__ISB(); __DSB(); __DMB();
} }
// Enable the CPU Caches if (!(SCB->CCR & (uint32_t)SCB_CCR_DC_Msk)) {
SCB_EnableICache();
SCB_EnableDCache(); SCB_EnableDCache();
} else {
SCB_CleanInvalidateDCache();
__ISB(); __DSB(); __DMB();
}
#endif
#endif #endif
/* Config Systick */ /* Config Systick */