2019-08-08 15:33:45 +10:00
|
|
|
if(BOOTLOADER_BUILD)
|
|
|
|
# bootloader only needs FreeRTOS for config, not for anything else
|
|
|
|
idf_component_register()
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2020-11-06 15:03:21 +11:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
|
2021-08-04 20:33:44 +08:00
|
|
|
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
|
2020-11-06 15:03:21 +11:00
|
|
|
set(srcs
|
2021-09-20 11:37:03 +05:30
|
|
|
"FreeRTOS-Kernel/portable/xtensa/port.c"
|
|
|
|
"FreeRTOS-Kernel/portable/xtensa/portasm.S"
|
|
|
|
"FreeRTOS-Kernel/portable/xtensa/xtensa_context.S"
|
|
|
|
"FreeRTOS-Kernel/portable/xtensa/xtensa_init.c"
|
|
|
|
"FreeRTOS-Kernel/portable/xtensa/xtensa_overlay_os_hook.c"
|
|
|
|
"FreeRTOS-Kernel/portable/xtensa/xtensa_vector_defaults.S"
|
|
|
|
"FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S")
|
2020-11-06 15:03:21 +11:00
|
|
|
|
|
|
|
set(include_dirs
|
2021-09-20 11:37:03 +05:30
|
|
|
FreeRTOS-Kernel/include
|
|
|
|
esp_additions/include/freertos # For files with #include "FreeRTOSConfig.h"
|
|
|
|
FreeRTOS-Kernel/portable/xtensa/include # For arch-specific FreeRTOSConfig_arch.h in portable/<arch>/include
|
|
|
|
esp_additions/include) # For files with #include "freertos/FreeRTOSConfig.h"
|
2020-11-06 15:03:21 +11:00
|
|
|
|
|
|
|
set(private_include_dirs
|
2021-09-20 11:37:03 +05:30
|
|
|
FreeRTOS-Kernel/portable/xtensa/include/freertos
|
|
|
|
FreeRTOS-Kernel/portable/xtensa
|
|
|
|
FreeRTOS-Kernel/portable/priv_include
|
2020-11-06 15:03:21 +11:00
|
|
|
.)
|
|
|
|
|
2021-08-04 20:33:44 +08:00
|
|
|
elseif(CONFIG_IDF_TARGET_ARCH_RISCV)
|
2020-11-06 15:03:21 +11:00
|
|
|
set(srcs
|
2021-09-20 11:37:03 +05:30
|
|
|
"FreeRTOS-Kernel/portable/riscv/port.c"
|
|
|
|
"FreeRTOS-Kernel/portable/riscv/portasm.S")
|
2020-11-06 15:03:21 +11:00
|
|
|
|
|
|
|
set(include_dirs
|
2021-09-20 11:37:03 +05:30
|
|
|
FreeRTOS-Kernel/include
|
|
|
|
esp_additions/include/freertos # For files with #include "FreeRTOSConfig.h"
|
|
|
|
FreeRTOS-Kernel/portable/riscv/include # For arch-specific FreeRTOSConfig_arch.h in portable/<arch>/include
|
|
|
|
esp_additions/include) # For files with #include "freertos/FreeRTOSConfig.h"
|
2020-11-06 15:03:21 +11:00
|
|
|
|
|
|
|
set(private_include_dirs
|
2021-09-20 11:37:03 +05:30
|
|
|
FreeRTOS-Kernel/portable/riscv/include/freertos
|
|
|
|
FreeRTOS-Kernel/portable/riscv
|
|
|
|
FreeRTOS-Kernel/portable/priv_include
|
2020-11-06 15:03:21 +11:00
|
|
|
.)
|
|
|
|
|
|
|
|
endif()
|
2020-01-17 11:44:13 -03:00
|
|
|
|
2020-11-10 18:40:01 +11:00
|
|
|
list(APPEND srcs
|
2021-08-04 10:56:37 +08:00
|
|
|
"esp_additions/task_snapshot.c"
|
2021-09-20 11:37:03 +05:30
|
|
|
"FreeRTOS-Kernel/portable/port_common.c"
|
|
|
|
"FreeRTOS-Kernel/portable/port_systick.c"
|
|
|
|
"FreeRTOS-Kernel/croutine.c"
|
|
|
|
"FreeRTOS-Kernel/event_groups.c"
|
|
|
|
"FreeRTOS-Kernel/list.c"
|
|
|
|
"FreeRTOS-Kernel/queue.c"
|
|
|
|
"FreeRTOS-Kernel/tasks.c"
|
|
|
|
"FreeRTOS-Kernel/timers.c"
|
|
|
|
"FreeRTOS-Kernel/stream_buffer.c"
|
2020-11-09 15:38:29 +05:30
|
|
|
"FreeRTOS-openocd.c"
|
2021-09-20 11:37:03 +05:30
|
|
|
"esp_additions/freertos_v8_compat.c")
|
2020-01-17 11:44:13 -03:00
|
|
|
|
2021-08-04 10:56:37 +08:00
|
|
|
list(APPEND private_include_dirs
|
2021-09-20 11:37:03 +05:30
|
|
|
"FreeRTOS-Kernel/include/freertos")
|
2021-08-04 10:56:37 +08:00
|
|
|
|
2020-02-26 20:21:59 +08:00
|
|
|
if(CONFIG_ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY)
|
2021-09-20 11:37:03 +05:30
|
|
|
list(APPEND srcs "FreeRTOS-Kernel/portable/xtensa/xtensa_loadstore_handler.S")
|
2020-11-06 15:03:21 +11:00
|
|
|
endif()
|
2020-02-26 20:21:59 +08:00
|
|
|
|
2021-12-13 10:52:22 +01:00
|
|
|
# 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)
|
2021-08-04 20:33:44 +08:00
|
|
|
|
2019-04-28 15:38:23 +08:00
|
|
|
idf_component_register(SRCS "${srcs}"
|
2020-01-17 11:44:13 -03:00
|
|
|
INCLUDE_DIRS ${include_dirs}
|
2020-11-10 18:40:01 +11:00
|
|
|
PRIV_INCLUDE_DIRS ${private_include_dirs}
|
2019-04-28 15:38:23 +08:00
|
|
|
LDFRAGMENTS linker.lf
|
2020-11-06 15:03:21 +11:00
|
|
|
REQUIRES ${required_components}
|
2021-03-19 20:03:13 +08:00
|
|
|
PRIV_REQUIRES soc esp_pm)
|
2020-11-10 18:40:01 +11:00
|
|
|
|
2019-12-02 07:41:33 +01:00
|
|
|
idf_component_get_property(COMPONENT_DIR freertos COMPONENT_DIR)
|
|
|
|
idf_component_set_property(freertos ORIG_INCLUDE_PATH "${COMPONENT_DIR}/include/freertos/")
|
2018-01-12 13:49:13 +11:00
|
|
|
|
2019-10-16 14:23:05 +02:00
|
|
|
if(CONFIG_FREERTOS_DEBUG_OCDAWARE)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--undefined=uxTopUsedPriority")
|
|
|
|
endif()
|
2018-08-16 15:01:43 +10:00
|
|
|
|
|
|
|
set_source_files_properties(
|
|
|
|
tasks.c
|
|
|
|
event_groups.c
|
|
|
|
timers.c
|
|
|
|
queue.c
|
2019-11-28 15:27:47 -03:00
|
|
|
stream_buffer.c
|
2018-08-16 15:01:43 +10:00
|
|
|
PROPERTIES COMPILE_DEFINITIONS
|
|
|
|
_ESP_FREERTOS_INTERNAL
|
|
|
|
)
|
2020-02-05 22:40:15 +08:00
|
|
|
|
2020-11-10 18:40:01 +11:00
|
|
|
# The freertos component provides the `start_app` and `start_app_other_cores`
|
|
|
|
# if it is included in the build. It then calls `app_main`
|
|
|
|
# from the main task created, which must be provided by the user.
|
2020-06-10 21:13:31 +08:00
|
|
|
# Like for `start_app` and `start_app_other_cores`,
|
|
|
|
# we can't establish dependency on what we don't yet know, so we force the
|
|
|
|
# linker to not drop this symbol.
|
2020-11-10 18:40:01 +11:00
|
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u app_main")
|
2021-12-13 10:52:22 +01:00
|
|
|
|
|
|
|
if(CONFIG_APPTRACE_SV_ENABLE)
|
|
|
|
# FreeRTOS headers have a dependency on app_trace when SystemView tracing is enabled
|
|
|
|
idf_component_optional_requires(PUBLIC app_trace)
|
|
|
|
elseif(CONFIG_APPTRACE_ENABLE)
|
|
|
|
# [refactor-todo]: port.c has a dependency on esp_apptrace_init, for running it on APP CPU.
|
|
|
|
# this should be resolved when link-time registration of startup functions is added.
|
|
|
|
idf_component_optional_requires(PRIVATE app_trace)
|
|
|
|
endif()
|