Files
lab-rv32i-freertos-c-resour…/vendor/Hazard3/scripts/mkflashexec
T

15 lines
356 B
Python
Executable File

#!/usr/bin/env python3
import argparse
import struct
parser = argparse.ArgumentParser()
parser.add_argument("ifile")
parser.add_argument("ofile")
args = parser.parse_args()
data = open(args.ifile, "rb").read()
with open(args.ofile, "wb") as ofile:
ofile.write("RISCBoy".encode() + bytes(1))
ofile.write(struct.pack("<L", len(data)))
ofile.write(data)