rp2040: Always link using rp2040_link.lds.S

Use the rp2040 specific linker script even when using a bootloader.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2024-01-20 19:58:23 -05:00
parent 55e46aa625
commit 23c5b20f5b
2 changed files with 11 additions and 3 deletions

View File

@ -55,7 +55,7 @@ $(OUT)klipper.bin: $(OUT)klipper.elf
$(Q)$(OBJCOPY) -O binary $< $@
rptarget-$(CONFIG_RP2040_HAVE_BOOTLOADER) := $(OUT)klipper.bin
rplink-$(CONFIG_RP2040_HAVE_BOOTLOADER) := $(OUT)src/generic/armcm_link.ld
rplink-$(CONFIG_RP2040_HAVE_BOOTLOADER) := $(OUT)src/rp2040/rp2040_link.ld
# Set klipper.elf linker rules
target-y += $(rptarget-y)

View File

@ -1,6 +1,6 @@
// rp2040 linker script (based on armcm_link.lds.S and customized for stage2)
//
// Copyright (C) 2019-2021 Kevin O'Connor <kevin@koconnor.net>
// Copyright (C) 2019-2024 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU GPLv3 license.
@ -9,9 +9,15 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
#if CONFIG_RP2040_HAVE_STAGE2
#define ROM_ORIGIN 0x10000000
#else
#define ROM_ORIGIN CONFIG_FLASH_APPLICATION_ADDRESS
#endif
MEMORY
{
rom (rx) : ORIGIN = 0x10000000 , LENGTH = CONFIG_FLASH_SIZE
rom (rx) : ORIGIN = ROM_ORIGIN , LENGTH = CONFIG_FLASH_SIZE
ram (rwx) : ORIGIN = CONFIG_RAM_START , LENGTH = CONFIG_RAM_SIZE
}
@ -19,7 +25,9 @@ SECTIONS
{
.text : {
. = ALIGN(4);
#if CONFIG_RP2040_HAVE_STAGE2
KEEP(*(.boot2))
#endif
_text_vectortable_start = .;
KEEP(*(.vector_table))
_text_vectortable_end = .;