Tools: fixed python3 error in make_intel_hex.py

This commit is contained in:
Andrew Tridgell 2018-06-25 18:15:04 +10:00
parent 88ec03ce5a
commit 77929dabb3

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys, os, shutil import sys, os, shutil, struct
import intelhex import intelhex
# make two intel hex files, one including bootloader and one without # make two intel hex files, one including bootloader and one without
@ -27,7 +27,11 @@ if not os.path.exists(bootloaderfile):
sys.exit(1) sys.exit(1)
blimage = bytes(open(bootloaderfile, "rb").read()) blimage = bytes(open(bootloaderfile, "rb").read())
blimage += bytes(chr(255) * (reserve_kb * 1024 - len(blimage))) blimage += bytes(struct.pack('B',255) * (reserve_kb * 1024 - len(blimage)))
if len(blimage) != reserve_kb * 1024:
print("Bad blimage size %u" % len(blimage))
sys.exit(1)
appimage = bytes(open(binfile,"rb").read()) appimage = bytes(open(binfile,"rb").read())