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
This commit is contained in:
Peter Barker 2018-03-20 20:28:16 +11:00
parent 44a063e818
commit 2efd9341cd
1 changed files with 12 additions and 1 deletions

View File

@ -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"))