From 85d4024e64104424c4ccd9c1d8d04434eb5245c0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 7 Apr 2023 16:38:18 +1000 Subject: [PATCH] waf: allow for 64 bit CAN builds --- Tools/ardupilotwaf/boards.py | 17 ++++++----------- wscript | 31 ++++++++++--------------------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index c1b8c6cd9c..b407cf9373 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -429,15 +429,10 @@ class Board: ] 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.DEFINES.update( - HAL_ENABLE_LIBUAVCAN_DRIVERS = 0 - ) - else: - env.AP_LIBRARIES += [ - 'AP_DroneCAN', - 'modules/DroneCAN/libcanard/*.c', - ] + env.AP_LIBRARIES += [ + 'AP_DroneCAN', + 'modules/DroneCAN/libcanard/*.c', + ] if cfg.options.enable_dronecan_tests: env.DEFINES.update( AP_TEST_DRONECAN_DRIVERS = 1 @@ -1142,7 +1137,7 @@ class linux(Board): self.with_can = False 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 super(linux, self).configure_env(cfg, env) @@ -1189,7 +1184,7 @@ class linux(Board): env.DEFINES.update( 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.define('HAL_NUM_CAN_IFACES', 2) cfg.define('UAVCAN_EXCEPTIONS', 0) diff --git a/wscript b/wscript index 0a36e56b57..a9101b821e 100644 --- a/wscript +++ b/wscript @@ -478,11 +478,7 @@ def configure(cfg): cfg.load('clang_compilation_database') cfg.load('waf_unit_test') cfg.load('mavgen') - if cfg.options.board in cfg.ap_periph_boards(): - cfg.load('dronecangen') - else: - if cfg.options.force_32bit or (cfg.options.board != 'sitl' and cfg.options.board != 'linux'): - cfg.load('dronecangen') + cfg.load('dronecangen') 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 (not bld.env.FORCE32BIT) and (bld.env.BOARD == 'sitl' or bld.env.BOARD == 'linux'): - # remove generated files - dronecan_dir = bld.bldnode.make_node('modules/DroneCAN/libcanard/dsdlc_generated/').abspath() - if os.path.exists(dronecan_dir): - print("Removing DroneCAN generated files") - shutil.rmtree(dronecan_dir) - else: - bld( - features='dronecangen', - 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(), + bld( + features='dronecangen', + 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: