66 Commits

Author SHA1 Message Date
Piotr Esden-Tempski
5cf4920f72 meson: Added a script to build all the existinc cross targets. 2024-10-14 13:12:13 -07:00
ALTracer
3a3558d7e1 swolisten: Add support for walking USB descriptors 2024-08-19 09:45:49 +03:00
Rafael Silva
5dd7777bfc misc: move libopencm3 submodule to deps
This avoids having 2 copies of libopencm3 in the project, the git
submodule, used by make, and the subproject cloned by meson build,
instead, both workflows share the same instance
2024-01-11 15:03:48 -08:00
dragonmux
886a523648 scripts: Cleaned up the now defunct README 2023-10-29 17:45:32 -07:00
dragonmux
0c34254a0b scripts/gdb: Removed the module as the script it was used by (hexprog) has now been removed 2023-10-29 17:45:32 -07:00
dragonmux
a7fff3e8a0 scripts/hexprog: Removed the script as it is not used any more and fell into disrepair
It doesn't help that it was entirely STM32-specific in places and doesn't use any of the main project infrastructure for being more flexible
2023-10-29 17:45:32 -07:00
dragonmux
84dda1c125 scripts/dfu: Removed the script as it is not used any more and fell into disrepair 2023-10-29 17:45:32 -07:00
dragonmux
c2989eb6e8 scripts/dfu-convert: Removed the script as it is not used any more and fell into disrepair 2023-10-29 17:45:32 -07:00
dragonmux
2bdfc3a475 scripts/bootprog: Removed the script as it is not used any more and fell into disrepair 2023-10-29 17:45:32 -07:00
dragonmux
a56e3d6b01 scripts/stubs: Removed the assembly stubs as they appear entirely unused 2023-10-29 17:45:32 -07:00
dragonmux
c724af7968 scripts/stm32_mem: Removed the utility as it was deprecated and had fallen into disrepair 2023-10-29 17:45:32 -07:00
Stoyan Shopov
6e71ce541d stlinkv3: Initial support for the stlinkv3 target
This commit adds support for the stlinkv3 target as a host for
running the blackmagic firmware.

In short, here is what has been tested:

- DFU firmware upgrade
- SWD bus driving
- JTAG bus driving
- BMP data usb cdcacm interface
- trace capture, asynchronous mode
- target voltage measurement

Not tested:

- srst driving is available, and should work, but has not been tested
2023-02-02 11:41:43 -05:00
dragonmux
089827f6ef misc: Upgraded the clang-tidy runner to include knowledge on where to find libusb, libftdi etc but without causing errors if they're not available 2022-11-16 20:04:41 -08:00
Rafael Silva
664d09786a workflows: add size diff workflow 2022-08-24 17:24:28 -04:00
dragonmux
c228176d29 stm32_mem.py: Added a deprecation notice and information on alternatives that are available 2022-08-08 22:27:44 -07:00
dragonmux
215b935b83 scripts: Created a clang-tidy runner to allow quick and easy running of clang-tidy across the code base 2022-06-26 18:55:04 -07:00
Mikaela Szekely
db4b568e52 Fix compatibility with dash as /bin/sh.
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.
2022-06-12 16:31:00 -07:00
dragonmux
e388fbbb2c script: Implemented a helper script to help build include/version.h 2022-06-12 16:31:00 -07:00
Nicolas Schodet
6c700f7b6c scripts: bootprog.py: use bytes literals 2022-04-15 11:59:40 -07:00
Nicolas Schodet
2dd3c7bae2 scripts: gdb.py: fix error messages 2022-02-13 15:31:12 -08:00
Nicolas Schodet
de834264ab scripts: hexprog.py: minor fixes
Unused import and useless semicolon.
2022-02-13 15:31:12 -08:00
Nicolas Schodet
f8f2ab2016 scripts: stm32_mem.py: change some formatting, remove unused imports 2022-02-13 15:31:12 -08:00
Nicolas Schodet
eafc634eba scripts: more conversion to Python 3, change the shebang line 2022-02-13 15:31:12 -08:00
Nicolas Schodet
d9cce4d5e8 scripts: convert bootprog.py to Python 3
Tested with a stm32f100 bootloader.
2022-02-13 15:31:12 -08:00
Nicolas Schodet
ca9d8cd0ae scripts: fix dfu-convert.py for Python 3 and drop Python 2 support 2022-02-13 15:31:12 -08:00
Nicolas Schodet
5c07d6170f scripts: remove import from future which imports from the past
There is no point to support Python 2.
2022-01-04 00:57:48 -08:00
Nicolas Schodet
946ccab778 scripts: stm32_mem cosmetic changes
Add a newline to avoid overwriting the last "Programming memory..."
message.

Remove inline tabs.
2022-01-04 00:57:48 -08:00
Nicolas Schodet
ad6c1eb11b scripts: fix stm32_mem.py for python 3
Python 3 does not accept a characters string where a bytes string is
needed.
2022-01-04 00:57:48 -08:00
Mark Rages
f43101fd9f Port gdb.py and hexprog.py to Python 3.
Unfortunately, the serial data are not 7-bit clean (see write_mem()).
So getpacket() and putpacket() use bytes objects rather than strings.
2021-12-19 14:45:51 -08:00
Piotr Esden-Tempski
fcb2a609fc scripts: Updated nrf51 id script for py3 and to parse newer oocd header. 2021-12-19 14:45:51 -08:00
Piotr Esden-Tempski
728e955193 scripts: Updated bootprog to run on python3 2021-12-19 14:45:45 -08:00
Uwe Bonnes
df575eb090 stm32_mem.py: Wait longer for device to appear. 2021-05-20 12:06:56 +02:00
Uwe Bonnes
e65ee7124b stm32_mem: Handle utf8 for print and compare. 2020-12-06 15:18:08 +01:00
Stefan Agner
77025d4b6b Make dfu-convert.py Python 3 capable 2020-11-29 15:45:08 +01:00
Thomas Jarosch
2641291874 stm32_mem: Fix python3 crash due to mix of tabs and spaces
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.
2020-09-04 14:19:19 +02:00
Pieter du Preez
d55cea871d Fixed overrun and formatting, when dumping data in swolisten.
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.
2020-04-20 00:19:30 +02:00
Uwe Bonnes
e57792c95e stm32_mem: Check file size before flashing(#614)
stm32mem is only meant to flash BMP to a STM32F103x(8|B). No need to
decipher the DFU interface string.
2020-03-22 16:40:06 +01:00
Uwe Bonnes
fc3abf26ef stm32_mem: Fix native crashing in dfu-detach when repeatedly flashed. 2019-09-28 21:28:35 +02:00
Theodor M
052b5f830a Made script executable with python3.
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.
2019-08-30 15:09:35 +02:00
Nikolay Dimitrov
29386aee14 scripts/stm32_mem: Fix issue with scanning USB DFU devices
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>
2018-09-17 14:36:28 +12:00
Uwe Bonnes
7908ba526b stm32_mem: Guard dfu.dfu_device with try/except. 2018-07-18 23:31:55 +02:00
Uwe Bonnes
29cdba0d70 SWO: Some explanations and a test program. 2018-03-27 13:40:49 +02:00
jrwhite
0ddd8b55d7 divide-by-zero fix 2018-03-11 14:35:38 -05:00
Uwe Bonnes
dc29e45606 stm32_mem: Really wait 5 seconds for DFU device to appear. 2017-10-04 21:53:53 +02:00
Uwe Bonnes
2b2b6d8f31 stm32_mem.py: Allow to set start address. 2017-10-02 21:30:56 +02:00
Uwe Bonnes
7cc9ee9d7a stm32_mem.py: Verify after write when bootloader supports upload
This should help people using STM32F103C8 above 64 k.
2017-10-02 21:30:56 +02:00
Uwe Bonnes
613208c939 stm32_mem: Allow to switch from dfu to application without flashing. 2017-10-02 21:30:56 +02:00
Uwe Bonnes
c41dfaef9a stm32_mem.py: Run automatically after switching to DFU mode. 2017-10-02 21:30:56 +02:00
Uwe Bonnes
4f3f4cb898 stm32_mem.py: Deny to work with the STM DFU bootloader
To support the STM DFU bootloader, the interface descriptor needs to be
evaluated. Erase may only be called once per sector.
2017-10-02 21:30:56 +02:00
Uwe Bonnes
4c6f735452 stm32_mem.py: Handle multiple devices. 2017-10-02 21:30:56 +02:00