rp2/CMakeLists.txt: Make linker script configurable.

Add `MICROPY_BOARD_LINKER_SCRIPT` to specify a custom linker script for rp2
boards/variants.

This may, for example, include a PSRAM region so that C buffers or
otherwise can be allocated into PSRAM.

Signed-off-by: Phil Howard <github@gadgetoid.com>
This commit is contained in:
Phil Howard
2025-03-28 14:27:26 +00:00
committed by Damien George
parent 1a060e87cd
commit c16a4db151

View File

@@ -610,14 +610,18 @@ endif()
# todo this is a bit brittle, but we want to move a few source files into RAM (which requires # todo this is a bit brittle, but we want to move a few source files into RAM (which requires
# a linker script modification) until we explicitly add macro calls around the function # a linker script modification) until we explicitly add macro calls around the function
# defs to move them into RAM. # defs to move them into RAM.
if (PICO_ON_DEVICE AND NOT PICO_NO_FLASH AND NOT PICO_COPY_TO_RAM) if (NOT MICROPY_BOARD_LINKER_SCRIPT)
if(PICO_RP2040) if(PICO_RP2040)
pico_set_linker_script(${MICROPY_TARGET} ${CMAKE_CURRENT_LIST_DIR}/memmap_mp_rp2040.ld) set(MICROPY_BOARD_LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/memmap_mp_rp2040.ld)
elseif(PICO_RP2350) elseif(PICO_RP2350)
pico_set_linker_script(${MICROPY_TARGET} ${CMAKE_CURRENT_LIST_DIR}/memmap_mp_rp2350.ld) set(MICROPY_BOARD_LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/memmap_mp_rp2350.ld)
endif() endif()
endif() endif()
if (PICO_ON_DEVICE AND NOT PICO_NO_FLASH AND NOT PICO_COPY_TO_RAM)
pico_set_linker_script(${MICROPY_TARGET} ${MICROPY_BOARD_LINKER_SCRIPT})
endif()
pico_add_extra_outputs(${MICROPY_TARGET}) pico_add_extra_outputs(${MICROPY_TARGET})
pico_find_compiler_with_triples(PICO_COMPILER_SIZE "${PICO_GCC_TRIPLE}" size) pico_find_compiler_with_triples(PICO_COMPILER_SIZE "${PICO_GCC_TRIPLE}" size)