Skip to content

Commit

Permalink
waf: AP_Periph CAN compile config now same as Vehicle DroneCAN
Browse files Browse the repository at this point in the history
  • Loading branch information
bugobliterator committed Dec 21, 2023
1 parent 8b80259 commit 13d0fd4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 36 deletions.
26 changes: 11 additions & 15 deletions Tools/ardupilotwaf/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 16 additions & 9 deletions Tools/ardupilotwaf/chibios.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand All @@ -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']
Expand Down
13 changes: 1 addition & 12 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ 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):
bld(
features='dronecangen',
source=bld.srcnode.ant_glob('modules/DroneCAN/DSDL/* libraries/AP_DroneCAN/dsdl/*', dir=True, src=False),
Expand All @@ -704,17 +704,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")
Expand Down

0 comments on commit 13d0fd4

Please sign in to comment.