Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dfu-convert now supports handling multiple non continues sections. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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