From 2efd9341cdd2867211e99e3c57fec0da7539f91d Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 20 Mar 2018 20:28:16 +1100 Subject: [PATCH] AP_HAL_ChibiOS: copy the common linker script to outdir, use it from there The directory we write the linker script to might not have the correct relative path to reference this common.ld script. So make it reference common.ld in the current directory and copy common.ld to the output directory --- .../AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py index 9b0bb85958..043f886597 100755 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py @@ -4,6 +4,7 @@ setup board.h for chibios ''' import argparse, sys, fnmatch, os, dma_resolver, shlex, pickle +import shutil parser = argparse.ArgumentParser("chibios_pins.py") parser.add_argument( @@ -369,9 +370,15 @@ MEMORY ram0 : org = 0x20000000, len = %uk } -INCLUDE ../../libraries/AP_HAL_ChibiOS/hwdef/common/common.ld +INCLUDE common.ld ''' % (flash_base, flash_length, ram_size)) +def copy_common_linkerscript(outdir, hwdef): + dirpath = os.path.dirname(hwdef) + shutil.copy(os.path.join(dirpath, "../common/common.ld"), + os.path.join(outdir, "common.ld")) + + def write_USB_config(f): '''write USB config defines''' @@ -1026,6 +1033,10 @@ write_hwdef_header(os.path.join(outdir, "hwdef.h")) # write out ldscript.ld write_ldscript(os.path.join(outdir, "ldscript.ld")) +# copy the shared linker script into the build directory; it must +# exist in the same directory as the ldscript.ld file we generate. +copy_common_linkerscript(outdir, args.hwdef) + # write out env.py pickle.dump(env_vars, open(os.path.join(outdir, "env.py"), "wb"))