From 7e920b4c42c83a6bfa0451542a82c80c9c035132 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Wed, 2 Dec 2020 22:52:14 +0200 Subject: [PATCH] Enable DBGMCU only if DEBUG=1 --- src/cmsis/src/st/system_stm32fxxx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmsis/src/st/system_stm32fxxx.c b/src/cmsis/src/st/system_stm32fxxx.c index 04d53a958..eef3c77fa 100644 --- a/src/cmsis/src/st/system_stm32fxxx.c +++ b/src/cmsis/src/st/system_stm32fxxx.c @@ -168,10 +168,14 @@ void SystemInit(void) /* dpgeorge: enable 8-byte stack alignment for IRQ handlers, in accord with EABI */ SCB->CCR |= SCB_CCR_STKALIGN_Msk; + #if !defined(NDEBUG) #if defined(MCU_SERIES_F4) || defined(MCU_SERIES_F7) DBGMCU->CR |= DBGMCU_CR_DBG_SLEEP; #elif defined(MCU_SERIES_H7) DBGMCU->CR |= DBGMCU_CR_DBG_SLEEPD1; + DBGMCU->CR |= DBGMCU_CR_DBG_STOPD1; + DBGMCU->CR |= DBGMCU_CR_DBG_STANDBYD1; + #endif #endif }