Commit Graph

35 Commits

Author SHA1 Message Date
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
Uwe Bonnes 1be9c6e9c5 stm32_mem.py: Set address before writing to inhibit bootloader overwrite. 2017-07-22 13:25:48 +02:00
Nicolas Schodet 73ac700c6f Fix gdb.py to program last chunk of a memory range 2017-06-15 16:20:02 +02:00
Gareth McMullin 9141418bd4 Merge pull request #80 from gsmcmullin/hydrabus
Add HydraBus support
2016-04-15 13:00:52 -07:00
Mark Rages 7d957cbfdf Update nRF51 IDs, add nRF51422 and xxAB/xxAC devices.
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.
2015-12-17 17:50:41 -07:00
Gareth McMullin 97824b7f02 Use git describe for version in generated header file. 2015-04-03 20:21:33 -07:00
Benjamin Vernoux 9f0c29d329 Add support for HydraBus (tested with SWD with STM32F405 and SWD+JTAG with LPC4330 M0/M4) 2015-03-04 20:22:00 -08:00
Fergus Noble 7c3c9fdea3 Update python scripts to find user's preferred python binary through env. 2013-05-02 11:32:24 -07:00
Gareth McMullin 530ee15153 Correct upload script for detection of F1/F4 start address. 2013-02-20 10:55:52 +13:00
Uwe Bonnes 06c2d52c59 stm32_mem.py: Add exception handler for better diagnosis, as erase on STM32F407 times out 2013-01-21 11:02:44 +01:00
Uwe Bonnes 5e71ea3f60 stm32_mem: Allow to select the programmer with the serial number 2013-01-21 11:02:44 +01:00
Gareth McMullin b52c62266a Fixed hexprog.py to work with current firmware 'g' packet. 2012-01-30 22:14:31 +13:00
Gareth McMullin 6a6b52bf54 Fixed python scripts for programming target to work on 64-bit machines. 2011-11-12 13:47:50 +13:00
Gareth McMullin 0dfdc25bb2 Added git info to version output.
Fixed memory leak in SWD mode.
2011-02-18 13:50:21 +13:00
Gareth McMullin 8b65e8e259 Fixed dfu.py to work with PyUSB 1.0. 2011-02-17 16:48:15 +13:00
Gareth McMullin 4b105beb61 Fixed printed copyright notices in scripts.
hexprog.py now defaults to target 1.
2011-02-09 12:06:50 +13:00
Gareth McMullin 69d790fcf6 Added programming scripts. 2011-02-04 20:25:12 +13:00