allow BIOS data to be passed to design

This commit is contained in:
Sebastien Bourdeauducq 2013-11-24 22:14:46 +01:00
parent 257185cc9c
commit 07fc110fc1
1 changed files with 23 additions and 8 deletions

31
make.py
View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
import argparse, importlib, subprocess
import argparse, importlib, subprocess, struct
from mibuild.tools import write_to_file
@ -50,13 +50,8 @@ def main():
top_kwargs = dict((k, eval(v)) for k, v in args.option)
soc = top_class(platform, **top_kwargs)
if not args.no_bitstream:
platform.build(soc, build_name=build_name)
subprocess.call(["tools/byteswap",
"build/" + build_name + ".bin",
"build/" + build_name + ".fpg"])
else:
soc.finalize()
soc.finalize()
if not args.no_header:
boilerplate = """/*
* Platform: {}
@ -75,6 +70,26 @@ def main():
csr_csv = cpuif.get_csr_csv(soc.csr_base, soc.csrbankarray)
write_to_file(args.csr_csv, csr_csv)
if hasattr(soc, "init_bios_memory"):
ret = subprocess.call(["make", "-C", "software/bios"])
if ret:
raise OSError("BIOS build failed")
bios_file = open("software/bios/bios.bin", "rb")
bios_data = []
while True:
w = bios_file.read(4)
if not w:
break
bios_data.append(struct.unpack(">I", w)[0])
bios_file.close()
soc.init_bios_memory(bios_data)
if not args.no_bitstream:
platform.build(soc, build_name=build_name)
subprocess.call(["tools/byteswap",
"build/" + build_name + ".bin",
"build/" + build_name + ".fpg"])
if args.load:
jtag.load("build/" + build_name + ".bit")
if args.flash: