target_linker_script(${COMPONENT_TARGET} "${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld")
if(CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY)
- # This has to be linked before esp32.common.ld
+ # This has to be linked before esp32.project.ld
target_linker_script(${COMPONENT_TARGET} "ld/esp32.extram.bss.ld")
endif()
if(IDF_PROJECT_EXECUTABLE)
# Process the template file through the linker script generation mechanism, and use the output for linking the
# final binary
- set(esp32_common_script "${CMAKE_CURRENT_BINARY_DIR}/esp32.common.ld")
- set(esp32_common_template "${CMAKE_CURRENT_LIST_DIR}/ld/esp32.common.ld.in")
+ set(esp32_project_script "${CMAKE_CURRENT_BINARY_DIR}/esp32.project.ld")
+ set(esp32_project_template "${CMAKE_CURRENT_LIST_DIR}/ld/esp32.project.ld.in")
- ldgen_process_template(${esp32_common_template} ${esp32_common_script})
+ ldgen_process_template(${esp32_project_template} ${esp32_project_script})
- target_link_libraries(${COMPONENT_TARGET} "-T ${esp32_common_script}")
-
- set_property(TARGET ${IDF_PROJECT_EXECUTABLE} APPEND PROPERTY LINK_DEPENDS ${esp32_common_script})
+ target_link_libraries(${COMPONENT_TARGET} "-T ${esp32_project_script}")
+
+ set_property(TARGET ${IDF_PROJECT_EXECUTABLE} APPEND PROPERTY LINK_DEPENDS ${esp32_project_script})
endif()
target_linker_script(${COMPONENT_TARGET}
ifneq ("$(filter esp32,$(TEST_COMPONENTS_LIST))","")
CPPFLAGS += -DESP_TIMER_DYNAMIC_OVERFLOW_VAL
endif
-ESP32_LINKER_SCRIPT_TEMPLATE := $(COMPONENT_PATH)/ld/esp32.common.ld.in
+ESP32_LINKER_SCRIPT_TEMPLATE := $(COMPONENT_PATH)/ld/esp32.project.ld.in
ESP32_LINKER_SCRIPT_OUTPUT_DIR := $(abspath $(BUILD_DIR_BASE)/esp32)
# Target to generate linker script generator from fragments presented by each of
# the components
-$(eval $(call ldgen_process_template, $(ESP32_LINKER_SCRIPT_TEMPLATE), $(ESP32_LINKER_SCRIPT_OUTPUT_DIR)/esp32.common.ld))
+$(eval $(call ldgen_process_template, $(ESP32_LINKER_SCRIPT_TEMPLATE), $(ESP32_LINKER_SCRIPT_OUTPUT_DIR)/esp32.project.ld))
endif
ifdef CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
- # This linker script must come before esp32.common.ld
+ # This linker script must come before esp32.project.ld
LINKER_SCRIPTS += esp32.extram.bss.ld
endif
#Linker scripts used to link the final application.
#Warning: These linker scripts are only used when the normal app is compiled; the bootloader
#specifies its own scripts.
-LINKER_SCRIPTS += $(COMPONENT_BUILD_DIR)/esp32.common.ld esp32.rom.ld esp32.peripherals.ld
+LINKER_SCRIPTS += $(COMPONENT_BUILD_DIR)/esp32.project.ld esp32.rom.ld esp32.peripherals.ld
#Force pure functions from libgcc.a to be linked from ROM
LINKER_SCRIPTS += esp32.rom.libgcc.ld
# final linking of project ELF depends on all binary libraries, and
# all linker scripts (except esp32_out.ld, as this is code generated here.)
COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) \
- $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.common.ld, $(LINKER_SCRIPTS))) \
- $(COMPONENT_BUILD_DIR)/esp32.common.ld
+ $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.project.ld, $(LINKER_SCRIPTS))) \
+ $(COMPONENT_BUILD_DIR)/esp32.project.ld
# Preprocess esp32.ld linker script into esp32_out.ld
#
esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
$(CC) -I ../include -C -P -x c -E $< -o $@
-COMPONENT_EXTRA_CLEAN := esp32_out.ld $(COMPONENT_BUILD_DIR)/esp32.common.ld
+COMPONENT_EXTRA_CLEAN := esp32_out.ld $(COMPONENT_BUILD_DIR)/esp32.project.ld
# disable stack protection in files which are involved in initialization of that feature
stack_check.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))
This file describes the memory layout (memory blocks) as virtual
memory addresses.
- esp32.common.ld contains output sections to link compiler output
+ esp32.project.ld contains output sections to link compiler output
into these memory blocks.
***
Linker Script Template
^^^^^^^^^^^^^^^^^^^^^^
-Currently, the linker script template used is :component:`esp32/ld/esp32.common.ld.in`, and is used only for the app build. The generated output script is
+Currently, the linker script template used is :component:`esp32/ld/esp32.project.ld.in`, and is used only for the app build. The generated output script is
put under the build directory of the same component. Modifying this linker script template triggers a re-link of the app binary.
Linker Fragment File
链接脚本模板
^^^^^^^^^^^^
-目前使用的链接脚本模板是 :component:`esp32/ld/esp32.common.ld.in`,仅用于应用程序的构建,生成的链接脚本文件将放在同一组件的构建目录下。值得注意的是,修改此链接描述文件模板会触发应用程序的二进制文件的重新链接。
+目前使用的链接脚本模板是 :component:`esp32/ld/esp32.project.ld.in`,仅用于应用程序的构建,生成的链接脚本文件将放在同一组件的构建目录下。值得注意的是,修改此链接描述文件模板会触发应用程序的二进制文件的重新链接。
链接片段文件
^^^^^^^^^^^^
print_status "Touching app-only template ld file should only re-link app"
take_build_snapshot
- touch ${IDF_PATH}/components/esp32/ld/esp32.common.ld.in
+ touch ${IDF_PATH}/components/esp32/ld/esp32.project.ld.in
make
assert_rebuilt ${APP_BINS}
assert_not_rebuilt ${BOOTLOADER_BINS}
print_status "Updating app-only ld file should only re-link app"
take_build_snapshot
- cp ${IDF_PATH}/components/esp32/ld/esp32.common.ld.in .
+ cp ${IDF_PATH}/components/esp32/ld/esp32.project.ld.in .
sleep 1 # ninja may ignore if the timestamp delta is too low
- echo "/* (Build test comment) */" >> ${IDF_PATH}/components/esp32/ld/esp32.common.ld.in
+ echo "/* (Build test comment) */" >> ${IDF_PATH}/components/esp32/ld/esp32.project.ld.in
idf.py build || failure "Failed to rebuild with modified linker script"
assert_rebuilt ${APP_BINS}
assert_not_rebuilt ${BOOTLOADER_BINS}
- mv esp32.common.ld.in ${IDF_PATH}/components/esp32/ld/
+ mv esp32.project.ld.in ${IDF_PATH}/components/esp32/ld/
print_status "Updating fragment file should only re-link app" # only app linker script is generated by tool for now
take_build_snapshot