|
|
@ -1,6 +1,5 @@
|
|
|
|
#!/usr/bin/python3
|
|
|
|
#!/usr/bin/python3
|
|
|
|
|
|
|
|
|
|
|
|
from fusesoc.capi2.generator import Generator
|
|
|
|
|
|
|
|
from litex.build.tools import write_to_file
|
|
|
|
from litex.build.tools import write_to_file
|
|
|
|
from litex.build.tools import replace_in_file
|
|
|
|
from litex.build.tools import replace_in_file
|
|
|
|
from litex.build.generic_platform import *
|
|
|
|
from litex.build.generic_platform import *
|
|
|
@ -55,18 +54,19 @@ def build_init_code(build_dir, is_sim):
|
|
|
|
def add_var(k, v):
|
|
|
|
def add_var(k, v):
|
|
|
|
env_vars.append("{}={}\n".format(k, _makefile_escape(v)))
|
|
|
|
env_vars.append("{}={}\n".format(k, _makefile_escape(v)))
|
|
|
|
|
|
|
|
|
|
|
|
add_var("BUILD_DIR", sw_dir)
|
|
|
|
makefile = os.path.join(src_dir, "Makefile")
|
|
|
|
add_var("SRC_DIR", src_dir)
|
|
|
|
cmd = ["make", "-C", build_dir, "-f", makefile]
|
|
|
|
add_var("GENINC_DIR", sw_inc_dir)
|
|
|
|
cmd.append("BUILD_DIR=%s" % sw_dir)
|
|
|
|
add_var("LXSRC_DIR", lxbios_src_dir)
|
|
|
|
cmd.append("SRC_DIR=%s" % src_dir)
|
|
|
|
|
|
|
|
cmd.append("GENINC_DIR=%s" % sw_inc_dir)
|
|
|
|
|
|
|
|
cmd.append("LXSRC_DIR=%s" % lxbios_src_dir)
|
|
|
|
|
|
|
|
|
|
|
|
if is_sim:
|
|
|
|
if is_sim:
|
|
|
|
add_var("EXTRA_CFLAGS", "-D__SIM__")
|
|
|
|
cmd.append("EXTRA_CFLAGS=%s" % "-D__SIM__")
|
|
|
|
write_to_file(os.path.join(gen_inc_dir, "variables.mak"), "".join(env_vars))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Build init code
|
|
|
|
# Build init code
|
|
|
|
print(" Generating init software...")
|
|
|
|
print(" Generating init software...")
|
|
|
|
makefile = os.path.join(src_dir, "Makefile")
|
|
|
|
r = subprocess.check_call(cmd)
|
|
|
|
r = subprocess.check_call(["make", "-C", build_dir, "-I", gen_inc_dir, "-f", makefile])
|
|
|
|
|
|
|
|
print("Make result:", r)
|
|
|
|
print("Make result:", r)
|
|
|
|
|
|
|
|
|
|
|
|
return os.path.join(sw_dir, "obj", "sdram_init.hex")
|
|
|
|
return os.path.join(sw_dir, "obj", "sdram_init.hex")
|
|
|
|