diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index d785c6161b82d6..bb73c9878cac2a 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -441,21 +441,17 @@ def configure_env(self, cfg, env): if self.with_can: # for both AP_Perip and main fw enable deadlines env.DEFINES.update(CANARD_ENABLE_DEADLINE = 1) - - if not cfg.env.AP_PERIPH: - env.AP_LIBRARIES += [ - 'AP_DroneCAN', - 'modules/DroneCAN/libcanard/*.c', - ] - if cfg.options.enable_dronecan_tests: - env.DEFINES.update(AP_TEST_DRONECAN_DRIVERS = 1) - - env.DEFINES.update( - DRONECAN_CXX_WRAPPERS = 1, - USE_USER_HELPERS = 1, - CANARD_ALLOCATE_SEM=1 - ) - + env.DEFINES.update( + DRONECAN_CXX_WRAPPERS = 1, + USE_USER_HELPERS = 1, + CANARD_ALLOCATE_SEM=1 + ) + env.AP_LIBRARIES += [ + 'AP_DroneCAN', + 'modules/DroneCAN/libcanard/*.c', + ] + if cfg.options.enable_dronecan_tests: + env.DEFINES.update(AP_TEST_DRONECAN_DRIVERS = 1) if cfg.options.build_dates: diff --git a/Tools/ardupilotwaf/chibios.py b/Tools/ardupilotwaf/chibios.py index dbc6c9b18779e8..55d47ce1154779 100644 --- a/Tools/ardupilotwaf/chibios.py +++ b/Tools/ardupilotwaf/chibios.py @@ -452,14 +452,13 @@ def setup_canmgr_build(cfg): ] env.CFLAGS += ['-DHAL_CAN_IFACES=2'] - if not env.AP_PERIPH: - env.DEFINES += [ - 'DRONECAN_CXX_WRAPPERS=1', - 'USE_USER_HELPERS=1', - 'CANARD_ENABLE_DEADLINE=1', - 'CANARD_MULTI_IFACE=1', - 'CANARD_ALLOCATE_SEM=1' - ] + env.DEFINES += [ + 'DRONECAN_CXX_WRAPPERS=1', + 'USE_USER_HELPERS=1', + 'CANARD_ENABLE_DEADLINE=1', + 'CANARD_MULTI_IFACE=1', + 'CANARD_ALLOCATE_SEM=1' + ] if cfg.env.HAL_CANFD_SUPPORTED: env.DEFINES += ['UAVCAN_SUPPORT_CANFD=1'] @@ -471,9 +470,17 @@ def setup_canmgr_build(cfg): def setup_canperiph_build(cfg): '''enable CAN build for peripherals''' env = cfg.env + env.AP_LIBRARIES += [ + 'AP_DroneCAN', + 'modules/DroneCAN/libcanard/*.c', + ] env.DEFINES += [ + 'DRONECAN_CXX_WRAPPERS=1', + 'USE_USER_HELPERS=1', 'CANARD_ENABLE_DEADLINE=1', - ] + 'CANARD_MULTI_IFACE=1', + 'CANARD_ALLOCATE_SEM=1' + ] if cfg.env.HAL_CANFD_SUPPORTED: env.DEFINES += ['UAVCAN_SUPPORT_CANFD=1'] diff --git a/wscript b/wscript index 19630462ecdd70..4868cabe2d8ccd 100644 --- a/wscript +++ b/wscript @@ -687,12 +687,11 @@ def _build_dynamic_sources(bld): # this below is not ideal, mavgen tool should set this, but that's not # currently possible export_includes=[ - bld.bldnode.make_node('libraries').abspath(), - bld.bldnode.make_node('libraries/GCS_MAVLink').abspath(), - ], + bld.bldnode.make_node('libraries').abspath(), + bld.bldnode.make_node('libraries/GCS_MAVLink').abspath(), + ], ) - - 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 or bld.env.AP_PERIPH): bld( features='dronecangen', source=bld.srcnode.ant_glob('modules/DroneCAN/DSDL/* libraries/AP_DroneCAN/dsdl/*', dir=True, src=False), @@ -704,17 +703,6 @@ def _build_dynamic_sources(bld): bld.srcnode.find_dir('libraries/AP_DroneCAN/canard/').abspath(), ] ) - elif bld.env.AP_PERIPH: - 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(), - ] - ) if bld.env.ENABLE_DDS: bld.recurse("libraries/AP_DDS")