Ubuntu's default /bin/sh is dash, which does not support the `&>`
redirection syntax. This commit moves version.h generation back into the
Makefile, as 8afaedd had it, but restores compatibility with
GNU Make < 4.0, which 8afaedd, broke. This also fixes building on macOS,
as macOS bundles GNU Make 3.81.
Fixes this issue:
$ python3 ./stm32_mem.py blackmagic.bin
File "./stm32_mem.py", line 199
if (os.path.getsize(args.progfile) > 0x1f800):
^
TabError: inconsistent use of tabs and spaces in indentation
and allows to run with python2 too.
The swolisten program failed to print the cbw buffer correctly while
in dump mode. As printf() is used to print the dump, it is expected
that the cbw buffer is zero-terminated, which would only be
the case, if the cbw buffer is initialized with zeros, before filling it
with new data. One could set the entire cbw buffer to zero, but it
will be more efficient to only set the size-th byte to zero.
Furthermore, if a '%' character appears in the data, printf() will
attempt to format it, causing unexpected results.
This patch fixes the above 2 problems, by:
1. using the size variable to set the size-th byte of the cbw
buffer to zero, before passing it to printf().
2. calling printf() with a "%s" formatting string, followed by the
data buffer, cbw.
Added braces for compatibility with python3, should still be valid python2 which interpretes these braces as a tuple with a single element and simplifies it to that element.
Replaced whitespaces with tabs as required by python3, since indentation must be uniform (either whitespaces or tabs).
Removed trailing whitespaces.
Tested by flashing various STM32 boards with blackmagic firmware using python3.7.
While scanning the USB bus for devices, stm32_scan() can find a device that it
doesn't have permissions to access it, dfu/usb class raises an exception and
stm32_scan() stops the scan completely.
This fix resolves the scan issue, by allowing the scan loop to continue.
While at it, there are cosmetic fixes related with tabs/spaces and readability.
Signed-off-by: Nikolay Dimitrov <nikolay.dimitrov@retrohub.org>
There were a lot of nRF51 device ids missing. I wrote a script to pull nRF51 IDs from the openocd repository, which seems to be more up-to-date. The script's output goes in nrf51.c.