From fbe8bf89ee4431c72631bc227bf7008cb3aa024e Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Mon, 8 Apr 2024 14:08:23 +0200 Subject: [PATCH] fix: properly resolve component dependencies There is currently a bug in the __build_resolve_and_add_req function in tools/cmake/build.cmake where the check for registered component requirements is incorrectly applied to the component itself rather than its dependencies. This issue likely originated from a typo, using component_target instead of _component_target. To prevent further confusion, _component_target has been renamed to _req_target. Fixing this revealed multiple incorrect dependencies for the Linux target, which have now been resolved by explicitly specifying the dependencies for the Linux target. Closes https://github.com/espressif/esp-idf/issues/13447 Signed-off-by: Frantisek Hrbata --- components/console/CMakeLists.txt | 4 +++- components/efuse/CMakeLists.txt | 7 ++++++- components/efuse/test_apps/main/CMakeLists.txt | 2 +- components/esp_driver_ana_cmpr/CMakeLists.txt | 10 +++++++++- components/esp_driver_cam/CMakeLists.txt | 10 +++++++++- components/esp_driver_gpio/CMakeLists.txt | 3 +++ components/esp_driver_gptimer/CMakeLists.txt | 10 +++++++++- components/esp_driver_i2c/CMakeLists.txt | 10 +++++++++- components/esp_driver_jpeg/CMakeLists.txt | 10 +++++++++- components/esp_driver_ledc/CMakeLists.txt | 9 ++++++++- components/esp_driver_mcpwm/CMakeLists.txt | 10 +++++++++- components/esp_driver_parlio/CMakeLists.txt | 10 +++++++++- components/esp_driver_pcnt/CMakeLists.txt | 10 +++++++++- components/esp_driver_ppa/CMakeLists.txt | 11 ++++++++++- components/esp_driver_rmt/CMakeLists.txt | 10 +++++++++- components/esp_driver_sdio/CMakeLists.txt | 10 +++++++++- components/esp_driver_sdm/CMakeLists.txt | 10 +++++++++- components/esp_driver_sdmmc/CMakeLists.txt | 14 ++++++++++++-- components/esp_driver_sdspi/CMakeLists.txt | 14 ++++++++++++-- components/esp_driver_uart/CMakeLists.txt | 10 +++++++++- .../esp_driver_usb_serial_jtag/CMakeLists.txt | 10 +++++++++- components/esp_phy/CMakeLists.txt | 1 + components/nvs_flash/CMakeLists.txt | 11 +++++++++-- .../get-started/hello_world/main/CMakeLists.txt | 1 + .../protocols/https_mbedtls/main/CMakeLists.txt | 1 + tools/cmake/build.cmake | 15 ++++++++------- tools/idf_py_actions/hints.yml | 2 +- tools/test_build_system/test_components.py | 14 +++++++------- tools/test_idf_py/error_output.yml | 2 +- .../components/test_utils/CMakeLists.txt | 10 +++++++++- 30 files changed, 210 insertions(+), 41 deletions(-) diff --git a/components/console/CMakeLists.txt b/components/console/CMakeLists.txt index 684eb69d19..2343e088ff 100644 --- a/components/console/CMakeLists.txt +++ b/components/console/CMakeLists.txt @@ -7,8 +7,10 @@ set(srcs "commands.c" if(${target} STREQUAL "linux") list(APPEND srcs "esp_console_repl_linux.c") + set(requires "") else() list(APPEND srcs "esp_console_repl_chip.c") + set(requires vfs esp_vfs_console) endif() set(argtable_srcs argtable3/arg_cmd.c @@ -31,7 +33,7 @@ idf_component_register(SRCS ${srcs} ${argtable_srcs} INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} PRIV_INCLUDE_DIRS private_include - REQUIRES vfs esp_vfs_console + REQUIRES "${requires}" PRIV_REQUIRES esp_driver_uart esp_driver_usb_serial_jtag ) diff --git a/components/efuse/CMakeLists.txt b/components/efuse/CMakeLists.txt index f969fd344f..e0f57b1d34 100644 --- a/components/efuse/CMakeLists.txt +++ b/components/efuse/CMakeLists.txt @@ -35,8 +35,13 @@ if(BOOTLOADER_BUILD) PRIV_INCLUDE_DIRS "${private_include}") else() list(APPEND srcs "src/esp_efuse_startup.c") + if(${target} STREQUAL "linux") + set(priv_requires soc spi_flash esp_system esp_partition) + else() + set(priv_requires bootloader_support soc spi_flash esp_system esp_partition esp_app_format) + endif() idf_component_register(SRCS "${srcs}" - PRIV_REQUIRES bootloader_support soc spi_flash esp_system esp_partition esp_app_format + PRIV_REQUIRES "${priv_requires}" INCLUDE_DIRS "${include_dirs}" PRIV_INCLUDE_DIRS "${private_include}") if(NOT ${target} STREQUAL "linux") diff --git a/components/efuse/test_apps/main/CMakeLists.txt b/components/efuse/test_apps/main/CMakeLists.txt index 4aad97d4aa..491dd241e7 100644 --- a/components/efuse/test_apps/main/CMakeLists.txt +++ b/components/efuse/test_apps/main/CMakeLists.txt @@ -14,5 +14,5 @@ set(src_dirs "." "${dir}") idf_component_register(SRC_DIRS "${src_dirs}" PRIV_INCLUDE_DIRS "." "${dir}/include" "../../private_include" "../../${target}/private_include" - PRIV_REQUIRES cmock efuse bootloader_support esp_timer + PRIV_REQUIRES cmock efuse esp_timer WHOLE_ARCHIVE) diff --git a/components/esp_driver_ana_cmpr/CMakeLists.txt b/components/esp_driver_ana_cmpr/CMakeLists.txt index 5fd665a33d..c73f5f7a4c 100644 --- a/components/esp_driver_ana_cmpr/CMakeLists.txt +++ b/components/esp_driver_ana_cmpr/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) # Analog comparator related source files @@ -8,8 +10,14 @@ if(CONFIG_SOC_ANA_CMPR_SUPPORTED) endif() endif() +if(${target} STREQUAL "linux") + set(priv_requires "") +else() + set(priv_requires esp_pm esp_driver_gpio) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS "include" - PRIV_REQUIRES esp_pm esp_driver_gpio + PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_cam/CMakeLists.txt b/components/esp_driver_cam/CMakeLists.txt index b6a0c4dee4..86f16af2a9 100644 --- a/components/esp_driver_cam/CMakeLists.txt +++ b/components/esp_driver_cam/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs "esp_cam_ctlr.c") set(include "include" "interface") @@ -7,7 +9,13 @@ if(CONFIG_SOC_MIPI_CSI_SUPPORTED) list(APPEND include "csi/include") endif() +if(${target} STREQUAL "linux") + set(priv_requires "") +else() + set(priv_requires esp_mm) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${include} - PRIV_REQUIRES esp_mm + PRIV_REQUIRES "${priv_requires}" ) diff --git a/components/esp_driver_gpio/CMakeLists.txt b/components/esp_driver_gpio/CMakeLists.txt index dce1295124..4535d40091 100644 --- a/components/esp_driver_gpio/CMakeLists.txt +++ b/components/esp_driver_gpio/CMakeLists.txt @@ -1,6 +1,9 @@ idf_build_get_property(target IDF_TARGET) if(${target} STREQUAL "linux") + # TODO: Remove this once all components have their requirements explicitly defined + # and using set(COMPONENTS main). + idf_component_register() return() # This component is not supported by the POSIX/Linux simulator endif() diff --git a/components/esp_driver_gptimer/CMakeLists.txt b/components/esp_driver_gptimer/CMakeLists.txt index 9b0871a8f7..99dc8b3608 100644 --- a/components/esp_driver_gptimer/CMakeLists.txt +++ b/components/esp_driver_gptimer/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") if(CONFIG_SOC_GPTIMER_SUPPORTED) @@ -9,8 +11,14 @@ if(CONFIG_SOC_TIMER_SUPPORT_ETM) list(APPEND srcs "src/gptimer_etm.c") endif() +if(${target} STREQUAL "linux") + set(requires "") +else() + set(requires esp_pm) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - REQUIRES "esp_pm" + REQUIRES "${requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_i2c/CMakeLists.txt b/components/esp_driver_i2c/CMakeLists.txt index db7bdc8858..699cf0b5d3 100644 --- a/components/esp_driver_i2c/CMakeLists.txt +++ b/components/esp_driver_i2c/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(include "include") @@ -13,8 +15,14 @@ if(CONFIG_SOC_I2C_SUPPORTED) endif() +if(${target} STREQUAL "linux") + set(priv_requires esp_ringbuf) +else() + set(priv_requires esp_driver_gpio esp_pm esp_ringbuf) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${include} - PRIV_REQUIRES esp_driver_gpio esp_pm esp_ringbuf + PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_jpeg/CMakeLists.txt b/components/esp_driver_jpeg/CMakeLists.txt index 9e6422c263..f84c1614d3 100644 --- a/components/esp_driver_jpeg/CMakeLists.txt +++ b/components/esp_driver_jpeg/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") @@ -21,7 +23,13 @@ if(CONFIG_SOC_JPEG_CODEC_SUPPORTED) endif() endif() +if(${target} STREQUAL "linux") + set(priv_requires "") +else() + set(priv_requires esp_mm esp_pm) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - PRIV_REQUIRES "esp_mm" "esp_pm" + PRIV_REQUIRES "${priv_requires}" ) diff --git a/components/esp_driver_ledc/CMakeLists.txt b/components/esp_driver_ledc/CMakeLists.txt index 8958ebaa93..e16690efab 100644 --- a/components/esp_driver_ledc/CMakeLists.txt +++ b/components/esp_driver_ledc/CMakeLists.txt @@ -1,3 +1,4 @@ +idf_build_get_property(target IDF_TARGET) set(srcs) set(public_include "include") @@ -6,9 +7,15 @@ if(CONFIG_SOC_LEDC_SUPPORTED) list(APPEND srcs "src/ledc.c") endif() +if(${target} STREQUAL "linux") + set(priv_requires "") +else() + set(priv_requires esp_pm esp_driver_gpio) +endif() + idf_component_register( SRCS ${srcs} INCLUDE_DIRS ${public_include} - PRIV_REQUIRES "esp_pm" "esp_driver_gpio" + PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_mcpwm/CMakeLists.txt b/components/esp_driver_mcpwm/CMakeLists.txt index 15483918a4..c1233b1f51 100644 --- a/components/esp_driver_mcpwm/CMakeLists.txt +++ b/components/esp_driver_mcpwm/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") if(CONFIG_SOC_MCPWM_SUPPORTED) @@ -14,8 +16,14 @@ if(CONFIG_SOC_MCPWM_SUPPORTED) endif() endif() +if(${target} STREQUAL "linux") + set(priv_requires "") +else() + set(priv_requires esp_pm esp_driver_gpio) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - PRIV_REQUIRES "esp_pm" "esp_driver_gpio" + PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_parlio/CMakeLists.txt b/components/esp_driver_parlio/CMakeLists.txt index 92a7904903..16b7e5f125 100644 --- a/components/esp_driver_parlio/CMakeLists.txt +++ b/components/esp_driver_parlio/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") if(CONFIG_SOC_PARLIO_SUPPORTED) @@ -6,7 +8,13 @@ if(CONFIG_SOC_PARLIO_SUPPORTED) "src/parlio_rx.c") endif() +if(${target} STREQUAL "linux") + set(priv_requires "") +else() + set(priv_requires esp_pm esp_driver_gpio esp_mm) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - PRIV_REQUIRES "esp_pm" "esp_driver_gpio" "esp_mm" + PRIV_REQUIRES "${priv_requires}" ) diff --git a/components/esp_driver_pcnt/CMakeLists.txt b/components/esp_driver_pcnt/CMakeLists.txt index 6cf979b0cc..5a0474cac6 100644 --- a/components/esp_driver_pcnt/CMakeLists.txt +++ b/components/esp_driver_pcnt/CMakeLists.txt @@ -1,11 +1,19 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") if(CONFIG_SOC_PCNT_SUPPORTED) list(APPEND srcs "src/pulse_cnt.c") endif() +if(${target} STREQUAL "linux") + set(priv_requires "") +else() + set(priv_requires esp_pm esp_driver_gpio) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - PRIV_REQUIRES "esp_pm" "esp_driver_gpio" + PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_ppa/CMakeLists.txt b/components/esp_driver_ppa/CMakeLists.txt index ed0d3ac201..defc8c5e24 100644 --- a/components/esp_driver_ppa/CMakeLists.txt +++ b/components/esp_driver_ppa/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") if(CONFIG_SOC_PPA_SUPPORTED) @@ -7,7 +9,14 @@ if(CONFIG_SOC_PPA_SUPPORTED) "src/ppa_fill.c") endif() +if(${target} STREQUAL "linux") + set(priv_requires "") +else() + set(priv_requires esp_mm esp_pm) +endif() + + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - PRIV_REQUIRES esp_mm esp_pm + PRIV_REQUIRES "${priv_requires}" ) diff --git a/components/esp_driver_rmt/CMakeLists.txt b/components/esp_driver_rmt/CMakeLists.txt index c4cb98ce79..fa980f776a 100644 --- a/components/esp_driver_rmt/CMakeLists.txt +++ b/components/esp_driver_rmt/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") if(CONFIG_SOC_RMT_SUPPORTED) @@ -7,8 +9,14 @@ if(CONFIG_SOC_RMT_SUPPORTED) "src/rmt_tx.c") endif() +if(${target} STREQUAL "linux") + set(priv_requires "") +else() + set(priv_requires esp_pm esp_driver_gpio esp_mm) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - PRIV_REQUIRES "esp_pm" "esp_driver_gpio" "esp_mm" + PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_sdio/CMakeLists.txt b/components/esp_driver_sdio/CMakeLists.txt index a90762b19c..2aff8668ce 100644 --- a/components/esp_driver_sdio/CMakeLists.txt +++ b/components/esp_driver_sdio/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") @@ -7,7 +9,13 @@ if(CONFIG_SOC_SDIO_SLAVE_SUPPORTED) list(APPEND srcs "src/sdio_slave.c") endif() +if(${target} STREQUAL "linux") + set(priv_requires esp_ringbuf) +else() + set(priv_requires esp_driver_gpio esp_ringbuf) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - PRIV_REQUIRES esp_driver_gpio esp_ringbuf + PRIV_REQUIRES "${priv_requires}" ) diff --git a/components/esp_driver_sdm/CMakeLists.txt b/components/esp_driver_sdm/CMakeLists.txt index b7d5031dc8..bf83629963 100644 --- a/components/esp_driver_sdm/CMakeLists.txt +++ b/components/esp_driver_sdm/CMakeLists.txt @@ -1,11 +1,19 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") if(CONFIG_SOC_SDM_SUPPORTED) list(APPEND srcs "src/sdm.c") endif() +if(${target} STREQUAL "linux") + set(priv_requires "") +else() + set(priv_requires esp_pm esp_driver_gpio) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - PRIV_REQUIRES "esp_pm" "esp_driver_gpio" + PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_sdmmc/CMakeLists.txt b/components/esp_driver_sdmmc/CMakeLists.txt index afca512530..fd94c42b34 100644 --- a/components/esp_driver_sdmmc/CMakeLists.txt +++ b/components/esp_driver_sdmmc/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") @@ -8,8 +10,16 @@ if(CONFIG_SOC_SDMMC_HOST_SUPPORTED) "src/sdmmc_host.c") endif() +if(${target} STREQUAL "linux") + set(requires "") + set(priv_requires esp_timer) +else() + set(requires sdmmc esp_driver_gpio) + set(priv_requires esp_timer esp_pm esp_mm) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - REQUIRES sdmmc esp_driver_gpio - PRIV_REQUIRES esp_timer esp_pm esp_mm + REQUIRES "${requires}" + PRIV_REQUIRES "${priv_requires}" ) diff --git a/components/esp_driver_sdspi/CMakeLists.txt b/components/esp_driver_sdspi/CMakeLists.txt index 41809a1e0d..b9af00622a 100644 --- a/components/esp_driver_sdspi/CMakeLists.txt +++ b/components/esp_driver_sdspi/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") @@ -8,8 +10,16 @@ if(CONFIG_SOC_GPSPI_SUPPORTED) "src/sdspi_transaction.c") endif() +if(${target} STREQUAL "linux") + set(requires "") + set(priv_requires esp_timer) +else() + set(requires sdmmc esp_driver_spi esp_driver_gpio) + set(priv_requires esp_timer) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${public_include} - REQUIRES sdmmc esp_driver_spi esp_driver_gpio - PRIV_REQUIRES esp_timer + REQUIRES "${requires}" + PRIV_REQUIRES "${priv_requires}" ) diff --git a/components/esp_driver_uart/CMakeLists.txt b/components/esp_driver_uart/CMakeLists.txt index c489cab286..3c564f0485 100644 --- a/components/esp_driver_uart/CMakeLists.txt +++ b/components/esp_driver_uart/CMakeLists.txt @@ -1,13 +1,21 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(public_include "include") if(CONFIG_SOC_UART_SUPPORTED) list(APPEND srcs "src/uart.c") endif() +if(${target} STREQUAL "linux") + set(priv_requires esp_ringbuf) +else() + set(priv_requires esp_pm esp_driver_gpio esp_ringbuf) +endif() + idf_component_register( SRCS ${srcs} INCLUDE_DIRS ${public_include} - PRIV_REQUIRES esp_pm esp_driver_gpio esp_ringbuf + PRIV_REQUIRES "${priv_requires}" LDFRAGMENTS "linker.lf" ) diff --git a/components/esp_driver_usb_serial_jtag/CMakeLists.txt b/components/esp_driver_usb_serial_jtag/CMakeLists.txt index 48856a7bb3..884353ac00 100644 --- a/components/esp_driver_usb_serial_jtag/CMakeLists.txt +++ b/components/esp_driver_usb_serial_jtag/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(target IDF_TARGET) + set(srcs) set(include "include") @@ -7,9 +9,15 @@ if(CONFIG_SOC_USB_SERIAL_JTAG_SUPPORTED) "src/usb_serial_jtag_connection_monitor.c") endif() +if(${target} STREQUAL "linux") + set(priv_requires esp_ringbuf esp_timer) +else() + set(priv_requires esp_driver_gpio esp_ringbuf esp_pm esp_timer) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS ${include} - PRIV_REQUIRES esp_driver_gpio esp_ringbuf esp_pm esp_timer + PRIV_REQUIRES "${priv_requires}" ) if(CONFIG_VFS_SUPPORT_IO AND CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED) diff --git a/components/esp_phy/CMakeLists.txt b/components/esp_phy/CMakeLists.txt index 3ded3266a0..5509b5b1aa 100644 --- a/components/esp_phy/CMakeLists.txt +++ b/components/esp_phy/CMakeLists.txt @@ -6,6 +6,7 @@ endif() if(IDF_TARGET STREQUAL "esp32p4" OR IDF_TARGET STREQUAL "esp32c61") # TODO: IDF-7460, IDF-8851, IDF-9553 + idf_component_register() return() endif() diff --git a/components/nvs_flash/CMakeLists.txt b/components/nvs_flash/CMakeLists.txt index fd6700978c..1d03a68a19 100644 --- a/components/nvs_flash/CMakeLists.txt +++ b/components/nvs_flash/CMakeLists.txt @@ -14,9 +14,16 @@ set(srcs "src/nvs_api.cpp" "src/nvs_types.cpp" "src/nvs_platform.cpp") +set(requires esp_partition) +if(${target} STREQUAL "linux") + set(priv_requires spi_flash) +else() + set(priv_requires spi_flash newlib) +endif() + idf_component_register(SRCS "${srcs}" - REQUIRES "esp_partition" - PRIV_REQUIRES spi_flash newlib + REQUIRES "${requires}" + PRIV_REQUIRES "${priv_requires}" INCLUDE_DIRS "include" "../spi_flash/include" PRIV_INCLUDE_DIRS "private_include") diff --git a/examples/get-started/hello_world/main/CMakeLists.txt b/examples/get-started/hello_world/main/CMakeLists.txt index 07686dc8e1..d1acf9e518 100644 --- a/examples/get-started/hello_world/main/CMakeLists.txt +++ b/examples/get-started/hello_world/main/CMakeLists.txt @@ -1,2 +1,3 @@ idf_component_register(SRCS "hello_world_main.c" + PRIV_REQUIRES spi_flash INCLUDE_DIRS "") diff --git a/examples/protocols/https_mbedtls/main/CMakeLists.txt b/examples/protocols/https_mbedtls/main/CMakeLists.txt index bdc0271b9c..d661ac3447 100644 --- a/examples/protocols/https_mbedtls/main/CMakeLists.txt +++ b/examples/protocols/https_mbedtls/main/CMakeLists.txt @@ -2,4 +2,5 @@ # # (If this was a component, we would set COMPONENT_EMBED_TXTFILES here.) idf_component_register(SRCS "https_mbedtls_example_main.c" + PRIV_REQUIRES esp_event nvs_flash esp_netif mbedtls INCLUDE_DIRS ".") diff --git a/tools/cmake/build.cmake b/tools/cmake/build.cmake index 0bafd9fcb1..85b11d0039 100644 --- a/tools/cmake/build.cmake +++ b/tools/cmake/build.cmake @@ -262,13 +262,14 @@ endfunction() # Resolve the requirement component to the component target created for that component. # function(__build_resolve_and_add_req var component_target req type) - __component_get_target(_component_target ${req}) - __component_get_property(_component_registered ${component_target} __COMPONENT_REGISTERED) - if(NOT _component_target OR NOT _component_registered) - message(FATAL_ERROR "Failed to resolve component '${req}'.") + __component_get_target(_req_target ${req}) + __component_get_property(_req_registered ${_req_target} __COMPONENT_REGISTERED) + if(NOT _req_target OR NOT _req_registered) + __component_get_property(_component_name ${component_target} COMPONENT_NAME) + message(FATAL_ERROR "Failed to resolve component '${req}' required by component '${_component_name}'.") endif() - __component_set_property(${component_target} ${type} ${_component_target} APPEND) - set(${var} ${_component_target} PARENT_SCOPE) + __component_set_property(${component_target} ${type} ${_req_target} APPEND) + set(${var} ${_req_target} PARENT_SCOPE) endfunction() # @@ -449,7 +450,7 @@ endfunction() # if PROJECT_DIR is set and CMAKE_SOURCE_DIR/sdkconfig if not # @param[in, optional] SDKCONFIG_DEFAULTS (single value) config defaults file to use for the build; defaults # to none (Kconfig defaults or previously generated config are used) -# @param[in, optional] BUILD_DIR (single value) directory for build artifacts; defautls to CMAKE_BINARY_DIR +# @param[in, optional] BUILD_DIR (single value) directory for build artifacts; defaults to CMAKE_BINARY_DIR # @param[in, optional] COMPONENTS (multivalue) select components to process among the components # known by the build system # (added via `idf_build_component`). This argument is used to trim the build. diff --git a/tools/idf_py_actions/hints.yml b/tools/idf_py_actions/hints.yml index f3bd56bf21..baff996045 100644 --- a/tools/idf_py_actions/hints.yml +++ b/tools/idf_py_actions/hints.yml @@ -216,7 +216,7 @@ - re: "Failed to resolve component '(?!esp_ipc)(\\w+)'" - hint: "The component {} could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager or has been removed and refactored into some other component.\nPlease look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.\nRefer to the migration guide for more details about moved components.\nRefer to the build-system guide for more details about how components are found and included in the build." + hint: "The component {} could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager, the component has been removed and refactored into some other component or the component may not be supported by the selected target.\nPlease look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.\nRefer to the migration guide for more details about moved components.\nRefer to the build-system guide for more details about how components are found and included in the build." match_to_output: True - diff --git a/tools/test_build_system/test_components.py b/tools/test_build_system/test_components.py index e4c167b9e2..79bea5bda6 100644 --- a/tools/test_build_system/test_components.py +++ b/tools/test_build_system/test_components.py @@ -87,21 +87,21 @@ def test_component_properties_are_set(idf_py: IdfPyFunc, test_app_copy: Path) -> assert 'SRCS:{}'.format((test_app_copy / 'main' / 'build_test_app.c').as_posix()) in ret.stdout, 'Component properties should be set' -def test_component_overriden_dir(idf_py: IdfPyFunc, test_app_copy: Path, default_idf_env: EnvDict) -> None: - logging.info('Getting component overriden dir') +def test_component_overridden_dir(idf_py: IdfPyFunc, test_app_copy: Path, default_idf_env: EnvDict) -> None: + logging.info('Getting component overridden dir') (test_app_copy / 'components' / 'hal').mkdir(parents=True) (test_app_copy / 'components' / 'hal' / 'CMakeLists.txt').write_text('\n'.join([ - 'idf_component_get_property(overriden_dir ${COMPONENT_NAME} COMPONENT_OVERRIDEN_DIR)', - 'message(STATUS overriden_dir:${overriden_dir})'])) + 'idf_component_get_property(overridden_dir ${COMPONENT_NAME} COMPONENT_OVERRIDEN_DIR)', + 'message(STATUS overridden_dir:${overridden_dir})', 'idf_component_register()'])) ret = idf_py('reconfigure') idf_path = Path(default_idf_env.get('IDF_PATH')) # no registration, overrides registration as well - assert 'overriden_dir:{}'.format((idf_path / 'components' / 'hal').as_posix()) in ret.stdout, 'Failed to get overriden dir' + assert 'overridden_dir:{}'.format((idf_path / 'components' / 'hal').as_posix()) in ret.stdout, 'Failed to get overridden dir' append_to_file((test_app_copy / 'components' / 'hal' / 'CMakeLists.txt'), '\n'.join([ '', - 'idf_component_register(KCONFIG ${overriden_dir}/Kconfig)', + 'idf_component_register(KCONFIG ${overridden_dir}/Kconfig)', 'idf_component_get_property(kconfig ${COMPONENT_NAME} KCONFIG)', - 'message(STATUS kconfig:${overriden_dir}/Kconfig)'])) + 'message(STATUS kconfig:${overridden_dir}/Kconfig)'])) ret = idf_py('reconfigure', check=False) assert 'kconfig:{}'.format((idf_path / 'components' / 'hal').as_posix()) in ret.stdout, 'Failed to verify original `main` directory' diff --git a/tools/test_idf_py/error_output.yml b/tools/test_idf_py/error_output.yml index 7e82b84293..034e941497 100644 --- a/tools/test_idf_py/error_output.yml +++ b/tools/test_idf_py/error_output.yml @@ -47,7 +47,7 @@ "HINT: The struct 'esp_tls_t' has now been made private - its elements can be only be accessed/modified through respective getter/setter functions. Please refer to the migration guide for more information." "Failed to resolve component 'component'\n": - "HINT: The component component could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager or has been removed and refactored into some other component.\nPlease look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.\nRefer to the migration guide for more details about moved components.\nRefer to the build-system guide for more details about how components are found and included in the build." + "HINT: The component component could not be found. This could be because: component name was misspelled, the component was not added to the build, the component has been moved to the IDF component manager, the component has been removed and refactored into some other component or the component may not be supported by the selected target.\nPlease look out for component in 'https://components.espressif.com' and add using 'idf.py add-dependency' command.\nRefer to the migration guide for more details about moved components.\nRefer to the build-system guide for more details about how components are found and included in the build." 'fatal error: tmp/atca_mbedtls_wrap.h: No such file or directory\n': "HINT: To use CONFIG_ESP_TLS_USE_SECURE_ELEMENT option, please install `esp-cryptoauthlib` using 'idf.py add-dependency espressif/esp-cryptoauthlib'" diff --git a/tools/unit-test-app/components/test_utils/CMakeLists.txt b/tools/unit-test-app/components/test_utils/CMakeLists.txt index 9ce3a99d9e..291b9638a2 100644 --- a/tools/unit-test-app/components/test_utils/CMakeLists.txt +++ b/tools/unit-test-app/components/test_utils/CMakeLists.txt @@ -1,3 +1,5 @@ +idf_build_get_property(arch IDF_TARGET_ARCH) + set(srcs "memory_checks.c" "test_runner.c" "test_utils.c") @@ -13,8 +15,14 @@ else() list(APPEND srcs "ref_clock_impl_timergroup.c") endif() +if("${arch}" STREQUAL "xtensa") + set(priv_requires perfmon esp_driver_pcnt esp_driver_gptimer esp_driver_rmt esp_netif) +else() + set(priv_requires esp_driver_pcnt esp_driver_gptimer esp_driver_rmt esp_netif) +endif() + idf_component_register(SRCS ${srcs} INCLUDE_DIRS include REQUIRES esp_partition idf_test cmock - PRIV_REQUIRES perfmon esp_driver_pcnt esp_driver_gptimer esp_driver_rmt esp_netif) + PRIV_REQUIRES "${priv_requires}") target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")