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 <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2024-04-08 14:08:23 +02:00
committed by BOT
parent cb81d1a4f9
commit fbe8bf89ee
30 changed files with 210 additions and 41 deletions
+3 -1
View File
@@ -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
)
+6 -1
View File
@@ -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")
@@ -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)
@@ -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"
)
+9 -1
View File
@@ -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}"
)
@@ -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()
+9 -1
View File
@@ -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"
)
+9 -1
View File
@@ -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"
)
+9 -1
View File
@@ -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}"
)
+8 -1
View File
@@ -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"
)
+9 -1
View File
@@ -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"
)
+9 -1
View File
@@ -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}"
)
+9 -1
View File
@@ -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"
)
+10 -1
View File
@@ -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}"
)
+9 -1
View File
@@ -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"
)
+9 -1
View File
@@ -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}"
)
+9 -1
View File
@@ -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"
)
+12 -2
View File
@@ -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}"
)
+12 -2
View File
@@ -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}"
)
+9 -1
View File
@@ -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"
)
@@ -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)
+1
View File
@@ -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()
+9 -2
View File
@@ -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")