Merge branch 'task/buildv2_hygiene_and_dep_declarations_v6.1' into 'release/v6.1'

fix(components): generic dep-declaration and scope-leakage hygiene exposed by cmakev2 (v6.1)

See merge request espressif/esp-idf!48904
This commit is contained in:
Jiang Jiang Jian
2026-07-03 17:47:24 +08:00
24 changed files with 54 additions and 34 deletions
+2 -1
View File
@@ -4,8 +4,9 @@ if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs)
if(CONFIG_ESP_TRACE_TRANSPORT_APPTRACE)
set(srcs
list(APPEND srcs
"app_trace.c"
"app_trace_util.c"
"host_file_io.c"
+5 -1
View File
@@ -105,9 +105,13 @@ else()
esp_hal_clock esp_hal_security)
endif()
# src/flash_encrypt.c includes esp_security/esp_key_mgr.h on
# SOC_KEY_MANAGER_SUPPORTED targets. flash_encrypt.c is in the unconditional
# srcs list, so declare the dep unconditionally for all build variants.
list(APPEND priv_requires esp_security)
if(BOOTLOADER_BUILD)
list(APPEND srcs "src/bootloader_panic.c")
list(APPEND priv_requires esp_security)
if(CONFIG_SECURE_FLASH_ENC_ENABLED)
list(APPEND srcs "src/flash_encryption/flash_encrypt.c"
+1
View File
@@ -91,6 +91,7 @@ set(bt_priv_requires
esp_ringbuf
esp_gdbstub
esp_security
esp_event
)
idf_component_register(SRCS "${srcs}"
+2
View File
@@ -124,9 +124,11 @@
#include <sys/param.h>
#include <assert.h>
#include "linenoise.h"
#if !CONFIG_IDF_TARGET_LINUX
#if CONFIG_LIBC_PICOLIBC
#include <stdio-bufio.h>
#endif
#endif // !CONFIG_IDF_TARGET_LINUX
#if CONFIG_LIBC_PICOLIBC && !CONFIG_LIBC_PICOLIBC_NEWLIB_COMPATIBILITY
__thread FILE *linenoise_stdin;
@@ -1,7 +1,7 @@
idf_build_get_property(target IDF_TARGET)
set(srcs "test_event_main.c" "test_event_common.cpp")
set(priv_requires "esp_event unity")
set(priv_requires esp_event unity)
if(NOT ${target} STREQUAL "linux")
list(APPEND srcs
+6 -4
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -50,10 +50,12 @@ esp_err_t spi_hal_cal_clock_conf(const spi_hal_timing_param_t *timing_param, spi
spi_hal_cal_timing(timing_param->clk_src_hz, eff_clk_n, timing_param->use_gpio, timing_param->input_delay_ns, &dummy, &miso_delay);
#if SPI_LL_SUPPORT_TIME_TUNING
const int freq_limit = spi_hal_get_freq_limit(timing_param->use_gpio, timing_param->input_delay_ns);
if (!(timing_param->half_duplex || dummy == 0 || timing_param->no_compensate)) {
// This only a short log used as a "key" of the idf hint system, see `hints.yml`
// Short log used as a "key" by the idf hint system (see `hints.yml`).
// freq_limit is consumed only by HAL_EARLY_LOGE; mark unused so
// -Wunused-variable stays quiet when the macro expands to empty.
const int freq_limit __attribute__((unused)) =
spi_hal_get_freq_limit(timing_param->use_gpio, timing_param->input_delay_ns);
HAL_EARLY_LOGE(SPI_HAL_TAG, "The clock_speed_hz should less than %d", freq_limit);
return ESP_ERR_NOT_SUPPORTED;
}
+1
View File
@@ -7,6 +7,7 @@
// The HAL layer for SDIO slave (common part)
#include <string.h>
#include <stddef.h>
#include <inttypes.h>
#include "soc/sdio_slc_struct.h"
#include "soc/sdio_hinf_struct.h"
+1 -1
View File
@@ -13,7 +13,7 @@
#if __XTENSA__
#include "xtensa/xtruntime.h"
#include "xt_utils.h"
#else
#elif __riscv
#include "riscv/rv_utils.h"
#endif
+1
View File
@@ -1,4 +1,5 @@
menu "LibC"
depends on !IDF_TARGET_LINUX
choice LIBC
prompt "LibC to build application with"
@@ -41,4 +41,4 @@ add_custom_target(partition-table-8M
${partition_table_display}
VERBATIM)
add_dependencies(partition_api_test.elf partition-table partition-table-8M)
add_dependencies(${project_elf} partition-table partition-table-8M)
+5 -2
View File
@@ -27,7 +27,7 @@ endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${includes})
if(CONFIG_VFS_SUPPORT_IO)
if(CONFIG_VFS_SUPPORT_IO AND NOT ${target} STREQUAL "linux")
if(IDF_BUILD_V2)
idf_component_include(vfs)
@@ -63,6 +63,9 @@ if(CONFIG_VFS_SUPPORT_IO)
endif()
target_link_libraries(${COMPONENT_LIB} PRIVATE idf::vfs)
# Make sure esp_stdio_register gets called at startup stage
# Make sure esp_stdio_register gets called at startup stage.
# The referenced symbol is defined in stdio_vfs.c, which is only added to
# the source list above on non-Linux targets; the force-undef is gated on
# the same condition for the link line to remain resolvable.
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_vfs_include_console_register")
endif()
+1
View File
@@ -19,6 +19,7 @@ elseif(esp_tee_build)
# TEE build currently only uses the shared headers.
idf_component_register(INCLUDE_DIRS include)
else()
set(srcs)
if(CONFIG_SECURE_ENABLE_TEE)
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
# Add custom flash target for TEE binary
+2 -1
View File
@@ -4,8 +4,9 @@ if(${target} STREQUAL "linux")
return()
endif()
set(srcs)
if(CONFIG_ESP_TRACE_ENABLE)
set(srcs
list(APPEND srcs
"src/core/esp_trace_core.c"
"src/core/esp_trace_registry.c"
"src/ports/port_utils.c"
+7 -14
View File
@@ -15,25 +15,18 @@ if( NOT CONFIG_ESP_WIFI_ENABLED
"src/wifi_netif.c"
"src/wifi_default_ap.c")
# In build system v2, idf_component_optional_requires() includes the target
# component into the build immediately, so these stub sources are compiled
# even on targets where Wi-Fi is not supported. The stubs need esp_event and
# esp_netif headers, so those dependencies must be declared here for v2.
#
# In build system v1, idf_component_optional_requires() only links a
# component that is already part of the build. On non-Wi-Fi targets, this
# component is never pulled in, so the stubs are never compiled and the
# dependencies are not needed. Additionally, the CMAKE_BUILD_EARLY_EXPANSION
# guard ensures that the stubs are not compiled for v1.
set(priv_reqs "")
if(IDF_BUILD_V2)
set(priv_reqs "esp_event" "esp_netif")
endif()
# Public headers (notably esp_wifi_default.h) include esp_event.h,
# esp_netif.h and esp_phy.h. Declare these in REQUIRES so the headers
# are visible to consumers — same interface as the WiFi-enabled
# registration at the bottom of this file.
set(reqs "esp_event" "esp_netif" "esp_phy")
set(priv_reqs "wpa_supplicant")
# This component provides "esp_wifi" "wifi_apps/nan_app" headers if WiFi not enabled
# (implementation supported optionally in a managed component esp_wifi_remote)
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include" "wifi_apps/nan_app/include"
REQUIRES ${reqs}
PRIV_REQUIRES ${priv_reqs})
add_subdirectory(remote) # wifi-remote on esp32p4/h2 (no wifi)
return()
+1
View File
@@ -3,6 +3,7 @@ idf_build_get_property(esp_tee_build ESP_TEE_BUILD)
set(srcs "hal_utils.c")
set(includes "platform_port/include")
set(priv_include)
set(requires)
# target specific include must be added before the generic one
@@ -8,7 +8,7 @@ idf_component_register(SRCS "nvs_page_test.cpp"
PRIV_REQUIRES spi_flash)
target_compile_options(${COMPONENT_LIB} PUBLIC --coverage)
target_link_libraries(${COMPONENT_LIB} --coverage)
target_link_libraries(${COMPONENT_LIB} PUBLIC --coverage)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
target_compile_options(${COMPONENT_LIB} PRIVATE -std=gnu++20)
endif()
+2
View File
@@ -6,6 +6,8 @@ set(original_srcs "spiffs/src/spiffs_cache.c"
"spiffs/src/spiffs_hydrogen.c"
"spiffs/src/spiffs_nucleus.c")
set(srcs)
set(pr)
list(APPEND srcs "spiffs_api.c" ${original_srcs})
if(NOT ${target} STREQUAL "linux")
+1 -1
View File
@@ -23,4 +23,4 @@ set_property(
APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${build_dir}/image.bin")
add_dependencies(host_test_spiffs.elf image.bin)
add_dependencies(${project_elf} image.bin)
+1
View File
@@ -5,6 +5,7 @@
function(__setup_ulp_project app_name project_path prefix type s_sources exp_dep_srcs)
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
set(sources "")
spaces2list(s_sources)
foreach(source ${s_sources})
get_filename_component(source ${source} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_LIST_DIR})