Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Detailed description
In this PR we address issues found while trying to debug STM32WL55 discovery. This process found bugs in both the error recovery implementation for SWD, and in the remote protocol.
On the SWD side, the error detection code failed to properly notice when a read of the DP's CTRL/STAT register failed and then properly handle that with protocol recovery. This slightly complicates the routine, but makes the error discovery and recovery process significantly more robust.
On the remote protocol side, the protocol failed to transfer the TARGETSEL value to use for a given DP for SWD multi-drop, resulting in protocol recovery failing to execute correctly to re-select the target and resume communications. This is corrected by addition of a new command for transferring this information to the shadow DP the probe maintains. Users running firmware from before this point will get a neat message displayed from BMDA informing them of the need to upgrade their firmware.
Your checklist for this pull request
Closing issues
Fixes #2033