2018-03-28 21:45:13 -03:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
def build(bld):
|
2019-05-26 22:38:46 -03:00
|
|
|
if not bld.env.BOOTLOADER:
|
|
|
|
return
|
|
|
|
|
2021-06-02 14:56:58 -03:00
|
|
|
if bld.env.EXTERNAL_PROG_FLASH_MB:
|
2021-07-01 03:27:45 -03:00
|
|
|
flashiface_lib = ['AP_HAL', 'AP_FlashIface', 'AP_HAL_Empty']
|
2021-06-02 10:37:18 -03:00
|
|
|
else:
|
|
|
|
flashiface_lib = []
|
|
|
|
|
2019-05-26 22:38:46 -03:00
|
|
|
# build external libcanard library
|
2021-11-11 08:17:01 -04:00
|
|
|
bld.stlib(source='../../modules/DroneCAN/libcanard/canard.c',
|
2019-05-26 22:38:46 -03:00
|
|
|
target='libcanard')
|
|
|
|
|
|
|
|
bld.ap_program(
|
2019-10-21 03:11:14 -03:00
|
|
|
use=['ap','libcanard','AP_Bootloader_libs'],
|
2019-05-26 22:38:46 -03:00
|
|
|
program_groups='bootloader',
|
2021-11-11 08:17:01 -04:00
|
|
|
includes=[bld.env.SRCROOT + '/modules/DroneCAN/libcanard',
|
|
|
|
bld.env.BUILDROOT + '/modules/DroneCAN/libcanard/dsdlc_generated']
|
2019-05-26 22:38:46 -03:00
|
|
|
)
|
|
|
|
|
2019-10-21 03:11:14 -03:00
|
|
|
bld.ap_stlib(
|
|
|
|
name= 'AP_Bootloader_libs',
|
|
|
|
ap_vehicle='AP_Bootloader',
|
2021-06-02 10:37:18 -03:00
|
|
|
ap_libraries= flashiface_lib + [
|
2019-10-21 03:11:14 -03:00
|
|
|
'AP_Math'
|
|
|
|
])
|
|
|
|
|
2019-05-26 22:38:46 -03:00
|
|
|
bld(
|
|
|
|
# build libcanard headers
|
2021-10-20 20:51:18 -03:00
|
|
|
source=bld.path.ant_glob("modules/DroneCAN/DSDL/**/*.uavcan"),
|
2021-11-18 19:44:31 -04:00
|
|
|
rule="python3 ${SRCROOT}/modules/DroneCAN/libcanard/dsdl_compiler/libcanard_dsdlc --header_only --outdir ${BUILDROOT}/modules/DroneCAN/libcanard/dsdlc_generated ${SRCROOT}/modules/DroneCAN/DSDL/uavcan ${SRCROOT}/modules/DroneCAN/DSDL/ardupilot ${SRCROOT}/modules/DroneCAN/DSDL/com ${SRCROOT}/modules/DroneCAN/DSDL/dronecan",
|
2019-05-26 22:38:46 -03:00
|
|
|
group='dynamic_sources',
|
|
|
|
)
|
|
|
|
|