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 <karl.palsson@marel.com>
diff --git a/ports/esp32/esp32_common.cmake b/ports/esp32/esp32_common.cmake
index e03d2ff..059989c 100644
--- a/ports/esp32/esp32_common.cmake
+++ b/ports/esp32/esp32_common.cmake
@@ -178,6 +178,13 @@
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 @@
${MICROPY_BOARD_DIR}
${CMAKE_BINARY_DIR}
LDFRAGMENTS
- linker.lf
+ ${MICROPY_LDFRAGMENTS}
REQUIRES
${IDF_COMPONENTS}
)