waf: use new syntax for chibios_hwdef.py

This commit is contained in:
Andrew Tridgell 2021-06-21 15:04:52 +10:00
parent b4b02b4ffc
commit d6088539b7
1 changed files with 16 additions and 4 deletions

View File

@ -382,9 +382,11 @@ def generate_hwdef_h(env):
if not os.path.exists(hwdef_out):
os.mkdir(hwdef_out)
python = sys.executable
cmd = "{0} '{1}' -D '{2}' '{3}' {4} --params '{5}'".format(python, hwdef_script, hwdef_out, env.HWDEF, env.BOOTLOADER_OPTION, env.DEFAULT_PARAMETERS)
cmd = "{0} '{1}' -D '{2}' --params '{3}' '{4}'".format(python, hwdef_script, hwdef_out, env.DEFAULT_PARAMETERS, env.HWDEF)
if env.HWDEF_EXTRA:
cmd += " --extra-hwdef '{0}'".format(env.HWDEF_EXTRA)
cmd += " '{0}'".format(env.HWDEF_EXTRA)
if env.BOOTLOADER_OPTION:
cmd += " " + env.BOOTLOADER_OPTION
return subprocess.call(cmd, shell=True)
def pre_build(bld):
@ -405,11 +407,21 @@ def pre_build(bld):
def build(bld):
hwdef_rule="%s '%s/hwdef/scripts/chibios_hwdef.py' -D '%s' --params '%s' '%s'" % (
bld.env.get_flat('PYTHON'),
bld.env.AP_HAL_ROOT,
bld.env.BUILDROOT,
bld.env.default_parameters,
bld.env.HWDEF)
if bld.env.HWDEF_EXTRA:
hwdef_rule += " " + bld.env.HWDEF_EXTRA
if bld.env.BOOTLOADER_OPTION:
hwdef_rule += " " + bld.env.BOOTLOADER_OPTION
bld(
# build hwdef.h from hwdef.dat. This is needed after a waf clean
source=bld.path.ant_glob(bld.env.HWDEF),
rule="%s '${AP_HAL_ROOT}/hwdef/scripts/chibios_hwdef.py' -D '${BUILDROOT}' '%s' %s --params '%s'" % (
bld.env.get_flat('PYTHON'), bld.env.HWDEF, bld.env.BOOTLOADER_OPTION, bld.env.default_parameters),
rule=hwdef_rule,
group='dynamic_sources',
target=[bld.bldnode.find_or_declare('hwdef.h'),
bld.bldnode.find_or_declare('ldscript.ld'),