global: add dependency on esp_timer component and include esp_timer.h

Some components were including esp_timer.h without declaring a
dependency on esp_timer component. This used to work due to a
transitive public dependency on esp_timer from freertos component.
Add explicit dependencies where needed.
Also some source files were using esp_timer functions without
including the header file. This used to work because esp_timer.h was
included from freertos port header file. This commit adds esp_timer.h
includes where needed.
This commit is contained in:
Ivan Grokhotkov
2022-04-16 11:32:22 +02:00
parent 1f0e27ca63
commit 708e99497b
40 changed files with 44 additions and 25 deletions

View File

@@ -51,6 +51,7 @@ idf_component_register(SRCS "${srcs}"
PRIV_INCLUDE_DIRS "${priv_include_dirs}" PRIV_INCLUDE_DIRS "${priv_include_dirs}"
# Requires "driver" for GPTimer in "SEGGER_SYSVIEW_Config_FreeRTOS.c" # Requires "driver" for GPTimer in "SEGGER_SYSVIEW_Config_FreeRTOS.c"
PRIV_REQUIRES soc driver PRIV_REQUIRES soc driver
REQUIRES esp_timer
LDFRAGMENTS linker.lf) LDFRAGMENTS linker.lf)
# disable --coverage for this component, as it is used as transport # disable --coverage for this component, as it is used as transport

View File

@@ -1,3 +1,4 @@
idf_component_register(SRC_DIRS . param_test touch_sensor_test adc_dma_test dac_dma_test idf_component_register(SRC_DIRS . param_test touch_sensor_test adc_dma_test dac_dma_test
PRIV_INCLUDE_DIRS include param_test/include touch_sensor_test/include PRIV_INCLUDE_DIRS include param_test/include touch_sensor_test/include
PRIV_REQUIRES cmock test_utils driver nvs_flash esp_serial_slave_link infrared_tools esp_adc_cal) PRIV_REQUIRES cmock test_utils driver nvs_flash esp_serial_slave_link
infrared_tools esp_adc_cal esp_timer)

View File

@@ -23,6 +23,7 @@
#include "soc/gpio_periph.h" #include "soc/gpio_periph.h"
#include "soc/io_mux_reg.h" #include "soc/io_mux_reg.h"
#include "esp_system.h" #include "esp_system.h"
#include "esp_timer.h"
#include "driver/ledc.h" #include "driver/ledc.h"
#include "hal/ledc_ll.h" #include "hal/ledc_ll.h"
#include "driver/gpio.h" #include "driver/gpio.h"

View File

@@ -10,6 +10,7 @@
#include "test_utils.h" #include "test_utils.h"
#include "param_test.h" #include "param_test.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_timer.h"
#include "driver/spi_common.h" #include "driver/spi_common.h"
#include "soc/soc_caps.h" #include "soc/soc_caps.h"
#include "ccomp_timer.h" #include "ccomp_timer.h"

View File

@@ -14,5 +14,5 @@ set(src_dirs "." "${dir}")
idf_component_register(SRC_DIRS "${src_dirs}" idf_component_register(SRC_DIRS "${src_dirs}"
PRIV_INCLUDE_DIRS "." "${dir}/include" "../private_include" "../${target}/private_include" PRIV_INCLUDE_DIRS "." "${dir}/include" "../private_include" "../${target}/private_include"
PRIV_REQUIRES cmock test_utils efuse bootloader_support PRIV_REQUIRES cmock test_utils efuse bootloader_support esp_timer
) )

View File

@@ -15,6 +15,7 @@
#include "esp_efuse_table.h" #include "esp_efuse_table.h"
#include "esp_efuse_utility.h" #include "esp_efuse_utility.h"
#include "esp_efuse_test_table.h" #include "esp_efuse_test_table.h"
#include "esp_timer.h"
#include "bootloader_random.h" #include "bootloader_random.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"

View File

@@ -1,3 +1,3 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS . ../private_include PRIV_INCLUDE_DIRS . ../private_include
PRIV_REQUIRES cmock test_utils esp_event driver) PRIV_REQUIRES cmock test_utils esp_event driver esp_timer)

View File

@@ -21,7 +21,7 @@ if(NOT BOOTLOADER_BUILD)
endif() endif()
# [refactor-todo]: requires "driver" for GPIO and RTC (by sleep_gpio and sleep_modes) # [refactor-todo]: requires "driver" for GPIO and RTC (by sleep_gpio and sleep_modes)
list(APPEND priv_requires driver) list(APPEND priv_requires driver esp_timer)
if(CONFIG_IDF_TARGET_ESP32 OR CONFIG_IDF_TARGET_ESP32S2) if(CONFIG_IDF_TARGET_ESP32 OR CONFIG_IDF_TARGET_ESP32S2)
list(APPEND srcs "rtc_wdt.c") list(APPEND srcs "rtc_wdt.c")

View File

@@ -1,5 +1,5 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "${include_dirs}" PRIV_INCLUDE_DIRS "${include_dirs}"
PRIV_REQUIRES cmock test_utils esp_hw_support driver efuse) PRIV_REQUIRES cmock test_utils esp_hw_support driver efuse esp_timer)
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5") target_link_libraries(${COMPONENT_LIB} INTERFACE "-u ld_include_test_dport_xt_highint5")

View File

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

View File

@@ -18,6 +18,7 @@
#include "nvs.h" #include "nvs.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "esp_efuse.h" #include "esp_efuse.h"
#include "esp_timer.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h" #include "freertos/portmacro.h"

View File

@@ -1,4 +1,4 @@
idf_component_register(SRCS "pm_locks.c" "pm_trace.c" "pm_impl.c" idf_component_register(SRCS "pm_locks.c" "pm_trace.c" "pm_impl.c"
INCLUDE_DIRS include INCLUDE_DIRS include
PRIV_REQUIRES esp_system driver PRIV_REQUIRES esp_system driver esp_timer
LDFRAGMENTS linker.lf) LDFRAGMENTS linker.lf)

View File

@@ -1,2 +1,2 @@
idf_component_register(SRC_DIRS . idf_component_register(SRC_DIRS .
PRIV_REQUIRES unity esp_pm ulp driver) PRIV_REQUIRES unity esp_pm ulp driver esp_timer)

View File

@@ -6,6 +6,7 @@
#include "unity.h" #include "unity.h"
#include "esp_pm.h" #include "esp_pm.h"
#include "esp_sleep.h" #include "esp_sleep.h"
#include "esp_timer.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"

View File

@@ -36,7 +36,7 @@ else()
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS include INCLUDE_DIRS include
PRIV_REQUIRES spi_flash PRIV_REQUIRES spi_flash esp_timer
# [refactor-todo] requirements due to init code, # [refactor-todo] requirements due to init code,
# should be removable once using component init functions # should be removable once using component init functions
# link-time registration is used. # link-time registration is used.

View File

@@ -1,6 +1,7 @@
set(requires "unity" set(requires "unity"
"test_utils" "test_utils"
"driver") "driver"
"esp_timer")
set(excludes "test_ipc_isr.c" set(excludes "test_ipc_isr.c"
"test_ipc_isr.S" "test_ipc_isr.S"

View File

@@ -1,3 +1,3 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "../private_include" PRIV_INCLUDE_DIRS "../private_include"
PRIV_REQUIRES cmock test_utils) PRIV_REQUIRES cmock test_utils esp_timer)

View File

@@ -16,7 +16,6 @@
#include "freertos/queue.h" #include "freertos/queue.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "freertos/event_groups.h" #include "freertos/event_groups.h"
#include "freertos/xtensa_api.h"
#include "freertos/portmacro.h" #include "freertos/portmacro.h"
#include "freertos/xtensa_api.h" #include "freertos/xtensa_api.h"
#include "esp_types.h" #include "esp_types.h"
@@ -28,6 +27,7 @@
#include "esp_log.h" #include "esp_log.h"
#include "esp_event.h" #include "esp_event.h"
#include "esp_heap_caps.h" #include "esp_heap_caps.h"
#include "esp_timer.h"
#include "esp_private/wifi_os_adapter.h" #include "esp_private/wifi_os_adapter.h"
#include "esp_private/wifi.h" #include "esp_private/wifi.h"
#include "esp_phy_init.h" #include "esp_phy_init.h"
@@ -42,7 +42,6 @@
#include "esp_coexist_internal.h" #include "esp_coexist_internal.h"
#include "esp_coexist_adapter.h" #include "esp_coexist_adapter.h"
#include "esp32/dport_access.h" #include "esp32/dport_access.h"
#include "esp_timer.h"
#include "esp_rom_sys.h" #include "esp_rom_sys.h"
#include "esp32/rom/ets_sys.h" #include "esp32/rom/ets_sys.h"

View File

@@ -16,7 +16,6 @@
#include "freertos/queue.h" #include "freertos/queue.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "freertos/event_groups.h" #include "freertos/event_groups.h"
#include "freertos/xtensa_api.h"
#include "freertos/portmacro.h" #include "freertos/portmacro.h"
#include "freertos/xtensa_api.h" #include "freertos/xtensa_api.h"
#include "esp_types.h" #include "esp_types.h"
@@ -28,6 +27,7 @@
#include "esp_log.h" #include "esp_log.h"
#include "esp_event.h" #include "esp_event.h"
#include "esp_heap_caps.h" #include "esp_heap_caps.h"
#include "esp_timer.h"
#include "esp_private/wifi_os_adapter.h" #include "esp_private/wifi_os_adapter.h"
#include "esp_private/wifi.h" #include "esp_private/wifi.h"
#include "esp_phy_init.h" #include "esp_phy_init.h"

View File

@@ -7,4 +7,4 @@ idf_component_register(SRC_DIRS integration/event_groups
performance performance
port port
PRIV_INCLUDE_DIRS . PRIV_INCLUDE_DIRS .
PRIV_REQUIRES cmock test_utils esp_system driver) PRIV_REQUIRES cmock test_utils esp_system driver esp_timer)

View File

@@ -21,6 +21,7 @@
#endif #endif
#include "esp_freertos_hooks.h" #include "esp_freertos_hooks.h"
#include "esp_rom_sys.h" #include "esp_rom_sys.h"
#include "esp_timer.h"
/* Counter task counts a target variable forever */ /* Counter task counts a target variable forever */
static void task_count(void *vp_counter) static void task_count(void *vp_counter)

View File

@@ -7,7 +7,7 @@ set(TEST_CRTS "crts/server_cert_chain.pem"
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "." PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES cmock test_utils mbedtls PRIV_REQUIRES cmock test_utils mbedtls esp_timer
EMBED_TXTFILES ${TEST_CRTS}) EMBED_TXTFILES ${TEST_CRTS})

View File

@@ -1,3 +1,3 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "." PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES cmock test_utils driver) PRIV_REQUIRES cmock test_utils driver esp_timer)

View File

@@ -5,4 +5,4 @@ set(sources "test_pthread.c"
"test_pthread_rwlock.c") "test_pthread_rwlock.c")
idf_component_register(SRCS ${sources} idf_component_register(SRCS ${sources}
PRIV_REQUIRES cmock test_utils pthread) PRIV_REQUIRES cmock test_utils pthread esp_timer)

View File

@@ -5,4 +5,5 @@ endif()
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
EXCLUDE_SRCS "${exclude_srcs}" EXCLUDE_SRCS "${exclude_srcs}"
PRIV_INCLUDE_DIRS "." PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES cmock test_utils spi_flash bootloader_support app_update driver) PRIV_REQUIRES cmock test_utils spi_flash bootloader_support app_update
driver esp_timer)

View File

@@ -4,5 +4,6 @@ if(IDF_TARGET STREQUAL "esp32s2")
"touch_slider.c" "touch_slider.c"
"touch_matrix.c" "touch_matrix.c"
INCLUDE_DIRS include INCLUDE_DIRS include
REQUIRES driver) REQUIRES driver
PRIV_REQUIRES esp_timer)
endif() endif()

View File

@@ -12,7 +12,6 @@
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "esp_heap_caps.h" #include "esp_heap_caps.h"
#include "esp_intr_alloc.h" #include "esp_intr_alloc.h"
#include "esp_timer.h"
#include "esp_err.h" #include "esp_err.h"
#include "esp_rom_gpio.h" #include "esp_rom_gpio.h"
#include "hal/usbh_hal.h" #include "hal/usbh_hal.h"

View File

@@ -5,7 +5,7 @@ idf_component_register(SRCS "vfs.c"
"vfs_console.c" "vfs_console.c"
INCLUDE_DIRS include INCLUDE_DIRS include
PRIV_INCLUDE_DIRS private_include PRIV_INCLUDE_DIRS private_include
PRIV_REQUIRES driver) PRIV_REQUIRES driver esp_timer)
if(CONFIG_ESP_CONSOLE_USB_CDC) if(CONFIG_ESP_CONSOLE_USB_CDC)
target_sources(${COMPONENT_LIB} PRIVATE "vfs_cdcacm.c") target_sources(${COMPONENT_LIB} PRIVATE "vfs_cdcacm.c")

View File

@@ -12,6 +12,7 @@
#include "drivers/driver.h" #include "drivers/driver.h"
#include "common/ieee802_11_defs.h" #include "common/ieee802_11_defs.h"
#include "esp_timer.h"
/* /*
* struct rrm_data - Data used for managing RRM features * struct rrm_data - Data used for managing RRM features
*/ */

View File

@@ -8,6 +8,7 @@
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/queue.h" #include "freertos/queue.h"
#include "freertos/FreeRTOSConfig.h" #include "freertos/FreeRTOSConfig.h"
#include "esp_timer.h"
#include "esp_ble_mesh_networking_api.h" #include "esp_ble_mesh_networking_api.h"
#include "ble_mesh_adapter.h" #include "ble_mesh_adapter.h"

View File

@@ -5,6 +5,7 @@
*/ */
#include "esp_bt.h" #include "esp_bt.h"
#include "esp_timer.h"
#include "soc/soc.h" #include "soc/soc.h"
#include "test.h" #include "test.h"

View File

@@ -13,6 +13,7 @@
#include "esp_log.h" #include "esp_log.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "esp_bt.h" #include "esp_bt.h"
#include "esp_timer.h"
#include "esp_ble_mesh_defs.h" #include "esp_ble_mesh_defs.h"
#include "esp_ble_mesh_common_api.h" #include "esp_ble_mesh_common_api.h"

View File

@@ -1,3 +1,3 @@
idf_component_register(SRCS "button.c" "button_obj.cpp" idf_component_register(SRCS "button.c" "button_obj.cpp"
INCLUDE_DIRS "." "include" INCLUDE_DIRS "." "include"
PRIV_REQUIRES driver) PRIV_REQUIRES driver esp_timer)

View File

@@ -11,6 +11,7 @@
#include "freertos/task.h" #include "freertos/task.h"
#include "esp_bt.h" #include "esp_bt.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_timer.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "freertos/queue.h" #include "freertos/queue.h"
#include "bt_hci_common.h" #include "bt_hci_common.h"

View File

@@ -1,3 +1,4 @@
idf_component_register(SRCS "iperf.c" idf_component_register(SRCS "iperf.c"
INCLUDE_DIRS "include" INCLUDE_DIRS "include"
REQUIRES lwip) REQUIRES lwip
PRIV_REQUIRES esp_timer)

View File

@@ -24,6 +24,7 @@
#include "esp_event.h" #include "esp_event.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_system.h" #include "esp_system.h"
#include "esp_timer.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "nvs.h" #include "nvs.h"
#include "protocol_examples_common.h" #include "protocol_examples_common.h"

View File

@@ -16,6 +16,7 @@
#include "esp_vfs.h" #include "esp_vfs.h"
#include "esp_vfs_dev.h" #include "esp_vfs_dev.h"
#include "esp_vfs_eventfd.h" #include "esp_vfs_eventfd.h"
#include "esp_timer.h"
#include "driver/gptimer.h" #include "driver/gptimer.h"
#define TIMER_RESOLUTION 1000000 // 1MHz, 1 tick = 1us #define TIMER_RESOLUTION 1000000 // 1MHz, 1 tick = 1us

View File

@@ -14,6 +14,7 @@
#include "driver/uart.h" #include "driver/uart.h"
#include "esp_sleep.h" #include "esp_sleep.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_timer.h"
#include "light_sleep_example.h" #include "light_sleep_example.h"
static void light_sleep_task(void *args) static void light_sleep_task(void *args)

View File

@@ -12,6 +12,7 @@
#include "freertos/task.h" #include "freertos/task.h"
#include "esp_system.h" #include "esp_system.h"
#include "esp_spi_flash.h" #include "esp_spi_flash.h"
#include "esp_timer.h"
#include <esp_task.h> #include <esp_task.h>
#include <setjmp.h> #include <setjmp.h>

View File

@@ -1,3 +1,3 @@
idf_component_register(SRC_DIRS "." idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "." PRIV_INCLUDE_DIRS "."
PRIV_REQUIRES cmock test_utils perfmon) PRIV_REQUIRES cmock test_utils perfmon esp_timer)