tools/pydfu.py: Support DFU files with elements of zero size.

Instead of raising a ZeroDivisionError, this tool now just skips any
elements in the DFU file that have zero size.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2021-02-23 14:33:31 +11:00
parent 53f5bb05a9
commit cdaec0dcaf

View File

@ -521,7 +521,7 @@ def write_elements(elements, mass_erase_used, progress=None):
data = elem["data"]
elem_size = size
elem_addr = addr
if progress:
if progress and elem_size:
progress(elem_addr, 0, elem_size)
while size > 0:
write_size = size