esp_timer: only add as a public dependency to FreeRTOS if necessary

esp_timer will be added as a dependency to freertos only if
CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER is enabled.
Other components are updated to add esp_timer as public or private
dependency, as needed.
This removes esp_timer from the default list of public dependencies.
This commit is contained in:
Ivan Grokhotkov 2022-04-16 08:34:22 +02:00
parent 708e99497b
commit b0544b9745
No known key found for this signature in database
GPG Key ID: 1E050E141B280628
4 changed files with 21 additions and 10 deletions

View File

@ -113,17 +113,10 @@ else()
endif()
endif()
# esp_timer is required by FreeRTOS when we use esp_timer_get_time() to do profiling
# [refactor-todo]: make this an optional requirement depending on CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
# Note, many other components implicitly include esp_timer.h via freertos portmacro.h and some
# components implicitly depend on esp_timer via freertos.
set(required_components esp_timer)
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS ${include_dirs}
PRIV_INCLUDE_DIRS ${private_include_dirs}
LDFRAGMENTS linker.lf
REQUIRES ${required_components}
PRIV_REQUIRES soc esp_pm)
idf_component_get_property(COMPONENT_DIR freertos COMPONENT_DIR)
@ -166,3 +159,9 @@ if(CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME)
# [refactor-todo]: port.c esp_startup_start_app_common() calls esp_gdbstub_init()
idf_component_optional_requires(PRIVATE esp_gdbstub)
endif()
if(CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER)
# [refactor-todo]: esp_timer is required by FreeRTOS when we use esp_timer_get_time() to do profiling
# Introduce a port wrapper function to avoid including esp_timer.h into the public header
idf_component_optional_requires(PUBLIC esp_timer)
endif()

View File

@ -382,7 +382,6 @@ portmacro.h. Therefore, we need to keep these headers around for now to allow th
#include <stdarg.h>
#include <xtensa/hal.h>
#include "esp_attr.h"
#include "esp_timer.h"
#include "esp_newlib.h"
#include "esp_heap_caps.h"
#include "esp_rom_sys.h"
@ -392,6 +391,11 @@ portmacro.h. Therefore, we need to keep these headers around for now to allow th
#include <xtensa/config/system.h>
#include <xtensa/xtensa_api.h>
/* [refactor-todo] introduce a port wrapper function to avoid including esp_timer.h into the public header */
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
#include "esp_timer.h"
#endif
#ifdef __cplusplus
}
#endif

View File

@ -47,7 +47,6 @@
#include "esp_macros.h"
#include "esp_attr.h"
#include "esp_rom_sys.h"
#include "esp_timer.h" /* required for FreeRTOS run time stats */
#include "esp_heap_caps.h"
#include "esp_system.h" /* required by esp_get_...() functions in portable.h. [refactor-todo] Update portable.h */
#include "esp_newlib.h"
@ -55,6 +54,11 @@
/* [refactor-todo] These includes are not directly used in this file. They are kept into to prevent a breaking change. Remove these. */
#include <limits.h>
/* [refactor-todo] introduce a port wrapper function to avoid including esp_timer.h into the public header */
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
#include "esp_timer.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -76,7 +76,6 @@
#include "esp_private/crosscore_int.h"
#include "esp_macros.h"
#include "esp_attr.h"
#include "esp_timer.h" /* required for esp_timer_get_time. [refactor-todo] make this common between archs */
#include "esp_newlib.h" /* required for esp_reent_init() in tasks.c */
#include "esp_heap_caps.h"
#include "esp_rom_sys.h"
@ -88,6 +87,11 @@
#include <xtensa/config/system.h>
#include <xtensa/xtensa_api.h>
/* [refactor-todo] introduce a port wrapper function to avoid including esp_timer.h into the public header */
#if CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER
#include "esp_timer.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif