Integrating and compiling FreeRTOS and AWS inside ESP-IDF

pablomartinez
Posts: 5
Joined: Thu Jul 29, 2021 7:57 am

Integrating and compiling FreeRTOS and AWS inside ESP-IDF

Postby pablomartinez » Thu Jul 29, 2021 8:23 am

Hi,

I am trying to generate a new project using amazon-freertos project for a ESP32 wroom device. I am able to compile an external project using this kind of CMakeLists.txt

Code: Select all

cmake_minimum_required(VERSION 3.13)

set(esp_idf_dir "$ENV{AMAZON_FREERTOS_DIR}/vendors/espressif/esp-idf")
include(${esp_idf_dir}/tools/cmake/idf.cmake)

project(esp32test)

# Tell IDF build to link against this target.
set(IDF_PROJECT_EXECUTABLE esp32test)

get_filename_component(
     IDF_EXECUTABLE_SRCS
     "src/main.c"     
     ABSOLUTE
     ) 
  
# Add some extra components. IDF_EXTRA_COMPONENT_DIRS is an variable used by ESP-IDF
# to collect extra components.
get_filename_component(
    UART_COMPONENT_DIR
    "components/uart" ABSOLUTE
)
idf_build_component(${UART_COMPONENT_DIR})

list(APPEND IDF_EXTRA_COMPONENT_DIRS ${UART_COMPONENT_DIR})

include_directories(BEFORE include/freertos-configs)

# Add freertos as an subdirectory. AFR_BOARD tells which board to target.
set(AFR_BOARD espressif.esp32_devkitc CACHE INTERNAL "")
add_subdirectory($ENV{AMAZON_FREERTOS_DIR} build)

# Link against the mqtt demo so that we can use it. Dependencies of this demo are transitively
# linked.
target_link_libraries(
    esp32test
    PRIVATE
    idf::uart

The point is, that I feel quite constrained doing it in this way, since I didn't achieve to add source files directly and I have to include them inside IDF extra components.

I was trying to generate the project like in the esp-idf examples:

Code: Select all

cmake_minimum_required(VERSION 3.13)

if(NOT DEFINED ENV{AMAZON_FREERTOS_DIR})
    message(FATAL_ERROR "Error: need to define AMAZON_FREERTOS_DIR")
endif()

set(esp_idf_dir "$ENV{AMAZON_FREERTOS_DIR}/vendors/espressif/esp-idf")

include(${esp_idf_dir}/tools/cmake/project.cmake)

project(universalDummy)
But I get the following error when I run cmake:
cmake -B build -DCMAKE_TOOLCHAIN_FILE={path-to-project}amazon-freertos/tools/cmake/toolchains/xtensa-esp32.cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DAFR_ENABLE_ALL_MODULES=1 -GNinja

Code: Select all

CMake Error at /home/cecotec/Projects/matrix/sources/amazon-freertos/vendors/espressif/esp-idf/tools/cmake/build.cmake:186 (message):
  Failed to resolve component 'freertos'.


Anyone could give some advice, how to compile using "include(${esp_idf_dir}/tools/cmake/project.cmake)" and the esp-idf project structure?

Many thanks in advance!

Who is online

Users browsing this forum: nathan_swidget and 145 guests