aboutsummaryrefslogtreecommitdiffstats
path: root/os/rt/ports/ARMCMx/chcore_v7m.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/rt/ports/ARMCMx/chcore_v7m.h')
-rw-r--r--os/rt/ports/ARMCMx/chcore_v7m.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/os/rt/ports/ARMCMx/chcore_v7m.h b/os/rt/ports/ARMCMx/chcore_v7m.h
index 7898e4e74..ab6cf28b9 100644
--- a/os/rt/ports/ARMCMx/chcore_v7m.h
+++ b/os/rt/ports/ARMCMx/chcore_v7m.h
@@ -388,8 +388,11 @@ static inline void port_init(void) {
/* Initializing priority grouping.*/
NVIC_SetPriorityGrouping(CORTEX_PRIGROUP_INIT);
- /* DWT cycle counter enable.*/
+ /* DWT cycle counter enable, note, the M7 requires DWT unlocking.*/
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
+#if CORTEX_MODEL == 7
+ DWT->LAR = 0xC5ACCE55;
+#endif
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
/* Initialization of the system vectors used by the port.*/