Skip to content

Commit 8b606bf

Browse files
betzwadbridge
authored andcommitted
Freeze master timer on stop/breakpoint
1 parent b53e31d commit 8b606bf

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F401xE/device/hal_tick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#define TIM_MST TIM5
4747
#define TIM_MST_IRQ TIM5_IRQn
4848
#define TIM_MST_RCC __HAL_RCC_TIM5_CLK_ENABLE()
49+
#define TIM_MST_DBGMCU_FREEZE __HAL_DBGMCU_FREEZE_TIM5()
4950

5051
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
5152
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()

targets/TARGET_STM/hal_tick_16b.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ 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
153+
// Freeze timer on stop/breakpoint
154+
TIM_MST_DBGMCU_FREEZE;
155+
#endif
156+
#endif
157+
151158
#if DEBUG_TICK > 0
152159
__HAL_RCC_GPIOB_CLK_ENABLE();
153160
GPIO_InitTypeDef GPIO_InitStruct;

targets/TARGET_STM/hal_tick_32b.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ 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
123+
// Freeze timer on stop/breakpoint
124+
TIM_MST_DBGMCU_FREEZE;
125+
#endif
126+
#endif
127+
121128
#if DEBUG_TICK > 0
122129
__HAL_RCC_GPIOB_CLK_ENABLE();
123130
GPIO_InitTypeDef GPIO_InitStruct;

0 commit comments

Comments
 (0)