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 de449d1314
commit 0d666eaf29

View File

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