Skip to content
Snippets Groups Projects
Commit 6e50df4e authored by roland's avatar roland Committed by Damien George
Browse files

tools/dfu.py: Pad image data to 8 byte alignment to support L476.

Thanks to @dhylands for this patch to pad the image to 8-byte boundaries.
parent b7004efe
No related branches found
No related tags found
No related merge requests found
...@@ -60,6 +60,10 @@ def build(file,targets,device=DEFAULT_DEVICE): ...@@ -60,6 +60,10 @@ def build(file,targets,device=DEFAULT_DEVICE):
for t,target in enumerate(targets): for t,target in enumerate(targets):
tdata = b'' tdata = b''
for image in target: for image in target:
# pad image to 8 bytes (needed at least for L476)
pad = (8 - len(image['data']) % 8 ) % 8
image['data'] = image['data'] + bytes(bytearray(8)[0:pad])
#
tdata += struct.pack('<2I',image['address'],len(image['data']))+image['data'] tdata += struct.pack('<2I',image['address'],len(image['data']))+image['data']
tdata = struct.pack('<6sBI255s2I',b'Target',0,1, b'ST...',len(tdata),len(target)) + tdata tdata = struct.pack('<6sBI255s2I',b'Target',0,1, b'ST...',len(tdata),len(target)) + tdata
data += tdata data += tdata
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment