Skip to content

Commit 5bf1868

Browse files
committed
Add FREEZE_TIMER_ON_DEBUG condition
In order to give the choice to enable or not the timer freeze on stop/breakpoint. This has to be defined in the mbed_app.json file for example.
1 parent 9f86a32 commit 5bf1868

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

targets/TARGET_STM/hal_tick_16b.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,11 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
148148
// Enable timer
149149
HAL_TIM_Base_Start(&TimMasterHandle);
150150

151-
#ifndef NDEBUG
152-
#ifdef TIM_MST_DBGMCU_FREEZE
153151
// Freeze timer on stop/breakpoint
152+
// Define the FREEZE_TIMER_ON_DEBUG macro in mbed_app.json for example
153+
#if !defined(NDEBUG) && defined(FREEZE_TIMER_ON_DEBUG) && defined(TIM_MST_DBGMCU_FREEZE)
154154
TIM_MST_DBGMCU_FREEZE;
155155
#endif
156-
#endif
157156

158157
#if DEBUG_TICK > 0
159158
__HAL_RCC_GPIOB_CLK_ENABLE();

targets/TARGET_STM/hal_tick_32b.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,11 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
118118
__HAL_TIM_SET_COMPARE(&TimMasterHandle, TIM_CHANNEL_2, PreviousVal + HAL_TICK_DELAY);
119119
__HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC2);
120120

121-
#ifndef NDEBUG
122-
#ifdef TIM_MST_DBGMCU_FREEZE
123121
// Freeze timer on stop/breakpoint
122+
// Define the FREEZE_TIMER_ON_DEBUG macro in mbed_app.json for example
123+
#if !defined(NDEBUG) && defined(FREEZE_TIMER_ON_DEBUG) && defined(TIM_MST_DBGMCU_FREEZE)
124124
TIM_MST_DBGMCU_FREEZE;
125125
#endif
126-
#endif
127126

128127
#if DEBUG_TICK > 0
129128
__HAL_RCC_GPIOB_CLK_ENABLE();

0 commit comments

Comments
 (0)