1 parent c9705cf commit 4351d16Copy full SHA for 4351d16
1 file changed
stmhal/mphalport.c
@@ -72,6 +72,10 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, size_t len) {
72
void mp_hal_ticks_cpu_enable(void) {
73
if (!mp_hal_ticks_cpu_enabled) {
74
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
75
+ #if defined(__CORTEX_M) && __CORTEX_M == 7
76
+ // on Cortex-M7 we must unlock the DWT before writing to its registers
77
+ DWT->LAR = 0xc5acce55;
78
+ #endif
79
DWT->CYCCNT = 0;
80
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
81
mp_hal_ticks_cpu_enabled = true;
0 commit comments