mirror of https://github.com/ArduPilot/ardupilot
waf: enable CAN deadlines in AP_Periph
This commit is contained in:
parent
0ec994c46b
commit
23e67f7b53
|
@ -438,22 +438,24 @@ class Board:
|
||||||
'-Wl,--gc-sections',
|
'-Wl,--gc-sections',
|
||||||
]
|
]
|
||||||
|
|
||||||
if self.with_can and not cfg.env.AP_PERIPH:
|
if self.with_can:
|
||||||
env.AP_LIBRARIES += [
|
# for both AP_Perip and main fw enable deadlines
|
||||||
'AP_DroneCAN',
|
env.DEFINES.update(CANARD_ENABLE_DEADLINE = 1)
|
||||||
'modules/DroneCAN/libcanard/*.c',
|
|
||||||
]
|
if not cfg.env.AP_PERIPH:
|
||||||
if cfg.options.enable_dronecan_tests:
|
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(
|
env.DEFINES.update(
|
||||||
AP_TEST_DRONECAN_DRIVERS = 1
|
DRONECAN_CXX_WRAPPERS = 1,
|
||||||
|
USE_USER_HELPERS = 1,
|
||||||
|
CANARD_ALLOCATE_SEM=1
|
||||||
)
|
)
|
||||||
|
|
||||||
env.DEFINES.update(
|
|
||||||
DRONECAN_CXX_WRAPPERS = 1,
|
|
||||||
USE_USER_HELPERS = 1,
|
|
||||||
CANARD_ENABLE_DEADLINE = 1,
|
|
||||||
CANARD_ALLOCATE_SEM=1
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if cfg.options.build_dates:
|
if cfg.options.build_dates:
|
||||||
|
|
|
@ -468,6 +468,20 @@ def setup_canmgr_build(cfg):
|
||||||
|
|
||||||
cfg.get_board().with_can = True
|
cfg.get_board().with_can = True
|
||||||
|
|
||||||
|
def setup_canperiph_build(cfg):
|
||||||
|
'''enable CAN build for peripherals'''
|
||||||
|
env = cfg.env
|
||||||
|
env.DEFINES += [
|
||||||
|
'CANARD_ENABLE_DEADLINE=1',
|
||||||
|
]
|
||||||
|
|
||||||
|
if cfg.env.HAL_CANFD_SUPPORTED:
|
||||||
|
env.DEFINES += ['UAVCAN_SUPPORT_CANFD=1']
|
||||||
|
else:
|
||||||
|
env.DEFINES += ['UAVCAN_SUPPORT_CANFD=0']
|
||||||
|
|
||||||
|
cfg.get_board().with_can = True
|
||||||
|
|
||||||
def load_env_vars(env):
|
def load_env_vars(env):
|
||||||
'''optionally load extra environment variables from env.py in the build directory'''
|
'''optionally load extra environment variables from env.py in the build directory'''
|
||||||
print("Checking for env.py")
|
print("Checking for env.py")
|
||||||
|
@ -578,6 +592,8 @@ def configure(cfg):
|
||||||
load_env_vars(cfg.env)
|
load_env_vars(cfg.env)
|
||||||
if env.HAL_NUM_CAN_IFACES and not env.AP_PERIPH:
|
if env.HAL_NUM_CAN_IFACES and not env.AP_PERIPH:
|
||||||
setup_canmgr_build(cfg)
|
setup_canmgr_build(cfg)
|
||||||
|
if env.HAL_NUM_CAN_IFACES and env.AP_PERIPH and not env.BOOTLOADER:
|
||||||
|
setup_canperiph_build(cfg)
|
||||||
if env.HAL_NUM_CAN_IFACES and env.AP_PERIPH and int(env.HAL_NUM_CAN_IFACES)>1 and not env.BOOTLOADER:
|
if env.HAL_NUM_CAN_IFACES and env.AP_PERIPH and int(env.HAL_NUM_CAN_IFACES)>1 and not env.BOOTLOADER:
|
||||||
env.DEFINES += [ 'CANARD_MULTI_IFACE=1' ]
|
env.DEFINES += [ 'CANARD_MULTI_IFACE=1' ]
|
||||||
setup_optimization(cfg.env)
|
setup_optimization(cfg.env)
|
||||||
|
|
Loading…
Reference in New Issue