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.
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.
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.
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.
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: https://github.com/RIOT-OS/RIOT/issues/20604
The flashing script for the black magic probe stopped working with pygdbmi in
version 0.10.0 due to an API change. This adapts the code to first try
initialization with the old pygdbmi API (as before), but tries again with the
new API if that fails.
This script can detect [Black Magic Probes](https://github.com/blacksphere/blackmagic/wiki) and act as a flashloader (and more).
It is compatible with Linux and macOS.
All important options that can be set via the monitor command are available as arguments.
Makefiles for using `make flash`, `make erase`, `make debug` and `make term` with the script are included.