Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion dfu-convert
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,25 @@ if __name__=="__main__":
except ValueError:
print "Address %s invalid." % address
sys.exit(1)
target.append({ 'address': address, 'data': data })
# The file may contain multiple sections with empty addresses in between
# which can be supported by the file so leave them out.
addrStart = None
addLast = None
for addr in ih.addresses():
ih[addr] = addr & 0xFF
if addrStart == None:
addrStart = addr
elif addr != (addrLast + 1):
# Block end!
data = ih.tobinstr(start=addrStart, end=addrLast)
target.append({ 'address': addrStart, 'data': data })
addrStart = addr
addrLast = addr
else:
data = ih.tobinstr(start=addrStart, end=addrLast)
target.append({ 'address': addrStart, 'data': data })



outfile = args[0]
device = DEFAULT_DEVICE
Expand Down