summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Howard <github@gadgetoid.com>2025-03-28 14:27:26 +0000
committerDamien George <damien@micropython.org>2025-06-19 11:00:10 +1000
commitc16a4db151c0fac7db45c7c896741f707e9ad364 (patch)
tree3fe9aedd5a6295a53242e03cedaf6ba656da60d0
parent1a060e87cd413241b526bfd6ed4f94c72f748285 (diff)
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>
-rw-r--r--ports/rp2/CMakeLists.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt
index b9776012a..49ba8d77d 100644
--- a/ports/rp2/CMakeLists.txt
+++ b/ports/rp2/CMakeLists.txt
@@ -610,14 +610,18 @@ endif()
# 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
# 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)
- 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)
- 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()
+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_find_compiler_with_triples(PICO_COMPILER_SIZE "${PICO_GCC_TRIPLE}" size)