Skip to content

Commit 630318a

Browse files
committed
[cortex-m] Only disable previously enabled caches
1 parent 4e0d1b8 commit 630318a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/modm/platform/core/cortex/startup.c.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ void __modm_startup(void)
9898
%% if enable_icache
9999
SCB_EnableICache();
100100
%% elif has_icache
101-
SCB_DisableICache();
101+
if (SCB->CCR & SCB_CCR_IC_Msk) SCB_DisableICache();
102102
%% endif
103103
%% if has_dcache
104-
SCB_DisableDCache();
104+
if (SCB->CCR & SCB_CCR_DC_Msk) SCB_DisableDCache();
105105
%% endif
106106
%#
107107
// Copy and zero all internal memory

0 commit comments

Comments
 (0)