Unable to build the project when using FreeRTOS in own Cmake project for ESP32

I was successfully able to build and run the AWS demos (MQTT, OTA, BLE) but unable to build the custom project example using Freertos for both methods (with components and without components). The complete details are mentioned below. I would like to know how to resolve this issue or what could be wrong. If further information is required, please let me know.

Target microcontroller: vendor: Espressif

board: ESP32-DevKitC

Host platform: OS: Ubuntu 18.04.5 LTS

Toolchain: xtensa-esp32

Toolchain path: /home/user/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf

CMake generator: Ninja

AWS Freertos version: 202107.00

Followed the steps as mentioned in the AWS User guide

Method 1:

For project directory structure

  • freertos (the copy that you obtained from GitHub or the AWS IoT console)

  • src - > main.c (application code)

  • CMakeLists.txt

After executing the command: cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=freertos/tools/cmake/toolchains/xtensa-esp32.cmake -GNinja

The error obtained is as below

-- The C compiler identification is GNU 5.2.0 

-- The CXX compiler identification is GNU 5.2.0 

-- The ASM compiler identification is GNU 

-- Found assembler: /home/augmented/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc 

-- Found Git: /usr/bin/git (found version "2.17.1")  

CMake Warning at freertos/vendors/espressif/esp-idf/tools/cmake/idf.cmake:24 (message): 

  IDF_PATH environment variable not found.  Setting IDF_PATH to 

  '/home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf'. 

Call Stack (most recent call first): 

  freertos/vendors/espressif/boards/esp32/CMakeLists.txt:38 (include) 

  freertos/CMakeLists.txt:70 (include) 

  

  

-- Component directory /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/components/mbedtls does not contain a CMakeLists.txt file. No component will be added 

-- Component directory /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/components/unity does not contain a CMakeLists.txt file. No component will be added 

CMake Error at build/freertos/CMakeFiles/git-data/grabRef.cmake:48 (file): 

  file failed to open for reading (No such file or directory): 

  

    /home/augmented/aws_ota/aws_support/build/freertos/CMakeFiles/git-data/head-ref 

Call Stack (most recent call first): 

  freertos/vendors/espressif/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include) 

  freertos/vendors/espressif/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision) 

  freertos/vendors/espressif/esp-idf/tools/cmake/build.cmake:68 (git_describe) 

  freertos/vendors/espressif/esp-idf/tools/cmake/build.cmake:160 (__build_get_idf_git_revision) 

  freertos/vendors/espressif/esp-idf/tools/cmake/idf.cmake:49 (__build_init) 

  freertos/vendors/espressif/boards/esp32/CMakeLists.txt:38 (include) 

  freertos/CMakeLists.txt:70 (include) 

  

  

CMake Error at freertos/vendors/espressif/boards/esp32/CMakeLists.txt:477 (add_executable): 

  add_executable cannot create target "my_app" because another target with 

  the same name already exists.  The existing target is an executable created 

  in source directory "/home/augmented/aws_ota/aws_support".  See 

  documentation for policy CMP0002 for more details. 

Call Stack (most recent call first): 

  freertos/CMakeLists.txt:70 (include) 

  

  

-- Checking Python dependencies... 

Python requirements from /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/requirements.txt are satisfied. 

-- Project sdkconfig file /home/augmented/aws_ota/aws_support/build/sdkconfig 

Loading defaults file /home/augmented/aws_ota/aws_support/build/sdkconfig.defaults... 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:21 CONFIG_NIMBLE_ENABLED was replaced with CONFIG_BT_NIMBLE_ENABLED 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:22 CONFIG_NIMBLE_MAX_CONNECTIONS was replaced with CONFIG_BT_NIMBLE_MAX_CONNECTIONS 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:23 CONFIG_NIMBLE_MAX_BONDS was replaced with CONFIG_BT_NIMBLE_MAX_BONDS 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:24 CONFIG_NIMBLE_MAX_CCCDS was replaced with CONFIG_BT_NIMBLE_MAX_CCCDS 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:25 CONFIG_NIMBLE_L2CAP_COC_MAX_NUM was replaced with CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:26 CONFIG_NIMBLE_PINNED_TO_CORE was replaced with CONFIG_BT_NIMBLE_PINNED_TO_CORE 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:27 CONFIG_NIMBLE_ROLE_CENTRAL was replaced with CONFIG_BT_NIMBLE_ROLE_CENTRAL 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:28 CONFIG_NIMBLE_ROLE_PERIPHERAL was replaced with CONFIG_BT_NIMBLE_ROLE_PERIPHERAL 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:29 CONFIG_NIMBLE_ROLE_BROADCASTER was replaced with CONFIG_BT_NIMBLE_ROLE_BROADCASTER 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:30 CONFIG_NIMBLE_ROLE_OBSERVER was replaced with CONFIG_BT_NIMBLE_ROLE_OBSERVER 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:31 CONFIG_NIMBLE_NVS_PERSIST was replaced with CONFIG_BT_NIMBLE_NVS_PERSIST 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:32 CONFIG_NIMBLE_SM_LEGACY was replaced with CONFIG_BT_NIMBLE_SM_LEGACY 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:33 CONFIG_NIMBLE_SM_SC was replaced with CONFIG_BT_NIMBLE_SM_SC 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:34 CONFIG_NIMBLE_DEBUG was replaced with CONFIG_BT_NIMBLE_DEBUG 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:35 CONFIG_NIMBLE_SVC_GAP_DEVICE_NAME was replaced with CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:36 CONFIG_NIMBLE_GAP_DEVICE_NAME_MAX_LEN was replaced with CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:37 CONFIG_NIMBLE_ATT_PREFERRED_MTU was replaced with CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:38 CONFIG_NIMBLE_SVC_GAP_APPEARANCE was replaced with CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:39 CONFIG_NIMBLE_ACL_BUF_COUNT was replaced with CONFIG_BT_NIMBLE_ACL_BUF_COUNT 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:40 CONFIG_NIMBLE_ACL_BUF_SIZE was replaced with CONFIG_BT_NIMBLE_ACL_BUF_SIZE 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:41 CONFIG_NIMBLE_HCI_EVT_BUF_SIZE was replaced with CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:42 CONFIG_NIMBLE_HCI_EVT_HI_BUF_COUNT was replaced with CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:43 CONFIG_NIMBLE_HCI_EVT_LO_BUF_COUNT was replaced with CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT 

/home/augmented/aws_ota/aws_support/build/sdkconfig.defaults:44 CONFIG_NIMBLE_MESH was replaced with CONFIG_BT_NIMBLE_MESH 

/tmp/confgen_tmpnz5054sg:20 line was updated to CONFIG_BT_BLUEDROID_ENABLED=n 

/tmp/confgen_tmpnz5054sg:34 line was updated to CONFIG_BT_NIMBLE_DEBUG=n 

/tmp/confgen_tmpnz5054sg:44 line was updated to CONFIG_BT_NIMBLE_MESH=n 

CMake Warning at freertos/vendors/espressif/esp-idf/tools/cmake/crosstool_version_check.cmake:8 (message): 

  Xtensa toolchain 

  /home/augmented/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc version 5.2.0 

  is not the supported version 8.4.0.  Check Getting Started documentation or 

  proceed at own risk. 

Call Stack (most recent call first): 

  freertos/vendors/espressif/esp-idf/components/esp32/project_include.cmake:30 (gcc_version_check) 

  freertos/vendors/espressif/esp-idf/tools/cmake/build.cmake:306 (include) 

  freertos/vendors/espressif/esp-idf/tools/cmake/build.cmake:451 (__build_process_project_includes) 

  freertos/vendors/espressif/boards/esp32/CMakeLists.txt:600 (idf_build_process) 

  freertos/CMakeLists.txt:70 (include) 

  

  

CMake Warning at freertos/vendors/espressif/esp-idf/tools/cmake/crosstool_version_check.cmake:28 (message): 

  Xtensa toolchain 

  /home/augmented/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc crosstool-ng 

  version crosstool-ng-1.22.0-80-g6c4433a doesn't match supported version 

  esp-2020r3.  Check Getting Started documentation or proceed at own risk. 

Call Stack (most recent call first): 

  freertos/vendors/espressif/esp-idf/components/esp32/project_include.cmake:31 (crosstool_version_check) 

  freertos/vendors/espressif/esp-idf/tools/cmake/build.cmake:306 (include) 

  freertos/vendors/espressif/esp-idf/tools/cmake/build.cmake:451 (__build_process_project_includes) 

  freertos/vendors/espressif/boards/esp32/CMakeLists.txt:600 (idf_build_process) 

  freertos/CMakeLists.txt:70 (include) 

  

  

-- App "aws_support" version: 1 

-- Adding linker script /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld 

-- Adding linker script /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld 

-- Adding linker script /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld 

-- Adding linker script /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld 

-- Adding linker script /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld 

-- Adding linker script /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld 

-- Adding linker script /home/augmented/aws_ota/aws_support/build/esp-idf/esp32/esp32_out.ld 

-- Adding linker script /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/components/esp32/ld/esp32.project.ld.in 

-- Adding linker script /home/augmented/aws_ota/aws_support/freertos/vendors/espressif/esp-idf/components/esp32/ld/esp32.peripherals.ld 

=========================Resolving dependencies========================== 

                          All modules available                           

  

====================Configuration for FreeRTOS==================== 

  Version:                 202107.00 

  Git version:             Unknown 

  

Target microcontroller: 

  vendor:                  Espressif 

  board:                   ESP32-DevKitC 

  description:             Development board produced by Espressif that comes in two  

                           variants either with ESP-WROOM-32 or ESP32-WROVER module 

  family:                  ESP32 

  data ram size:           520KB 

  program memory size:     4MB 

  

Host platform: 

  OS:                      Linux-5.4.0-80-generic 

  Toolchain:               xtensa-esp32 

  Toolchain path:          /home/augmented/esp/xtensa-esp32-elf 

  CMake generator:         Ninja 

  

FreeRTOS modules: 

  Modules to build:        backoff_algorithm, ble, ble_hal, ble_wifi_provisioning,  

                           common, common_io, core_http, core_http_demo_dependencies,  

                           core_json, core_mqtt, core_mqtt_agent, core_mqtt_agent_demo_ 

                           dependencies, core_mqtt_demo_dependencies, crypto,  

                           dev_mode_key_provisioning, http_demo_helpers, jobs,  

                           jobs_demo_dependencies, kernel, logging, mqtt_agent_interface,  

                           mqtt_demo_helpers, mqtt_subscription_manager, ota,  

                           ota_demo_dependencies, ota_demo_version, pkcs11,  

                           pkcs11_helpers, pkcs11_implementation, pkcs11_utils, platform,  

                           secure_sockets, tls, transport_interface_secure_sockets, wifi 

  Enabled by user:         ble, ble_hal, ble_wifi_provisioning, common_io, core_http_demo_ 

                           dependencies, core_json, core_mqtt_agent_demo_dependencies,  

                           core_mqtt_demo_dependencies, jobs, jobs_demo_dependencies,  

                           logging, ota_demo_dependencies, pkcs11, pkcs11_helpers,  

                           pkcs11_implementation, pkcs11_utils, platform, secure_sockets,  

                           wifi 

  Enabled by dependency:   backoff_algorithm, common, core_http, core_mqtt,  

                           core_mqtt_agent, crypto, demo_base, dev_mode_key_provisioning,  

                           freertos, http_demo_helpers, kernel, mqtt_agent_interface,  

                           mqtt_demo_helpers, mqtt_subscription_manager, ota,  

                           ota_demo_version, pkcs11_mbedtls, tls, transport_interface_ 

                           secure_sockets, utils 

  3rdparty dependencies:   mbedtls, pkcs11, tinycbor 

  Available demos:         demo_core_http, demo_core_mqtt, demo_core_mqtt_agent,  

                           demo_gatt_server, demo_jobs, demo_mqtt_ble, demo_numeric_ 

                           comparison, demo_ota_ble, demo_ota_core_http, demo_ota_core_ 

                           mqtt, demo_tcp, demo_wifi_provisioning 

  Available tests:          

========================================================================= 

  

-- Configuring incomplete, errors occurred! 

See also "/home/augmented/aws_ota/aws_support/build/CMakeFiles/CMakeOutput.log". 

See also "/home/augmented/aws_ota/aws_support/build/CMakeFiles/CMakeError.log". 

 

Method 2:

For project directory structure (Used the exact example from the github repository on the branch shubhamkulkarni97/amazon-freertos-examples)

  • freertos

  • components

    • example_component

      • include

        • example_component.h
      • src

        • example_component.c
      • CMakeLists.txt

  • src

    • main.c
  • CMakeLists.txt

After executing the command: cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=freertos/tools/cmake/toolchains/xtensa-esp32.cmake -GNinja

The error obtained is as below

CMake Warning at freertos/vendors/espressif/esp-idf/tools/cmake/idf.cmake:24 (message): 

  IDF_PATH environment variable not found.  Setting IDF_PATH to 

  '/home/augmented/aws_support/freertos/vendors/espressif/esp-idf'. 

Call Stack (most recent call first): 

  CMakeLists.txt:6 (include) 

  

  

-- Component directory /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/components/mbedtls does not contain a CMakeLists.txt file. No component will be added 

-- Component directory /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/components/unity does not contain a CMakeLists.txt file. No component will be added 

CMake Error at build/CMakeFiles/git-data/grabRef.cmake:48 (file): 

  file failed to open for reading (No such file or directory): 

  

    /home/augmented/aws_support/build/CMakeFiles/git-data/head-ref 

Call Stack (most recent call first): 

  freertos/vendors/espressif/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include) 

  freertos/vendors/espressif/esp-idf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision) 

  freertos/vendors/espressif/esp-idf/tools/cmake/build.cmake:68 (git_describe) 

  freertos/vendors/espressif/esp-idf/tools/cmake/build.cmake:160 (__build_get_idf_git_revision) 

  freertos/vendors/espressif/esp-idf/tools/cmake/idf.cmake:49 (__build_init) 

  CMakeLists.txt:6 (include) 

  

  

WARNING: IDF_PATH environment variable is not cleared. 

    If CMake is generating an error, consider clearing the IDF_PATH environment 

    variable, and generating a clean build. This message can be ignored if 

    CMake was successful. 

-- Checking Python dependencies... 

Python requirements from /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/requirements.txt are satisfied. 

-- Project sdkconfig file /home/augmented/aws_support/build/sdkconfig 

Loading defaults file /home/augmented/aws_support/build/sdkconfig.defaults... 

/home/augmented/aws_support/build/sdkconfig.defaults:21 CONFIG_NIMBLE_ENABLED was replaced with CONFIG_BT_NIMBLE_ENABLED 

/home/augmented/aws_support/build/sdkconfig.defaults:22 CONFIG_NIMBLE_MAX_CONNECTIONS was replaced with CONFIG_BT_NIMBLE_MAX_CONNECTIONS 

/home/augmented/aws_support/build/sdkconfig.defaults:23 CONFIG_NIMBLE_MAX_BONDS was replaced with CONFIG_BT_NIMBLE_MAX_BONDS 

/home/augmented/aws_support/build/sdkconfig.defaults:24 CONFIG_NIMBLE_MAX_CCCDS was replaced with CONFIG_BT_NIMBLE_MAX_CCCDS 

/home/augmented/aws_support/build/sdkconfig.defaults:25 CONFIG_NIMBLE_L2CAP_COC_MAX_NUM was replaced with CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM 

/home/augmented/aws_support/build/sdkconfig.defaults:26 CONFIG_NIMBLE_PINNED_TO_CORE was replaced with CONFIG_BT_NIMBLE_PINNED_TO_CORE 

/home/augmented/aws_support/build/sdkconfig.defaults:27 CONFIG_NIMBLE_ROLE_CENTRAL was replaced with CONFIG_BT_NIMBLE_ROLE_CENTRAL 

/home/augmented/aws_support/build/sdkconfig.defaults:28 CONFIG_NIMBLE_ROLE_PERIPHERAL was replaced with CONFIG_BT_NIMBLE_ROLE_PERIPHERAL 

/home/augmented/aws_support/build/sdkconfig.defaults:29 CONFIG_NIMBLE_ROLE_BROADCASTER was replaced with CONFIG_BT_NIMBLE_ROLE_BROADCASTER 

/home/augmented/aws_support/build/sdkconfig.defaults:30 CONFIG_NIMBLE_ROLE_OBSERVER was replaced with CONFIG_BT_NIMBLE_ROLE_OBSERVER 

/home/augmented/aws_support/build/sdkconfig.defaults:31 CONFIG_NIMBLE_NVS_PERSIST was replaced with CONFIG_BT_NIMBLE_NVS_PERSIST 

/home/augmented/aws_support/build/sdkconfig.defaults:32 CONFIG_NIMBLE_SM_LEGACY was replaced with CONFIG_BT_NIMBLE_SM_LEGACY 

/home/augmented/aws_support/build/sdkconfig.defaults:33 CONFIG_NIMBLE_SM_SC was replaced with CONFIG_BT_NIMBLE_SM_SC 

/home/augmented/aws_support/build/sdkconfig.defaults:34 CONFIG_NIMBLE_DEBUG was replaced with CONFIG_BT_NIMBLE_DEBUG 

/home/augmented/aws_support/build/sdkconfig.defaults:35 CONFIG_NIMBLE_SVC_GAP_DEVICE_NAME was replaced with CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME 

/home/augmented/aws_support/build/sdkconfig.defaults:36 CONFIG_NIMBLE_GAP_DEVICE_NAME_MAX_LEN was replaced with CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN 

/home/augmented/aws_support/build/sdkconfig.defaults:37 CONFIG_NIMBLE_ATT_PREFERRED_MTU was replaced with CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU 

/home/augmented/aws_support/build/sdkconfig.defaults:38 CONFIG_NIMBLE_SVC_GAP_APPEARANCE was replaced with CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE 

/home/augmented/aws_support/build/sdkconfig.defaults:39 CONFIG_NIMBLE_ACL_BUF_COUNT was replaced with CONFIG_BT_NIMBLE_ACL_BUF_COUNT 

/home/augmented/aws_support/build/sdkconfig.defaults:40 CONFIG_NIMBLE_ACL_BUF_SIZE was replaced with CONFIG_BT_NIMBLE_ACL_BUF_SIZE 

/home/augmented/aws_support/build/sdkconfig.defaults:41 CONFIG_NIMBLE_HCI_EVT_BUF_SIZE was replaced with CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE 

/home/augmented/aws_support/build/sdkconfig.defaults:42 CONFIG_NIMBLE_HCI_EVT_HI_BUF_COUNT was replaced with CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT 

/home/augmented/aws_support/build/sdkconfig.defaults:43 CONFIG_NIMBLE_HCI_EVT_LO_BUF_COUNT was replaced with CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT 

/home/augmented/aws_support/build/sdkconfig.defaults:44 CONFIG_NIMBLE_MESH was replaced with CONFIG_BT_NIMBLE_MESH 

/tmp/confgen_tmpxp_ahs3x:20 line was updated to CONFIG_BT_BLUEDROID_ENABLED=n 

/tmp/confgen_tmpxp_ahs3x:34 line was updated to CONFIG_BT_NIMBLE_DEBUG=n 

/tmp/confgen_tmpxp_ahs3x:44 line was updated to CONFIG_BT_NIMBLE_MESH=n 

-- App "freertos_examples" version: 1 

-- Adding linker script /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld 

-- Adding linker script /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld 

-- Adding linker script /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld 

-- Adding linker script /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld 

-- Adding linker script /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld 

-- Adding linker script /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld 

-- Adding linker script /home/augmented/aws_support/build/esp-idf/esp32/esp32_out.ld 

-- Adding linker script /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/components/esp32/ld/esp32.project.ld.in 

-- Adding linker script /home/augmented/aws_support/freertos/vendors/espressif/esp-idf/components/esp32/ld/esp32.peripherals.ld 

CMake Error at components/foo/CMakeLists.txt:6 (target_link_libraries): 

  INTERFACE library can only be used with the INTERFACE keyword of 

  target_link_libraries 

  

  

=========================Resolving dependencies========================== 

                          All modules available                           

  

====================Configuration for FreeRTOS==================== 

  Version:                 202107.00 

  Git version:             Unknown 

  

Target microcontroller: 

  vendor:                  Espressif 

  board:                   ESP32-DevKitC 

  description:             Development board produced by Espressif that comes in two  

                           variants either with ESP-WROOM-32 or ESP32-WROVER module 

  family:                  ESP32 

  data ram size:           520KB 

  program memory size:     4MB 

  

Host platform: 

  OS:                      Linux-5.4.0-80-generic 

  Toolchain:               xtensa-esp32 

  Toolchain path:          /home/augmented/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8. 

                           4.0/xtensa-esp32-elf 

  CMake generator:         Ninja 

  

FreeRTOS modules: 

  Modules to build:        backoff_algorithm, ble, ble_hal, ble_wifi_provisioning,  

                           common, common_io, core_http, core_http_demo_dependencies,  

                           core_json, core_mqtt, core_mqtt_agent, core_mqtt_agent_demo_ 

                           dependencies, core_mqtt_demo_dependencies, crypto,  

                           dev_mode_key_provisioning, http_demo_helpers, jobs,  

                           jobs_demo_dependencies, kernel, logging, mqtt_agent_interface,  

                           mqtt_demo_helpers, mqtt_subscription_manager, ota,  

                           ota_demo_dependencies, ota_demo_version, pkcs11,  

                           pkcs11_helpers, pkcs11_implementation, pkcs11_utils, platform,  

                           secure_sockets, tls, transport_interface_secure_sockets, wifi 

  Enabled by user:         ble, ble_hal, ble_wifi_provisioning, common_io, core_http_demo_ 

                           dependencies, core_json, core_mqtt_agent_demo_dependencies,  

                           core_mqtt_demo_dependencies, jobs, jobs_demo_dependencies,  

                           logging, ota_demo_dependencies, pkcs11, pkcs11_helpers,  

                           pkcs11_implementation, pkcs11_utils, platform, secure_sockets,  

                           wifi 

  Enabled by dependency:   backoff_algorithm, common, core_http, core_mqtt,  

                           core_mqtt_agent, crypto, demo_base, dev_mode_key_provisioning,  

                           freertos, http_demo_helpers, kernel, mqtt_agent_interface,  

                           mqtt_demo_helpers, mqtt_subscription_manager, ota,  

                           ota_demo_version, pkcs11_mbedtls, tls, transport_interface_ 

                           secure_sockets, utils 

  3rdparty dependencies:   mbedtls, pkcs11, tinycbor 

  Available demos:         demo_core_http, demo_core_mqtt, demo_core_mqtt_agent,  

                           demo_gatt_server, demo_jobs, demo_mqtt_ble, demo_numeric_ 

                           comparison, demo_ota_ble, demo_ota_core_http, demo_ota_core_ 

                           mqtt, demo_tcp, demo_wifi_provisioning 

  Available tests:          

========================================================================= 

  

-- Configuring incomplete, errors occurred! 

See also "/home/augmented/aws_support/build/CMakeFiles/CMakeOutput.log". 

 

Hi @ARG3,
is your issue similar to this one CMake project setup issues with AWS FreeRTOS for ESP32
and/or this one
How do I link amazon freertos to my project
If you follow the steps mentioned and it doesn’t work pleas let me know.

Hi
Thank you for the quick response. I tried the solution that you pointed to with the changes in the CMakeLists.txt in the components folder and the one on the top-level.
However I encounter a different error now. Could you please let me know what could be wrong.

CMake Warning at FreeRTOS/vendors/espressif/esp-idf/tools/cmake/idf.cmake:24 (message):
  IDF_PATH environment variable not found.  Setting IDF_PATH to
  '/home/augmented/aws_support_trial/freertos-example/FreeRTOS/vendors/espressif/esp-idf'.
Call Stack (most recent call first):
  FreeRTOS/vendors/espressif/boards/esp32/CMakeLists.txt:38 (include)
  FreeRTOS/CMakeLists.txt:70 (include)


-- Component directory /home/augmented/aws_support_trial/freertos-example/FreeRTOS/vendors/espressif/esp-idf/components/mbedtls does not contain a CMakeLists.txt file. No component will be added
-- Component directory /home/augmented/aws_support_trial/freertos-example/FreeRTOS/vendors/espressif/esp-idf/components/unity does not contain a CMakeLists.txt file. No component will be added
-- Checking Python dependencies...
Python requirements from /home/augmented/aws_support_trial/freertos-example/FreeRTOS/vendors/espressif/esp-idf/requirements.txt are satisfied.
-- Project sdkconfig file /home/augmented/aws_support_trial/freertos-example/built/sdkconfig
Loading defaults file /home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults...
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:21 CONFIG_NIMBLE_ENABLED was replaced with CONFIG_BT_NIMBLE_ENABLED
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:22 CONFIG_NIMBLE_MAX_CONNECTIONS was replaced with CONFIG_BT_NIMBLE_MAX_CONNECTIONS
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:23 CONFIG_NIMBLE_MAX_BONDS was replaced with CONFIG_BT_NIMBLE_MAX_BONDS
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:24 CONFIG_NIMBLE_MAX_CCCDS was replaced with CONFIG_BT_NIMBLE_MAX_CCCDS
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:25 CONFIG_NIMBLE_L2CAP_COC_MAX_NUM was replaced with CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:26 CONFIG_NIMBLE_PINNED_TO_CORE was replaced with CONFIG_BT_NIMBLE_PINNED_TO_CORE
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:27 CONFIG_NIMBLE_ROLE_CENTRAL was replaced with CONFIG_BT_NIMBLE_ROLE_CENTRAL
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:28 CONFIG_NIMBLE_ROLE_PERIPHERAL was replaced with CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:29 CONFIG_NIMBLE_ROLE_BROADCASTER was replaced with CONFIG_BT_NIMBLE_ROLE_BROADCASTER
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:30 CONFIG_NIMBLE_ROLE_OBSERVER was replaced with CONFIG_BT_NIMBLE_ROLE_OBSERVER
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:31 CONFIG_NIMBLE_NVS_PERSIST was replaced with CONFIG_BT_NIMBLE_NVS_PERSIST
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:32 CONFIG_NIMBLE_SM_LEGACY was replaced with CONFIG_BT_NIMBLE_SM_LEGACY
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:33 CONFIG_NIMBLE_SM_SC was replaced with CONFIG_BT_NIMBLE_SM_SC
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:34 CONFIG_NIMBLE_DEBUG was replaced with CONFIG_BT_NIMBLE_DEBUG
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:35 CONFIG_NIMBLE_SVC_GAP_DEVICE_NAME was replaced with CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:36 CONFIG_NIMBLE_GAP_DEVICE_NAME_MAX_LEN was replaced with CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:37 CONFIG_NIMBLE_ATT_PREFERRED_MTU was replaced with CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:38 CONFIG_NIMBLE_SVC_GAP_APPEARANCE was replaced with CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:39 CONFIG_NIMBLE_ACL_BUF_COUNT was replaced with CONFIG_BT_NIMBLE_ACL_BUF_COUNT
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:40 CONFIG_NIMBLE_ACL_BUF_SIZE was replaced with CONFIG_BT_NIMBLE_ACL_BUF_SIZE
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:41 CONFIG_NIMBLE_HCI_EVT_BUF_SIZE was replaced with CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:42 CONFIG_NIMBLE_HCI_EVT_HI_BUF_COUNT was replaced with CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:43 CONFIG_NIMBLE_HCI_EVT_LO_BUF_COUNT was replaced with CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT
/home/augmented/aws_support_trial/freertos-example/built/sdkconfig.defaults:44 CONFIG_NIMBLE_MESH was replaced with CONFIG_BT_NIMBLE_MESH
/tmp/confgen_tmpao1xdx8y:20 line was updated to CONFIG_BT_BLUEDROID_ENABLED=n
/tmp/confgen_tmpao1xdx8y:34 line was updated to CONFIG_BT_NIMBLE_DEBUG=n
/tmp/confgen_tmpao1xdx8y:44 line was updated to CONFIG_BT_NIMBLE_MESH=n
CMake Error at FreeRTOS/vendors/espressif/esp-idf/components/esp32/project_include.cmake:21 (message):
  Internal error, toolchain has not been set correctly by project (or an
  invalid CMakeCache.txt file has been generated somehow)
Call Stack (most recent call first):
  FreeRTOS/vendors/espressif/esp-idf/tools/cmake/build.cmake:306 (include)
  FreeRTOS/vendors/espressif/esp-idf/tools/cmake/build.cmake:451 (__build_process_project_includes)
  FreeRTOS/vendors/espressif/boards/esp32/CMakeLists.txt:600 (idf_build_process)
  FreeRTOS/CMakeLists.txt:70 (include)


-- Configuring incomplete, errors occurred!
See also "/home/augmented/aws_support_trial/freertos-example/built/CMakeFiles/CMakeOutput.log".

Whenever you see invalid CMakeCache.txt file has been generated somehow, it’s normally a sign that you must delete the build directory and try rebuilding again.