2021-05-18 03:45 AM
I use to develop with IAR.
I try to go to STM32CubeIDE.
I cannot find the way to stepping debug a program if an interrupt timer is running in background.
Is there an option like IAR "disable interrupts when stepping"
Thanks
Solved! Go to Solution.
2021-05-27 02:00 AM
In general when the debugger steps through code we should set the DHCSR -> C_MASKINTS which will make sure the core does not enter an interrupt handler. In generl this works well across the STM32 protfolio. With the exception of a few Cortex-M7 based MCUs. STM32F746 is one of them. It contains an older core revision where the stepping behavior is different. See the link above.
So in your case the only option would be to set the freeze registers for all timers that you use.
2021-05-20 02:18 AM
Hi,
No there is no check-box to do this. Instead you will need either do it in code or as GDB run commands.
Easiest is probably to do it in code like this:
#ifdef DEBUG
__HAL_DBGMCU_FREEZE_TIM2();
#endif
Have a look at: stm32h7xx_hal.h (or equivalent xyz_hal.h file depending on your STM32 product)
2021-05-20 11:01 PM
By the way which MCU are you using? There were some issues in early Arm revision of the Cortex-M7 with respect to single-stepping and interrupt firing (not being masked).
See this link: https://developer.arm.com/documentation/ka002944/latest
I think these issues are part of some STM32F7 products. Maybe some others STM32 products.
2021-05-21 01:22 AM
Thanks Mattias.
Here you talk about TIM2 in you example, but I have to do this with all interrupt ?
Will the interrupt continu working when MCU is in Debug Running mode ?
I am using STM32F746
2021-05-21 01:47 AM
You need to do this for all timers which you are using only, specially with timers for RTOS (if you have one)
2021-05-27 02:00 AM
In general when the debugger steps through code we should set the DHCSR -> C_MASKINTS which will make sure the core does not enter an interrupt handler. In generl this works well across the STM32 protfolio. With the exception of a few Cortex-M7 based MCUs. STM32F746 is one of them. It contains an older core revision where the stepping behavior is different. See the link above.
So in your case the only option would be to set the freeze registers for all timers that you use.
2021-06-05 07:20 AM
The solution to the problem is in my post there:
Just ignore that one stubborn individual... I don't know if it works with OpenOCD or whatever is used in CubeIDE by default, but it definitely works with SEGGER's GDB Server.