Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: STM32 DBGMCU attach/detach behaviour #2013

Merged
merged 12 commits into from
Dec 11, 2024

Conversation

dragonmux
Copy link
Member

@dragonmux dragonmux commented Dec 9, 2024

Detailed description

In #1882 we introduced control of the WDT halt state to prevent debug sessions getting clobbered by them while the part is intentionally halted. In that PR we stored the state of the DBGMCU on attach, and restored it on detach - which on its face seems like a reasonable heuristic, however.. we worried at the time and have since had that fear confirmed that this doesn't work well because both the user code and the debugger can change the state of the DBGMCU register in question itself to do things like enabling tracing, and users want to be able to detach from the target to leave tracing running.

In the scenario outlined above, however, BMD will disable tracing by restoring the pre-image of the DBGMCU control register, and undo any other freeze configuration by restoring the freeze register for the WDTs and this breaks setups and re-disables tracing. This PR fixes that by always doing a RMW cycle on the registers regardless and dropping the stored state component.

We also include a small fix for some Flash size issues to restore the build on the swlink platform.

Your checklist for this pull request

Closing issues

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
…age copy of the register state so we're insensitive to the debugged firmware changing the state at runtime

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
…age copy of the register state so we're insensitive to the debugged firmware changing the state at runtime

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
…nction, restructuring the probe vs attach code slightly

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
…age copy of the register state so we're insensitive to the debugged firmware changing the state at runtime

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
…age copy of the register state so we're insensitive to the debugged firmware changing the state at runtime

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
…age copy of the register state so we're insensitive to the debugged firmware changing the state at runtime

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
…age copy of the register state so we're insensitive to the debugged firmware changing the state at runtime

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
…age copy of the register state so we're insensitive to the debugged firmware changing the state at runtime
@dragonmux dragonmux added the Bug Confirmed bug label Dec 9, 2024
@dragonmux dragonmux added this to the v2.0 release milestone Dec 9, 2024
@dragonmux dragonmux requested a review from esden December 9, 2024 17:31
@dragonmux dragonmux force-pushed the fix/stm32-wdt-attach-detach-behaviour branch from 721dabf to 85fa0db Compare December 9, 2024 18:33

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
…dic " part of the part strings as other target implementations do not include the MFR in the identifier for space reasons

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
… solve the out of Flash space problem

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
@dragonmux dragonmux force-pushed the fix/stm32-wdt-attach-detach-behaviour branch from b6ab21a to b10a119 Compare December 9, 2024 18:36

Verified

This commit was signed with the committer’s verified signature.
dragonmux Rachel Mant
…to solve the out of Flash space problem
Copy link
Member

@esden esden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@esden esden merged commit 75102a9 into main Dec 11, 2024
36 checks passed
@dragonmux dragonmux deleted the fix/stm32-wdt-attach-detach-behaviour branch December 11, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants