Set thumb and executable attributes on padded boot2

This commit is contained in:
Luke Wren 2021-01-31 22:06:50 +00:00 committed by Graham Sanderson
parent 3073cdd802
commit 095091208a

View File

@ -45,7 +45,9 @@ odata = idata_padded + struct.pack("<L", checksum)
try:
with open(args.ofile, "w") as ofile:
ofile.write("// Padded and checksummed version of: {}\n\n".format(args.ifile))
ofile.write(".section .boot2, \"a\"\n\n")
ofile.write(".cpu cortex-m0plus\n")
ofile.write(".thumb\n\n")
ofile.write(".section .boot2, \"ax\"\n\n")
for offs in range(0, len(odata), 16):
chunk = odata[offs:min(offs + 16, len(odata))]
ofile.write(".byte {}\n".format(", ".join("0x{:02x}".format(b) for b in chunk)))