dist/tools/bmp: improve compatibility#21107
Merged
maribu merged 6 commits intoRIOT-OS:masterfrom Jan 10, 2025
Merged
Conversation
Python 3.12 removed the `distutils` package, which is only used for checking if GDB is available on PATH. The `shutil.which` method does the same, and is available since Python 3.3.
Per conventions: - Put main code in a function. - Move argument parsing to separate function to not pollute global scope. This does mean that all invocations now need `args` as an additional argument.
Print action to console for reset and flash action, similar to the erase action.
The tool would always exit if no probes are detected, even if `--port` was provided. By making this assertion conditional, it becomes possible to override the port in any case. Use cases for this is running the BMP externally, and connecto to it via ser2net, for example.
Some commands have been renamed since version 1.9.0 and 1.10.0. To still provide compatibility with older debuggers, allow one to override the firmware version assumed. A dependency for packaging was added for comparing version numbers.
maribu
approved these changes
Jan 10, 2025
Member
|
Thx. This sadly adds a bit more overhead for the Jeff Probe, which is a very affordable but sadly uses an outdated downstream version of the BMP firmware. I think I can add a best effort auto-detection of the firmware version that will work when pyudev is available (so only on Linux systems) and when the firmware is an actual release and not a dev snapshot. But that should restore the "just works" behavior for most users. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Contribution description
The Black Magic Probe is a great debugger. Current implementation does not work with more modern firmware versions, because some commands have been renamed. Further more, Python 3.12 deprecated the
distutilspackage (removed in 3.13), so this tool did not work on my machine.Compatibility with older firmware versions has been maintained (or at least, I tried). I first wanted to implement auto--detection of the firmware version, but that does not work with debug mode in the current state.
I also cleaned up the code a tiny bit, and made things a bit more logical (IMHO).
Before, port detection would always throw an exception if no debugger was found, even if
--portwas provided. I relaxed this check, which gives me the possibility to provide any port. In my particular use-case, I run the debugger viaser2net, so local detection would not work.Created separate commits with all changes. Will squash once approved.
Testing procedure
I tested this as follows:
BOARD=some-board PROGRAMMER=bmp make flash|reset|debug|eraseBOARD=some-board PROGRAMMER=bmp BMP_OPTIONS="--port 10.0.0.192:2000" make flash|reset|debug|erase.Issues/PRs references
None