From cbd21b39778d3f7b808d0c631a193625035b2190 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Mon, 27 Jan 2025 16:05:07 +0000 Subject: [PATCH] esp32/esp32_common.cmake: Allow overriding linker.lf. Particularly for out of tree builds, one may need to provide alternative or extra linker fragment files, or specify an absolute path to the default `linker.lf` file. In the default case, do nothing, provide a plain `linker.lf`, as before. Signed-off-by: Karl Palsson --- ports/esp32/esp32_common.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ports/esp32/esp32_common.cmake b/ports/esp32/esp32_common.cmake index e03d2ff11a..059989c10a 100644 --- a/ports/esp32/esp32_common.cmake +++ b/ports/esp32/esp32_common.cmake @@ -178,6 +178,13 @@ list(APPEND IDF_COMPONENTS vfs ) +# Provide the default LD fragment if not set +if (MICROPY_USER_LDFRAGMENTS) + set(MICROPY_LDFRAGMENTS ${MICROPY_USER_LDFRAGMENTS}) +else() + set(MICROPY_LDFRAGMENTS linker.lf) +endif() + # Register the main IDF component. idf_component_register( SRCS @@ -197,7 +204,7 @@ idf_component_register( ${MICROPY_BOARD_DIR} ${CMAKE_BINARY_DIR} LDFRAGMENTS - linker.lf + ${MICROPY_LDFRAGMENTS} REQUIRES ${IDF_COMPONENTS} )