mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-05 15:33:57 -04:00
waf: added a --bootloader configure option
this selects hwdef-bl.dat instead of hwdef.dat, allowing for bootloader config to be kept in the same directory as the main hwdef.dat
This commit is contained in:
parent
3fc6824bfb
commit
0ae25787c0
@ -236,13 +236,16 @@ def configure(cfg):
|
|||||||
# that is needed by the remaining configure checks
|
# that is needed by the remaining configure checks
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
hwdef = srcpath('libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef.dat' % env.BOARD)
|
if env.BOOTLOADER:
|
||||||
|
env.HWDEF = srcpath('libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef-bl.dat' % env.BOARD)
|
||||||
|
else:
|
||||||
|
env.HWDEF = srcpath('libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef.dat' % env.BOARD)
|
||||||
hwdef_script = srcpath('libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py')
|
hwdef_script = srcpath('libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py')
|
||||||
hwdef_out = env.BUILDROOT
|
hwdef_out = env.BUILDROOT
|
||||||
if not os.path.exists(hwdef_out):
|
if not os.path.exists(hwdef_out):
|
||||||
os.mkdir(hwdef_out)
|
os.mkdir(hwdef_out)
|
||||||
try:
|
try:
|
||||||
cmd = "python '{0}' -D '{1}' '{2}'".format(hwdef_script, hwdef_out, hwdef)
|
cmd = "python '{0}' -D '{1}' '{2}'".format(hwdef_script, hwdef_out, env.HWDEF)
|
||||||
ret = subprocess.call(cmd, shell=True)
|
ret = subprocess.call(cmd, shell=True)
|
||||||
except Exception:
|
except Exception:
|
||||||
cfg.fatal("Failed to process hwdef.dat")
|
cfg.fatal("Failed to process hwdef.dat")
|
||||||
@ -262,8 +265,8 @@ def pre_build(bld):
|
|||||||
def build(bld):
|
def build(bld):
|
||||||
bld(
|
bld(
|
||||||
# build hwdef.h and apj.prototype from hwdef.dat. This is needed after a waf clean
|
# build hwdef.h and apj.prototype from hwdef.dat. This is needed after a waf clean
|
||||||
source=bld.path.ant_glob('libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef.dat' % bld.env.get_flat('BOARD')),
|
source=bld.path.ant_glob(bld.env.HWDEF),
|
||||||
rule="python '${AP_HAL_ROOT}/hwdef/scripts/chibios_hwdef.py' -D '${BUILDROOT}' '${AP_HAL_ROOT}/hwdef/${BOARD}/hwdef.dat'",
|
rule="python '${AP_HAL_ROOT}/hwdef/scripts/chibios_hwdef.py' -D '${BUILDROOT}' %s" % bld.env.HWDEF,
|
||||||
group='dynamic_sources',
|
group='dynamic_sources',
|
||||||
target=['hwdef.h', 'apj.prototype', 'ldscript.ld']
|
target=['hwdef.h', 'apj.prototype', 'ldscript.ld']
|
||||||
)
|
)
|
||||||
|
8
wscript
8
wscript
@ -67,6 +67,11 @@ def options(opt):
|
|||||||
default=False,
|
default=False,
|
||||||
help='Configure as debug variant.')
|
help='Configure as debug variant.')
|
||||||
|
|
||||||
|
g.add_option('--bootloader',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help='Configure for building a bootloader.')
|
||||||
|
|
||||||
g.add_option('--no-autoconfig',
|
g.add_option('--no-autoconfig',
|
||||||
dest='autoconfig',
|
dest='autoconfig',
|
||||||
action='store_false',
|
action='store_false',
|
||||||
@ -161,12 +166,15 @@ def configure(cfg):
|
|||||||
cfg.env.AUTOCONFIG = cfg.options.autoconfig
|
cfg.env.AUTOCONFIG = cfg.options.autoconfig
|
||||||
|
|
||||||
cfg.env.VARIANT = cfg.env.BOARD
|
cfg.env.VARIANT = cfg.env.BOARD
|
||||||
|
if cfg.options.bootloader:
|
||||||
|
cfg.env.VARIANT += '-bootloader'
|
||||||
|
|
||||||
_set_build_context_variant(cfg.env.VARIANT)
|
_set_build_context_variant(cfg.env.VARIANT)
|
||||||
cfg.setenv(cfg.env.VARIANT)
|
cfg.setenv(cfg.env.VARIANT)
|
||||||
|
|
||||||
cfg.env.BOARD = cfg.options.board
|
cfg.env.BOARD = cfg.options.board
|
||||||
cfg.env.DEBUG = cfg.options.debug
|
cfg.env.DEBUG = cfg.options.debug
|
||||||
|
cfg.env.BOOTLOADER = cfg.options.bootloader
|
||||||
|
|
||||||
# Allow to differentiate our build from the make build
|
# Allow to differentiate our build from the make build
|
||||||
cfg.define('WAF_BUILD', 1)
|
cfg.define('WAF_BUILD', 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user