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

dist/tools/bmp: fix target parsing #20661

Merged
merged 1 commit into from
May 10, 2024
Merged

Conversation

maribu
Copy link
Member

@maribu maribu commented May 9, 2024

Contribution description

Either GDB or pygdbmi changed behavior to trim off whitespace following the message, resulting in the \\n at the end of the regex no longer matching. This replaces the \\n with \s* to match both old and new output.

Fixes: #20604

Testing procedure

Run make BOARD=nrf52840dk PROGRAMMER=bmp flash with a black magic probe, a cheaper Jeff Probe, or an even cheaper ST-Link V2 clone with BMP firmware flashed used as debugger.

In master this yields (with recent version of GDB and pygdbmi installed):

found following Black Magic GDB servers:
	[/dev/ttyACM0] Serial: 3D8E4CC3 <- default 
connecting to [/dev/ttyACM0]...
connecting successful.
scanning using SWD...
res = [{'type': 'log', 'message': None, 'payload': 'monitor swdp_scan\n', 'stream': 'stdout'}, {'type': 'target', 'message': None, 'payload': 'Target voltage: 3.0V\n', 'stream': 'stdout'}]
targets = []
Traceback (most recent call last):
  File "/home/maribu/Repos/software/RIOT/master/dist/tools/bmp/bmp.py", line 272, in <module>
    gdbmi = connect_to_target(port)
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/maribu/Repos/software/RIOT/master/dist/tools/bmp/bmp.py", line 245, in connect_to_target
    assert len(targets) > 0, "no targets found"
           ^^^^^^^^^^^^^^^^
AssertionError: no targets found
make: *** [/home/maribu/Repos/software/RIOT/master/examples/hello-world/../../Makefile.include:849: flash] Error 1

With this PR, this yields:

found following Black Magic GDB servers:
	[/dev/ttyACM0] Serial: 3D8E4CC3 <- default 
connecting to [/dev/ttyACM0]...
connecting successful.
scanning using SWD...
found following targets:
	Nordic nRF52 M4
	Nordic nRF52 Access Port 

attaching to target successful.
downloading... total size: 1.2M
downloading section [.text] (8.4K)
100%|###################################################################################################################################################################|
downloading section [.ARM.exidx] (8B)
100%|###################################################################################################################################################################|
downloading section [.eh_frame] (80B)
100%|###################################################################################################################################################################|
downloading section [.relocate] (100B)
100%|###################################################################################################################################################################|
downloading finished
checking successful
killing successful.
- |#                                                                                                                                            | 0 Elapsed Time: 0:00:00

Issues/PRs references

Fixes: #20604

Either GDB or pygdbmi changed behavior to trim off whitespace following
the message, resulting in the `\\n` at the end of the regex no longer
matching. This replaces the `\\n` with `\s*` to match both old and new
output.

Fixes: RIOT-OS#20604
@maribu maribu added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: tools Area: Supplementary tools labels May 9, 2024
@riot-ci
Copy link

riot-ci commented May 9, 2024

Murdock results

✔️ PASSED

c56f50a dist/tools/bmp: fix target parsing

Success Failures Total Runtime
1 0 1 01m:08s

Artifacts

@benpicco benpicco enabled auto-merge May 10, 2024 16:53
@benpicco benpicco added this pull request to the merge queue May 10, 2024
Merged via the queue into RIOT-OS:master with commit c2e1a8e May 10, 2024
29 checks passed
@maribu maribu deleted the dist/tools/bmp branch May 10, 2024 16:58
@maribu
Copy link
Member Author

maribu commented May 10, 2024

Thx :)

@mguetschow mguetschow added this to the Release 2024.07 milestone Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BlackMagicProbe does not recognize nRF52 device
4 participants