mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-06 08:37:29 +02:00
components: update with build system changes
This commit is contained in:
@@ -3,9 +3,8 @@ require_idf_targets(esp32)
|
||||
if(BOOTLOADER_BUILD)
|
||||
# For bootloader, all we need from esp32 is headers
|
||||
set(COMPONENT_ADD_INCLUDEDIRS include)
|
||||
set(COMPONENT_REQUIRES ${IDF_COMPONENTS} soc) #unfortunately rom/uart uses SOC registers directly
|
||||
set(COMPONENT_SRCS )
|
||||
register_component()
|
||||
target_linker_script(${COMPONENT_LIB} "ld/esp32.peripherals.ld")
|
||||
else()
|
||||
# Regular app build
|
||||
|
||||
@@ -47,52 +46,42 @@ else()
|
||||
|
||||
register_component()
|
||||
|
||||
target_linker_script(${COMPONENT_TARGET} "${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld")
|
||||
target_linker_script(${COMPONENT_LIB} "${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld")
|
||||
|
||||
# Rely on user code to define app_main
|
||||
target_link_libraries(${COMPONENT_LIB} "-u app_main")
|
||||
|
||||
if(CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY)
|
||||
# This has to be linked before esp32.project.ld
|
||||
target_linker_script(${COMPONENT_TARGET} "ld/esp32.extram.bss.ld")
|
||||
target_linker_script(${COMPONENT_LIB} "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_project_script "${CMAKE_CURRENT_BINARY_DIR}/esp32.project.ld")
|
||||
set(esp32_project_template "${CMAKE_CURRENT_LIST_DIR}/ld/esp32.project.ld.in")
|
||||
# Process the template file through the linker script generation mechanism, and use the output for linking the
|
||||
# final binary
|
||||
target_linker_script(${COMPONENT_LIB} "${CMAKE_CURRENT_LIST_DIR}/ld/esp32.project.ld.in" PROCESS)
|
||||
|
||||
ldgen_process_template(${esp32_project_template} ${esp32_project_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} "ld/esp32.peripherals.ld")
|
||||
|
||||
target_link_libraries(${COMPONENT_TARGET} gcc)
|
||||
target_link_libraries(${COMPONENT_TARGET} "-u call_user_start_cpu0")
|
||||
target_linker_script(${COMPONENT_LIB} "ld/esp32.peripherals.ld")
|
||||
target_link_libraries(${COMPONENT_LIB} gcc)
|
||||
target_link_libraries(${COMPONENT_LIB} "-u call_user_start_cpu0")
|
||||
|
||||
#ld_include_panic_highint_hdl is added as an undefined symbol because otherwise the
|
||||
#linker will ignore panic_highint_hdl.S as it has no other files depending on any
|
||||
#symbols in it.
|
||||
target_link_libraries(${COMPONENT_TARGET} "-u ld_include_panic_highint_hdl")
|
||||
target_link_libraries(${COMPONENT_LIB} "-u ld_include_panic_highint_hdl")
|
||||
|
||||
idf_build_get_property(sdkconfig_header SDKCONFIG_HEADER)
|
||||
get_filename_component(config_dir ${sdkconfig_header} DIRECTORY)
|
||||
# Preprocess esp32.ld linker script to include configuration, becomes esp32_out.ld
|
||||
set(LD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ld)
|
||||
add_custom_command(
|
||||
OUTPUT esp32_out.ld
|
||||
COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32_out.ld -I ${CONFIG_DIR} ${LD_DIR}/esp32.ld
|
||||
COMMAND "${CMAKE_C_COMPILER}" -C -P -x c -E -o esp32_out.ld -I ${config_dir} ${LD_DIR}/esp32.ld
|
||||
MAIN_DEPENDENCY ${LD_DIR}/esp32.ld ${SDKCONFIG_H}
|
||||
COMMENT "Generating linker script..."
|
||||
VERBATIM)
|
||||
|
||||
add_custom_target(esp32_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld)
|
||||
add_dependencies(${COMPONENT_TARGET} esp32_linker_script)
|
||||
|
||||
# Enable dynamic esp_timer overflow value if building unit tests
|
||||
if(esp32_test IN_LIST BUILD_TEST_COMPONENTS)
|
||||
add_definitions(-DESP_TIMER_DYNAMIC_OVERFLOW_VAL)
|
||||
endif()
|
||||
add_dependencies(${COMPONENT_LIB} esp32_linker_script)
|
||||
|
||||
# disable stack protection in files which are involved in initialization of that feature
|
||||
set_source_files_properties(
|
||||
|
||||
Reference in New Issue
Block a user