From de791682e9031987d46dd2619f8880620bcf890a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 22 Feb 2020 15:30:49 +1100 Subject: [PATCH] waf: fixed build on cygwin this fixes a link error on cygwin with the new DSP libs --- Tools/ardupilotwaf/boards.py | 1 - Tools/ardupilotwaf/chibios.py | 17 +++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index 5d6fcb3383..607bff908e 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -526,7 +526,6 @@ class chibios(Board): '-L%s' % env.BUILDROOT, '-L%s' % cfg.srcnode.make_node('modules/ChibiOS/os/common/startup/ARMCMx/compilers/GCC/ld/').abspath(), '-L%s' % cfg.srcnode.make_node('libraries/AP_HAL_ChibiOS/hwdef/common/').abspath(), - '-L%s' % cfg.srcnode.make_node('libraries/AP_GyroFFT/CMSIS_5/lib/').abspath(), '-Wl,--gc-sections,--no-warn-mismatch,--library-path=/ld,--script=ldscript.ld,--defsym=__process_stack_size__=%s,--defsym=__main_stack_size__=%s' % (cfg.env.PROCESS_STACK, cfg.env.MAIN_STACK) ] diff --git a/Tools/ardupilotwaf/chibios.py b/Tools/ardupilotwaf/chibios.py index 2aa2ea667b..6ee51841f2 100644 --- a/Tools/ardupilotwaf/chibios.py +++ b/Tools/ardupilotwaf/chibios.py @@ -420,12 +420,17 @@ def build(bld): target=bld.bldnode.find_or_declare('modules/ChibiOS/libch.a') ) ch_task.name = "ChibiOS_lib" - if bld.env.CORTEX == 'cortex-m4': - bld.env.LIB += ['ch', 'arm_cortexM4lf_math'] - elif bld.env.CORTEX == 'cortex-m7': - bld.env.LIB += ['ch', 'arm_cortexM7lfdp_math'] - else: - bld.env.LIB += ['ch'] + DSP_LIBS = { + 'cortex-m4' : 'libarm_cortexM4lf_math.a', + 'cortex-m7' : 'libarm_cortexM7lfdp_math.a', + } + if bld.env.CORTEX in DSP_LIBS: + libname = DSP_LIBS[bld.env.CORTEX] + # we need to copy the library on cygwin as it doesn't handle linking outside build tree + shutil.copyfile(os.path.join(bld.env.SRCROOT,'libraries/AP_GyroFFT/CMSIS_5/lib',libname), + os.path.join(bld.env.BUILDROOT,'modules/ChibiOS/libDSP.a')) + bld.env.LIB += ['DSP'] + bld.env.LIB += ['ch'] bld.env.LIBPATH += ['modules/ChibiOS/'] # list of functions that will be wrapped to move them out of libc into our # own code note that we also include functions that we deliberately don't