#!/usr/bin/env python # encoding: utf-8 def build(bld): if not bld.env.BOOTLOADER: return if bld.env.EXT_FLASH_SIZE_MB: flashiface_lib = ['AP_HAL', 'AP_FlashIface', 'AP_HAL_Empty'] else: flashiface_lib = [] # build external libcanard library bld.stlib(source='../../modules/DroneCAN/libcanard/canard.c', target='libcanard') bld.ap_program( use=['ap','libcanard','AP_Bootloader_libs'], program_groups='bootloader', includes=[bld.env.SRCROOT + '/modules/DroneCAN/libcanard', bld.env.BUILDROOT + '/modules/DroneCAN/libcanard/dsdlc_generated'] ) bld.ap_stlib( name= 'AP_Bootloader_libs', ap_vehicle='AP_Bootloader', ap_libraries= flashiface_lib + [ 'AP_Math', 'AP_CheckFirmware' ]) bld( # build libcanard headers source=bld.path.ant_glob("modules/DroneCAN/DSDL/**/*.uavcan"), 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", group='dynamic_sources', )