fix(ulp): restore legacy LP-core child link behavior

Preserve all linker scripts passed to target_linker_script() so LP-core child builds keep the full esp32p4 LP ROM script set instead of only the first script.

Link the ULP runtime component as WHOLE_ARCHIVE for ULP child builds, matching the legacy helper behavior where runtime sources were added directly to the executable. This keeps strong runtime handlers such as ulp_lp_core_panic_handler from being skipped in favor of weak defaults from already-extracted archive objects.

Validated with the esp32p4 lp_core_hp_uart panic and LP-ROM pytest cases, plus the focused local/CI build_all shape for the app.
This commit is contained in:
Renz Bagaporo
2026-07-29 13:08:23 +09:00
parent e331c8e310
commit c925f6bcc6
2 changed files with 16 additions and 2 deletions
+11 -1
View File
@@ -266,10 +266,20 @@ if(priv_requires)
list(REMOVE_DUPLICATES priv_requires)
endif()
set(whole_archive)
if(__ULP_BUILD)
# Legacy ULP child builds added the LP-core runtime sources directly to the
# executable. Preserve that behavior so strong handlers such as
# ulp_lp_core_panic_handler are not dropped in favor of weak defaults from
# other runtime objects.
set(whole_archive WHOLE_ARCHIVE)
endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${includes}
REQUIRES ${requires}
PRIV_REQUIRES ${priv_requires})
PRIV_REQUIRES ${priv_requires}
${whole_archive})
# In the parent app build, the ulp component only provides the host-side API.
# The executable/linker setup below is for native ULP child projects.
+5 -1
View File
@@ -193,7 +193,7 @@ endfunction()
with the ``PROCESS`` option, it is logical to provide only a single
``scriptfile`` as a template.
#]]
function(target_linker_script target deptype scriptfiles)
function(target_linker_script target deptype)
# The linker script files, templates, and their output filenames are stored
# only as component properties. The script files are generated and added to
# the library link interface in the idf_build_library function.
@@ -201,6 +201,10 @@ function(target_linker_script target deptype scriptfiles)
set(one_value PROCESS FLAGS)
set(multi_value)
cmake_parse_arguments(ARG "${options}" "${one_value}" "${multi_value}" ${ARGN})
set(scriptfiles ${ARG_UNPARSED_ARGUMENTS})
if(NOT scriptfiles)
message(FATAL_ERROR "target_linker_script requires at least one linker script file")
endif()
foreach(scriptfile ${scriptfiles})
get_filename_component(scriptfile "${scriptfile}" ABSOLUTE)
idf_msg("Adding linker script ${scriptfile}")