Question
Broken: Detect Debugger Active on Cortex-M0
For a long time, on STM32F0, I have been using the RCC_APB2ENR_DBGMCUEN bit as a reliable indication that a debug session is active with CubeIDE - see:
But this seems to have broken recently:
- It now seems that
RCC_APB2ENR_DBGMCUENis not set unless the ‘Debug in low power modes’ option is set in the Debug Configuration. - Even when
RCC_APB2ENR_DBGMCUENis set at the start of a debug session, doing a Reset during the session (‘Reset’ button on the toolbar) will clear it.
Or was this always the case, and I just happened to be (un)lucky enough never to notice it?
PS:
As noted in the linked thread, the DEBUGEN bit in DHCSR (the Debug Halting Control and Status Register) is not available on Cortex-M0 - so that cannot be used.
