mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
e0d29d4ada
PMS aware chips require prefetch padding size for instruction fetch, or some memory alignment considerations. These settings are now exposed through kconfig options (hidden) and used through common ld template. This shall help to add and manage future chips support easily for these considerations. Closes IDF-3624
34 lines
1.4 KiB
CMake
34 lines
1.4 KiB
CMake
# For each supported target, a memory.ld.in and sections.ld.in is processed and dictate the
|
|
# memory layout of the app.
|
|
#
|
|
# memory.ld.in goes through the preprocessor
|
|
# sections.ld.in goes through linker script generator
|
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER)
|
|
|
|
set(ld_input "${CMAKE_CURRENT_LIST_DIR}/${target}/memory.ld.in")
|
|
set(ld_output "${CMAKE_CURRENT_BINARY_DIR}/ld/memory.ld")
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${ld_output}")
|
|
|
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/ld")
|
|
|
|
# Process the template file through the linker script generation mechanism, and use the output for linking the
|
|
# final binary
|
|
target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/${target}/sections.ld.in"
|
|
PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/sections.ld")
|
|
|
|
idf_build_get_property(config_dir CONFIG_DIR)
|
|
# Preprocess memory.ld.in linker script to include configuration, becomes memory.ld
|
|
add_custom_command(
|
|
OUTPUT ${ld_output}
|
|
COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o ${ld_output} -I ${config_dir}
|
|
-I "${CMAKE_CURRENT_LIST_DIR}" ${ld_input}
|
|
MAIN_DEPENDENCY ${ld_input}
|
|
DEPENDS ${sdkconfig_header}
|
|
COMMENT "Generating memory.ld linker script..."
|
|
VERBATIM)
|
|
|
|
add_custom_target(memory_ld DEPENDS ${ld_output})
|
|
add_dependencies(${COMPONENT_LIB} memory_ld)
|