Skip to content

Commit c16a4db

Browse files
Gadgetoiddpgeorge
authored andcommitted
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 <[email protected]>
1 parent 1a060e8 commit c16a4db

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ports/rp2/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,14 +610,18 @@ endif()
610610
# todo this is a bit brittle, but we want to move a few source files into RAM (which requires
611611
# a linker script modification) until we explicitly add macro calls around the function
612612
# defs to move them into RAM.
613-
if (PICO_ON_DEVICE AND NOT PICO_NO_FLASH AND NOT PICO_COPY_TO_RAM)
613+
if (NOT MICROPY_BOARD_LINKER_SCRIPT)
614614
if(PICO_RP2040)
615-
pico_set_linker_script(${MICROPY_TARGET} ${CMAKE_CURRENT_LIST_DIR}/memmap_mp_rp2040.ld)
615+
set(MICROPY_BOARD_LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/memmap_mp_rp2040.ld)
616616
elseif(PICO_RP2350)
617-
pico_set_linker_script(${MICROPY_TARGET} ${CMAKE_CURRENT_LIST_DIR}/memmap_mp_rp2350.ld)
617+
set(MICROPY_BOARD_LINKER_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/memmap_mp_rp2350.ld)
618618
endif()
619619
endif()
620620

621+
if (PICO_ON_DEVICE AND NOT PICO_NO_FLASH AND NOT PICO_COPY_TO_RAM)
622+
pico_set_linker_script(${MICROPY_TARGET} ${MICROPY_BOARD_LINKER_SCRIPT})
623+
endif()
624+
621625
pico_add_extra_outputs(${MICROPY_TARGET})
622626

623627
pico_find_compiler_with_triples(PICO_COMPILER_SIZE "${PICO_GCC_TRIPLE}" size)

0 commit comments

Comments
 (0)