diff options
author | Damien George <damien.p.george@gmail.com> | 2018-06-08 15:32:49 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-06-08 15:32:49 +1000 |
commit | 8fb95d652066b38e0dbb4fa5433de49eb601bdfe (patch) | |
tree | 7f370af0c60a5b298a582a5a2716838476b5f6aa /tools/pydfu.py | |
parent | 24c416cc66577a2cfbe8d6f01e1386340fc042f4 (diff) |
tools/pydfu.py: Increase download packet size to full 2048 bytes.
The ST DFU bootloader supports a transfer size up to 2048 bytes, so send
that much data on each download (to device) packet. This almost halves
total download time.
Diffstat (limited to 'tools/pydfu.py')
-rwxr-xr-x | tools/pydfu.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/pydfu.py b/tools/pydfu.py index 3f11de067..a33e49712 100755 --- a/tools/pydfu.py +++ b/tools/pydfu.py @@ -168,7 +168,7 @@ def write_memory(addr, buf, progress=None, progress_addr=0, progress_size=0): print ("Addr 0x%x %dKBs/%dKBs..." % (xfer_base + xfer_bytes, xfer_bytes // 1024, xfer_total // 1024)) - if progress and xfer_count % 256 == 0: + if progress and xfer_count % 2 == 0: progress(progress_addr, xfer_base + xfer_bytes - progress_addr, progress_size) @@ -176,7 +176,9 @@ def write_memory(addr, buf, progress=None, progress_addr=0, progress_size=0): set_address(xfer_base+xfer_bytes) # Send DNLOAD with fw data - chunk = min(64, xfer_total-xfer_bytes) + # the "2048" is the DFU transfer size supported by the ST DFU bootloader + # TODO: this number should be extracted from the USB config descriptor + chunk = min(2048, xfer_total-xfer_bytes) __dev.ctrl_transfer(0x21, __DFU_DNLOAD, 2, __DFU_INTERFACE, buf[xfer_bytes:xfer_bytes + chunk], __TIMEOUT) |