waf: allow for 64 bit CAN builds

This commit is contained in:
Andrew Tridgell 2023-04-07 16:38:18 +10:00
parent 1b88f4e185
commit 85d4024e64
2 changed files with 16 additions and 32 deletions

View File

@ -429,15 +429,10 @@ class Board:
] ]
if self.with_can and not cfg.env.AP_PERIPH: if self.with_can and not cfg.env.AP_PERIPH:
if not cfg.env.FORCE32BIT and (cfg.env.BOARD == 'sitl' or cfg.env.BOARD == 'linux'): env.AP_LIBRARIES += [
env.DEFINES.update( 'AP_DroneCAN',
HAL_ENABLE_LIBUAVCAN_DRIVERS = 0 'modules/DroneCAN/libcanard/*.c',
) ]
else:
env.AP_LIBRARIES += [
'AP_DroneCAN',
'modules/DroneCAN/libcanard/*.c',
]
if cfg.options.enable_dronecan_tests: if cfg.options.enable_dronecan_tests:
env.DEFINES.update( env.DEFINES.update(
AP_TEST_DRONECAN_DRIVERS = 1 AP_TEST_DRONECAN_DRIVERS = 1
@ -1142,7 +1137,7 @@ class linux(Board):
self.with_can = False self.with_can = False
def configure_env(self, cfg, env): def configure_env(self, cfg, env):
if cfg.options.board == 'linux' and cfg.options.force_32bit: if cfg.options.board == 'linux':
self.with_can = True self.with_can = True
super(linux, self).configure_env(cfg, env) super(linux, self).configure_env(cfg, env)
@ -1189,7 +1184,7 @@ class linux(Board):
env.DEFINES.update( env.DEFINES.update(
HAL_FORCE_32BIT = 0, HAL_FORCE_32BIT = 0,
) )
if self.with_can and cfg.options.board == 'linux' and cfg.options.force_32bit: if self.with_can and cfg.options.board == 'linux':
cfg.env.HAL_NUM_CAN_IFACES = 2 cfg.env.HAL_NUM_CAN_IFACES = 2
cfg.define('HAL_NUM_CAN_IFACES', 2) cfg.define('HAL_NUM_CAN_IFACES', 2)
cfg.define('UAVCAN_EXCEPTIONS', 0) cfg.define('UAVCAN_EXCEPTIONS', 0)

31
wscript
View File

@ -478,11 +478,7 @@ def configure(cfg):
cfg.load('clang_compilation_database') cfg.load('clang_compilation_database')
cfg.load('waf_unit_test') cfg.load('waf_unit_test')
cfg.load('mavgen') cfg.load('mavgen')
if cfg.options.board in cfg.ap_periph_boards(): cfg.load('dronecangen')
cfg.load('dronecangen')
else:
if cfg.options.force_32bit or (cfg.options.board != 'sitl' and cfg.options.board != 'linux'):
cfg.load('dronecangen')
cfg.env.SUBMODULE_UPDATE = cfg.options.submodule_update cfg.env.SUBMODULE_UPDATE = cfg.options.submodule_update
@ -669,22 +665,15 @@ def _build_dynamic_sources(bld):
) )
if (bld.get_board().with_can or bld.env.HAL_NUM_CAN_IFACES) and not bld.env.AP_PERIPH: if (bld.get_board().with_can or bld.env.HAL_NUM_CAN_IFACES) and not bld.env.AP_PERIPH:
if (not bld.env.FORCE32BIT) and (bld.env.BOARD == 'sitl' or bld.env.BOARD == 'linux'): bld(
# remove generated files features='dronecangen',
dronecan_dir = bld.bldnode.make_node('modules/DroneCAN/libcanard/dsdlc_generated/').abspath() source=bld.srcnode.ant_glob('modules/DroneCAN/DSDL/* libraries/AP_DroneCAN/dsdl/*', dir=True, src=False),
if os.path.exists(dronecan_dir): output_dir='modules/DroneCAN/libcanard/dsdlc_generated/',
print("Removing DroneCAN generated files") name='dronecan',
shutil.rmtree(dronecan_dir) export_includes=[
else: bld.bldnode.make_node('modules/DroneCAN/libcanard/dsdlc_generated/include').abspath(),
bld( bld.srcnode.find_dir('modules/DroneCAN/libcanard/').abspath(),
features='dronecangen', bld.srcnode.find_dir('libraries/AP_DroneCAN/canard/').abspath(),
source=bld.srcnode.ant_glob('modules/DroneCAN/DSDL/* libraries/AP_DroneCAN/dsdl/*', dir=True, src=False),
output_dir='modules/DroneCAN/libcanard/dsdlc_generated/',
name='dronecan',
export_includes=[
bld.bldnode.make_node('modules/DroneCAN/libcanard/dsdlc_generated/include').abspath(),
bld.srcnode.find_dir('modules/DroneCAN/libcanard/').abspath(),
bld.srcnode.find_dir('libraries/AP_DroneCAN/canard/').abspath(),
] ]
) )
elif bld.env.AP_PERIPH: elif bld.env.AP_PERIPH: