-
Notifications
You must be signed in to change notification settings - Fork 2k
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: improve compatibility #21107
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.
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. |
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
distutils
package (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
--port
was 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|erase
BOARD=some-board PROGRAMMER=bmp BMP_OPTIONS="--port 10.0.0.192:2000" make flash|reset|debug|erase
.Issues/PRs references
None