fix(build): clean up dependencies on driver component

This commit is contained in:
Ivan Grokhotkov 2024-09-15 11:22:51 +02:00
parent 5e056de1e7
commit 68e9bcbf1e
No known key found for this signature in database
GPG Key ID: 1E050E141B280628
30 changed files with 41 additions and 55 deletions

View File

@ -121,16 +121,3 @@ if(CONFIG_APPTRACE_GCOV_ENABLE)
else()
target_link_libraries(${COMPONENT_LIB} INTERFACE $<TARGET_FILE:${app_trace}> c)
endif()
# This function adds a dependency on the given component if the component is included into the build.
function(maybe_add_component component_name)
idf_build_get_property(components BUILD_COMPONENTS)
if(${component_name} IN_LIST components)
idf_component_get_property(lib_name ${component_name} COMPONENT_LIB)
target_link_libraries(${COMPONENT_LIB} PUBLIC ${lib_name})
endif()
endfunction()
if(CONFIG_APPTRACE_DEST_UART0 OR CONFIG_APPTRACE_DEST_UART1 OR CONFIG_APPTRACE_DEST_UART2)
maybe_add_component(driver)
endif()

View File

@ -51,7 +51,18 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/deprecated/${target}/esp_adc_cal_legacy.c
list(APPEND srcs "deprecated/${target}/esp_adc_cal_legacy.c")
endif()
set(extra_requires)
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "esp32")
list(APPEND extra_requires esp_driver_i2s)
endif()
if(${target} STREQUAL "esp32s2")
list(APPEND extra_requires esp_driver_spi)
endif()
list(APPEND extra_requires driver) # esp_adc depends on "driver/adc_types_legacy.h"
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${includes}
PRIV_REQUIRES driver esp_driver_gpio efuse esp_pm esp_ringbuf esp_mm
PRIV_REQUIRES esp_driver_gpio efuse esp_pm esp_ringbuf esp_mm ${extra_requires}
LDFRAGMENTS linker.lf)

View File

@ -27,7 +27,7 @@ endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include"
PRIV_REQUIRES esp_timer driver esp_event
PRIV_REQUIRES esp_timer esp_driver_gpio
LDFRAGMENTS "${ldfragments}")
if(CONFIG_ESP_COEX_ENABLED)

View File

@ -53,10 +53,9 @@ if(CONFIG_ESP_PHY_ENABLED)
endif()
endif()
# [refactor-todo]: requires "driver" component for periph_ctrl header file
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include" "${idf_target}/include"
PRIV_REQUIRES nvs_flash driver efuse esp_timer esp_wifi
PRIV_REQUIRES nvs_flash esp_driver_gpio efuse esp_timer esp_wifi
LDFRAGMENTS "${ldfragments}"
EMBED_FILES ${embed_files}
)

View File

@ -8,9 +8,7 @@ set(includes "include")
set(priv_requires heap spi_flash esp_mm)
if(${target} STREQUAL "esp32")
list(APPEND priv_requires bootloader_support)
# [refactor-todo]: requires "driver" for `spicommon_periph_claim`
list(APPEND priv_requires driver)
list(APPEND priv_requires bootloader_support esp_driver_spi esp_driver_gpio)
endif()
set(srcs)

View File

@ -14,13 +14,6 @@ if(CONFIG_ESP_WIFI_ENABLED OR CONFIG_ESP_HOST_WIFI_ENABLED)
set(ldfragments "linker.lf")
endif()
if(IDF_TARGET_ESP32)
# dport workaround headers are in esp32 component
set(extra_priv_requires esp32)
else()
set(extra_priv_requires)
endif()
set(srcs
"src/lib_printf.c"
"src/mesh_event.c"
@ -57,8 +50,8 @@ idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include" "wifi_apps/include" "wifi_apps/nan_app/include" ${local_include_dirs}
REQUIRES esp_event esp_phy esp_netif
PRIV_REQUIRES driver esptool_py esp_pm esp_timer nvs_flash
wpa_supplicant hal lwip esp_coex ${extra_priv_requires}
PRIV_REQUIRES esptool_py esp_pm esp_timer nvs_flash
wpa_supplicant hal lwip esp_coex
PRIV_INCLUDE_DIRS ../wpa_supplicant/src/ ../wpa_supplicant/esp_supplicant/src/
wifi_apps/roaming_app/include
LDFRAGMENTS "${ldfragments}")

View File

@ -34,8 +34,6 @@ idf_component_register(SRCS ${srcs}
LDFRAGMENTS linker.lf
PRIV_REQUIRES esp_partition spi_flash bootloader_support mbedtls esp_rom soc esp_system
esp_driver_gpio
# [refactor-todo] esp_flash_internal.h -> spi_common_internal.h requires cleanup
driver
)
# make sure 'core_dump_init' object file is considered by the linker

View File

@ -35,5 +35,5 @@ idf_component_register(
INCLUDE_DIRS "${include}"
PRIV_INCLUDE_DIRS "${private_include}"
LDFRAGMENTS linker.lf
PRIV_REQUIRES esp_phy driver esp_timer esp_coex soc hal
PRIV_REQUIRES esp_phy esp_timer esp_coex soc hal esp_pm
)

View File

@ -54,5 +54,5 @@ endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
PRIV_REQUIRES protobuf-c mbedtls console esp_http_server driver
PRIV_REQUIRES protobuf-c mbedtls console esp_http_server esp_driver_uart
REQUIRES bt)

View File

@ -6,12 +6,12 @@ endif()
set(TOUCH_ELEMENT_COMPATIBLE_TARGETS "esp32s2" "esp32s3")
if(IDF_TARGET IN_LIST TOUCH_ELEMENT_COMPATIBLE_TARGETS)
if(${target} IN_LIST TOUCH_ELEMENT_COMPATIBLE_TARGETS)
idf_component_register(SRCS "touch_element.c"
"touch_button.c"
"touch_slider.c"
"touch_matrix.c"
INCLUDE_DIRS include
REQUIRES driver
REQUIRES driver # touch_element uses legacy "driver/touch_sensor.h"
PRIV_REQUIRES esp_timer)
endif()

View File

@ -1,3 +1,3 @@
idf_component_register(SRCS "misc.c" "scli.c"
INCLUDE_DIRS "."
PRIV_REQUIRES bt console driver)
PRIV_REQUIRES bt console esp_driver_uart)

View File

@ -1,4 +1,4 @@
idf_component_register(SRCS "cmd_system.c"
INCLUDE_DIRS "."
PRIV_REQUIRES driver
PRIV_REQUIRES esp_driver_uart esp_driver_gpio
REQUIRES console spi_flash)

View File

@ -29,7 +29,7 @@ endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include"
PRIV_REQUIRES esp_netif driver esp_wifi vfs console esp_eth)
PRIV_REQUIRES esp_netif esp_driver_gpio esp_driver_uart esp_wifi vfs console esp_eth)
if(CONFIG_EXAMPLE_PROVIDE_WIFI_CONSOLE_CMD)
idf_component_optional_requires(PRIVATE console)

View File

@ -1,4 +1,4 @@
idf_component_register(SRCS "soft_i2c_master.c"
INCLUDE_DIRS "include"
PRIV_REQUIRES driver
PRIV_REQUIRES esp_driver_gpio
LDFRAGMENTS linker.lf)

View File

@ -2,4 +2,4 @@ set(srcs "soft_i2c_master_main.c")
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "."
PRIV_REQUIRES driver soft_i2c_master)
PRIV_REQUIRES soft_i2c_master)

View File

@ -9,5 +9,5 @@ endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include"
PRIV_REQUIRES driver
PRIV_REQUIRES esp_driver_gpio
LDFRAGMENTS linker.lf)

View File

@ -15,5 +15,5 @@ endif()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "include"
PRIV_REQUIRES driver
PRIV_REQUIRES esp_driver_gpio
LDFRAGMENTS linker.lf)

View File

@ -2,4 +2,4 @@ set(srcs "soft_uart_main.c")
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "."
PRIV_REQUIRES driver soft_uart)
PRIV_REQUIRES soft_uart)

View File

@ -3,5 +3,5 @@ set(component_srcs "src/matrix_keyboard.c")
idf_component_register(SRCS "${component_srcs}"
INCLUDE_DIRS "include"
PRIV_INCLUDE_DIRS ""
PRIV_REQUIRES "driver"
PRIV_REQUIRES "esp_driver_gpio"
REQUIRES "")

View File

@ -1,3 +1,3 @@
idf_component_register(SRCS "i2c_eeprom.c"
INCLUDE_DIRS "."
PRIV_REQUIRES driver)
PRIV_REQUIRES esp_driver_i2c)

View File

@ -1,5 +1,5 @@
idf_component_register(
SRCS app_main.c svpwm/esp_svpwm.c foc/esp_foc.c
INCLUDE_DIRS "svpwm" "foc"
REQUIRES driver
PRIV_REQUIRES esp_driver_mcpwm esp_driver_gpio
)

View File

@ -1,4 +1,5 @@
idf_component_register(SRCS "spi_eeprom.c"
LDFRAGMENTS "linker.lf"
INCLUDE_DIRS "."
PRIV_REQUIRES driver)
PRIV_REQUIRES esp_driver_gpio
REQUIRES esp_driver_spi)

View File

@ -2,6 +2,5 @@
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# external SPI flash driver not currently supported for ESP32-S2
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(fatfs_ext_flash)

View File

@ -1,6 +1,6 @@
idf_component_register(SRCS "cmd_system.c" "cmd_system_common.c"
INCLUDE_DIRS .
REQUIRES console spi_flash driver esp_driver_gpio)
REQUIRES console spi_flash esp_driver_uart esp_driver_gpio)
if(CONFIG_SOC_DEEP_SLEEP_SUPPORTED OR CONFIG_SOC_LIGHT_SLEEP_SUPPORTED)
target_sources(${COMPONENT_LIB} PRIVATE cmd_system_sleep.c)

View File

@ -1,6 +1,6 @@
idf_component_register(SRCS "ulp_example_main.c"
INCLUDE_DIRS ""
REQUIRES driver soc nvs_flash ulp)
REQUIRES esp_driver_gpio soc nvs_flash ulp)
#
# ULP support additions to component CMakeLists.txt.
#

View File

@ -1,6 +1,6 @@
idf_component_register(SRCS "ulp_adc_example_main.c"
INCLUDE_DIRS ""
REQUIRES soc nvs_flash ulp driver esp_adc)
REQUIRES soc nvs_flash ulp esp_driver_gpio esp_adc)
#
# ULP support additions to component CMakeLists.txt.
#

View File

@ -1,7 +1,7 @@
# Set usual component variables
set(COMPONENT_SRCS "ulp_riscv_ds18b20_example_main.c")
set(COMPONENT_ADD_INCLUDEDIRS "")
set(COMPONENT_REQUIRES soc nvs_flash ulp driver)
set(COMPONENT_REQUIRES soc nvs_flash ulp esp_driver_gpio)
register_component()

View File

@ -1,7 +1,7 @@
# Set usual component variables
set(COMPONENT_SRCS "ulp_riscv_example_main.c")
set(COMPONENT_ADD_INCLUDEDIRS "")
set(COMPONENT_REQUIRES soc nvs_flash ulp driver)
set(COMPONENT_REQUIRES soc nvs_flash ulp esp_driver_gpio)
register_component()

View File

@ -1,7 +1,7 @@
# Set usual component variables
set(COMPONENT_SRCS "ulp_riscv_gpio_intr_example_main.c")
set(COMPONENT_ADD_INCLUDEDIRS "")
set(COMPONENT_REQUIRES ulp driver)
set(COMPONENT_REQUIRES ulp esp_driver_gpio)
register_component()

View File

@ -1,7 +1,7 @@
# Set usual component variables
set(COMPONENT_SRCS "ulp_riscv_example_main.c")
set(COMPONENT_ADD_INCLUDEDIRS "")
set(COMPONENT_REQUIRES soc nvs_flash ulp driver)
set(COMPONENT_REQUIRES soc nvs_flash ulp)
register_component()