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: CMSIS-DAP transfer failure handling #1564

Merged
merged 4 commits into from
Jul 27, 2023

Conversation

dragonmux
Copy link
Member

Detailed description

While helping Sid debug some really curious target behaviour from the Ambiq Apollo SoC's, he ran into an issue where ORBTrace would report the device gave a no-response response to a DAP_TRANSFER and BMDA would fail to pick up on that, pretending the DP register read worked just fine and gave a response of 0.

This PR corrects this behaviour by improving the perform_dap_transfer() error handling, allowing the detection of sequences such as

-> dap_transfer (1 requests)
 command: 05 00 01 06
response: 05 01 01 00 00 00 f4
dap_read_reg: 04 -> f4000000
dp_read 0004 f4000000
Read CTRL/STAT: 0xf4000000
-> dap_transfer (1 requests)
 command: 05 00 01 06
response: 05 01 07
dp_read 0004 00000000
Read CTRL/STAT: 0x00000000

With this change, the request will by noted as having triggered no-response and dap_dp_reg_read() will attempt to perform protocol recovery and re-try the read.

Your checklist for this pull request

  • I've read the Code of Conduct
  • I've read the guidelines for contributing to this repository
  • It builds for hardware native (make PROBE_HOST=native)
  • It builds as BMDA (make PROBE_HOST=hosted)
  • I've tested it to the best of my ability
  • My commit messages provide a useful short description of what the commits do

Closing issues

@dragonmux dragonmux added Bug Confirmed bug BMD App Black Magic Debug App (aka. PC hosted) (not firmware) labels Jul 24, 2023
@dragonmux dragonmux added this to the v1.10 milestone Jul 24, 2023
@dragonmux dragonmux force-pushed the fix/cmsis-dap-transfer-failure-handling branch from 7783679 to bad27de Compare July 26, 2023 02:19
@dragonmux dragonmux requested a review from esden July 26, 2023 02:20
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 6d32171 into main Jul 27, 2023
6 checks passed
@dragonmux dragonmux deleted the fix/cmsis-dap-transfer-failure-handling branch July 27, 2023 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BMD App Black Magic Debug App (aka. PC hosted) (not firmware) Bug Confirmed bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants