compileopts: add linkerscript key
Setting the linker script as one property (instead of as part of the generic ldflags property) allows it to be overriden. This is important for the SoftDevice on Nordic chips, because the SoftDevice takes up a fixed part of the flash/RAM and the application must be flashed at a different position. With this linkerscript option, it is possible to create (for example) a pca10040-s132v6 that overrides the default linker script.
Этот коммит содержится в:
родитель
18cce571a2
коммит
1cbe09ee89
16 изменённых файлов: 24 добавлений и 39 удалений
|
@ -122,6 +122,9 @@ func (c *Config) LDFlags() []string {
|
||||||
heapSize := (c.Options.HeapSize + (65536 - 1)) &^ (65536 - 1)
|
heapSize := (c.Options.HeapSize + (65536 - 1)) &^ (65536 - 1)
|
||||||
ldflags = append(ldflags, "--initial-memory="+strconv.FormatInt(heapSize, 10))
|
ldflags = append(ldflags, "--initial-memory="+strconv.FormatInt(heapSize, 10))
|
||||||
}
|
}
|
||||||
|
if c.Target.LinkerScript != "" {
|
||||||
|
ldflags = append(ldflags, "-T", c.Target.LinkerScript)
|
||||||
|
}
|
||||||
return ldflags
|
return ldflags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ type TargetSpec struct {
|
||||||
RTLib string `json:"rtlib"` // compiler runtime library (libgcc, compiler-rt)
|
RTLib string `json:"rtlib"` // compiler runtime library (libgcc, compiler-rt)
|
||||||
CFlags []string `json:"cflags"`
|
CFlags []string `json:"cflags"`
|
||||||
LDFlags []string `json:"ldflags"`
|
LDFlags []string `json:"ldflags"`
|
||||||
|
LinkerScript string `json:"linkerscript"`
|
||||||
ExtraFiles []string `json:"extra-files"`
|
ExtraFiles []string `json:"extra-files"`
|
||||||
Emulator []string `json:"emulator"`
|
Emulator []string `json:"emulator"`
|
||||||
FlashCommand string `json:"flash-command"`
|
FlashCommand string `json:"flash-command"`
|
||||||
|
@ -85,6 +86,9 @@ func (spec *TargetSpec) copyProperties(spec2 *TargetSpec) {
|
||||||
}
|
}
|
||||||
spec.CFlags = append(spec.CFlags, spec2.CFlags...)
|
spec.CFlags = append(spec.CFlags, spec2.CFlags...)
|
||||||
spec.LDFlags = append(spec.LDFlags, spec2.LDFlags...)
|
spec.LDFlags = append(spec.LDFlags, spec2.LDFlags...)
|
||||||
|
if spec2.LinkerScript != "" {
|
||||||
|
spec.LinkerScript = spec2.LinkerScript
|
||||||
|
}
|
||||||
spec.ExtraFiles = append(spec.ExtraFiles, spec2.ExtraFiles...)
|
spec.ExtraFiles = append(spec.ExtraFiles, spec2.ExtraFiles...)
|
||||||
if len(spec2.Emulator) != 0 {
|
if len(spec2.Emulator) != 0 {
|
||||||
spec.Emulator = spec2.Emulator
|
spec.Emulator = spec2.Emulator
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"ldflags": [
|
||||||
"-Wl,--defsym=_bootloader_size=512",
|
"-Wl,--defsym=_bootloader_size=512",
|
||||||
"-Wl,--defsym=_stack_size=512",
|
"-Wl,--defsym=_stack_size=512"
|
||||||
"-T", "src/device/avr/atmega328p.ld"
|
|
||||||
],
|
],
|
||||||
|
"linkerscript": "src/device/avr/atmega328p.ld",
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"targets/avr.S",
|
"targets/avr.S",
|
||||||
"src/device/avr/atmega328p.s"
|
"src/device/avr/atmega328p.s"
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
"--target=armv6m-none-eabi",
|
"--target=armv6m-none-eabi",
|
||||||
"-Qunused-arguments"
|
"-Qunused-arguments"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"linkerscript": "targets/atsamd21.ld",
|
||||||
"-T", "targets/atsamd21.ld"
|
|
||||||
],
|
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"src/device/sam/atsamd21e18a.s"
|
"src/device/sam/atsamd21e18a.s"
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
"--target=armv6m-none-eabi",
|
"--target=armv6m-none-eabi",
|
||||||
"-Qunused-arguments"
|
"-Qunused-arguments"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"linkerscript": "targets/atsamd21.ld",
|
||||||
"-T", "targets/atsamd21.ld"
|
|
||||||
],
|
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"src/device/sam/atsamd21g18a.s"
|
"src/device/sam/atsamd21g18a.s"
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
"--target=armv7em-none-eabi",
|
"--target=armv7em-none-eabi",
|
||||||
"-Qunused-arguments"
|
"-Qunused-arguments"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"linkerscript": "targets/atsamd51.ld",
|
||||||
"-T", "targets/atsamd51.ld"
|
|
||||||
],
|
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"src/device/sam/atsamd51g19a.s"
|
"src/device/sam/atsamd51g19a.s"
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
"--target=armv7m-none-eabi",
|
"--target=armv7m-none-eabi",
|
||||||
"-Qunused-arguments"
|
"-Qunused-arguments"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"linkerscript": "targets/stm32.ld",
|
||||||
"-T", "targets/stm32.ld"
|
|
||||||
],
|
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"src/device/stm32/stm32f103xx.s"
|
"src/device/stm32/stm32f103xx.s"
|
||||||
],
|
],
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"ldflags": [
|
||||||
"-Wl,--defsym=_bootloader_size=2180",
|
"-Wl,--defsym=_bootloader_size=2180",
|
||||||
"-Wl,--defsym=_stack_size=128",
|
"-Wl,--defsym=_stack_size=128"
|
||||||
"-T", "src/device/avr/attiny85.ld"
|
|
||||||
],
|
],
|
||||||
|
"linkerscript": "src/device/avr/attiny85.ld",
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"targets/avr.S",
|
"targets/avr.S",
|
||||||
"src/device/avr/attiny85.s"
|
"src/device/avr/attiny85.s"
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
"-ffunction-sections", "-fdata-sections"
|
"-ffunction-sections", "-fdata-sections"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"ldflags": [
|
||||||
"--gc-sections",
|
"--gc-sections"
|
||||||
"-Ttargets/gameboy-advance.ld"
|
|
||||||
],
|
],
|
||||||
|
"linkerscript": "targets/gameboy-advance.ld",
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"targets/gameboy-advance.s"
|
"targets/gameboy-advance.s"
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
{
|
{
|
||||||
"inherits": ["fe310"],
|
"inherits": ["fe310"],
|
||||||
"build-tags": ["hifive1b"],
|
"build-tags": ["hifive1b"],
|
||||||
"ldflags": [
|
"linkerscript": "targets/hifive1b.ld",
|
||||||
"-T", "targets/hifive1b.ld"
|
|
||||||
],
|
|
||||||
"flash-method": "msd",
|
"flash-method": "msd",
|
||||||
"msd-volume-name": "HiFive",
|
"msd-volume-name": "HiFive",
|
||||||
"msd-firmware-name": "firmware.hex"
|
"msd-firmware-name": "firmware.hex"
|
||||||
|
|
|
@ -8,9 +8,7 @@
|
||||||
"-DNRF51",
|
"-DNRF51",
|
||||||
"-I{root}/lib/CMSIS/CMSIS/Include"
|
"-I{root}/lib/CMSIS/CMSIS/Include"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"linkerscript": "targets/nrf51.ld",
|
||||||
"-T", "targets/nrf51.ld"
|
|
||||||
],
|
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"lib/nrfx/mdk/system_nrf51.c",
|
"lib/nrfx/mdk/system_nrf51.c",
|
||||||
"src/device/nrf/nrf51.s"
|
"src/device/nrf/nrf51.s"
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
"-DNRF52832_XXAA",
|
"-DNRF52832_XXAA",
|
||||||
"-I{root}/lib/CMSIS/CMSIS/Include"
|
"-I{root}/lib/CMSIS/CMSIS/Include"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"linkerscript": "targets/nrf52.ld",
|
||||||
"-T", "targets/nrf52.ld"
|
|
||||||
],
|
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"lib/nrfx/mdk/system_nrf52.c",
|
"lib/nrfx/mdk/system_nrf52.c",
|
||||||
"src/device/nrf/nrf52.s"
|
"src/device/nrf/nrf52.s"
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
"-DNRF52840_XXAA",
|
"-DNRF52840_XXAA",
|
||||||
"-I{root}/lib/CMSIS/CMSIS/Include"
|
"-I{root}/lib/CMSIS/CMSIS/Include"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"linkerscript": "targets/nrf52840.ld",
|
||||||
"-T", "targets/nrf52840.ld"
|
|
||||||
],
|
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"lib/nrfx/mdk/system_nrf52840.c",
|
"lib/nrfx/mdk/system_nrf52840.c",
|
||||||
"src/device/nrf/nrf52840.s"
|
"src/device/nrf/nrf52840.s"
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
"--target=armv7m-none-eabi",
|
"--target=armv7m-none-eabi",
|
||||||
"-Qunused-arguments"
|
"-Qunused-arguments"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"linkerscript": "targets/stm32f103rb.ld",
|
||||||
"-T", "targets/stm32f103rb.ld"
|
|
||||||
],
|
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"src/device/stm32/stm32f103xx.s"
|
"src/device/stm32/stm32f103xx.s"
|
||||||
],
|
],
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
"--target=armv7m-none-eabi",
|
"--target=armv7m-none-eabi",
|
||||||
"-Qunused-arguments"
|
"-Qunused-arguments"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"linkerscript": "targets/lm3s6965.ld",
|
||||||
"-T", "targets/lm3s6965.ld"
|
|
||||||
],
|
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"targets/qemu.s"
|
"targets/qemu.s"
|
||||||
],
|
],
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
"--target=armv7em-none-eabi",
|
"--target=armv7em-none-eabi",
|
||||||
"-Qunused-arguments"
|
"-Qunused-arguments"
|
||||||
],
|
],
|
||||||
"ldflags": [
|
"linkerscript": "targets/stm32f407.ld",
|
||||||
"-T", "targets/stm32f407.ld"
|
|
||||||
],
|
|
||||||
"extra-files": [
|
"extra-files": [
|
||||||
"src/device/stm32/stm32f407.s"
|
"src/device/stm32/stm32f407.s"
|
||||||
],
|
],
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче