mirror of https://github.com/ArduPilot/ardupilot
waf: allow build with ardupilot as a module
This commit is contained in:
parent
6fda5b946e
commit
9eb3a976bc
|
@ -439,6 +439,15 @@ def add_dynamic_boards_chibios():
|
|||
if os.path.exists(hwdef):
|
||||
newclass = type(d, (chibios,), {'name': d})
|
||||
|
||||
@conf
|
||||
def get_chibios_board_cls(ctx, name, hwdef):
|
||||
if name in _board_classes.keys():
|
||||
_board_classes[name].hwdef = hwdef
|
||||
return _board_classes[name]
|
||||
newclass = type(name, (chibios,), {'name': name})
|
||||
newclass.hwdef = hwdef
|
||||
return newclass
|
||||
|
||||
def add_dynamic_boards_esp32():
|
||||
'''add boards based on existance of hwdef.dat in subdirectories for ESP32'''
|
||||
dirname, dirlist, filenames = next(os.walk('libraries/AP_HAL_ESP32/hwdef'))
|
||||
|
@ -759,6 +768,8 @@ class chibios(Board):
|
|||
toolchain = 'arm-none-eabi'
|
||||
|
||||
def configure_env(self, cfg, env):
|
||||
if hasattr(self, 'hwdef'):
|
||||
cfg.env.HWDEF = self.hwdef
|
||||
super(chibios, self).configure_env(cfg, env)
|
||||
|
||||
cfg.load('chibios')
|
||||
|
|
|
@ -455,13 +455,18 @@ def configure(cfg):
|
|||
def generate_hwdef_h(env):
|
||||
'''run chibios_hwdef.py'''
|
||||
import subprocess
|
||||
|
||||
if env.BOOTLOADER:
|
||||
env.HWDEF = os.path.join(env.SRCROOT, 'libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef-bl.dat' % env.BOARD)
|
||||
if len(env.HWDEF) == 0:
|
||||
env.HWDEF = os.path.join(env.SRCROOT, 'libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef-bl.dat' % env.BOARD)
|
||||
else:
|
||||
# update to using hwdef-bl.dat
|
||||
env.HWDEF = env.HWDEF.replace('hwdef.dat', 'hwdef-bl.dat')
|
||||
env.BOOTLOADER_OPTION="--bootloader"
|
||||
else:
|
||||
env.HWDEF = os.path.join(env.SRCROOT, 'libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef.dat' % env.BOARD)
|
||||
if len(env.HWDEF) == 0:
|
||||
env.HWDEF = os.path.join(env.SRCROOT, 'libraries/AP_HAL_ChibiOS/hwdef/%s/hwdef.dat' % env.BOARD)
|
||||
env.BOOTLOADER_OPTION=""
|
||||
|
||||
hwdef_script = os.path.join(env.SRCROOT, 'libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py')
|
||||
hwdef_out = env.BUILDROOT
|
||||
if not os.path.exists(hwdef_out):
|
||||
|
|
|
@ -77,7 +77,7 @@ def process_mavgen(self):
|
|||
if not hasattr(self, 'output_dir'):
|
||||
self.bld.fatal('mavgen: missing option output_dir')
|
||||
|
||||
inputs = self.to_nodes(self.source)
|
||||
inputs = self.to_nodes(self.bld.srcnode.find_node(self.source))
|
||||
outputs = []
|
||||
|
||||
self.source = []
|
||||
|
|
Loading…
Reference in New Issue