Amazon FreeRTOS and EspressIf 4.3 with Platformio setup


After checking out Azure IOT Hub, we are not investigating AWS FreeRTOS and I am trying to setup my local environment using Platformio. The key is we want to use Amazon’s version of FreeRTOS so we can get the built in OTA agent to save on having to roll our own agent and backend for pushing updates etc.

I have searched the forums and people has suggested the biggest issue in general is that AWS’s FreeRTOS kernel is version 10 and the version of the kernel supported within IDF is 8.2. It appears that based on a post on EspressIf’s discussion forums from 2 weeks ago, 4.3 of IDF will support version 10 of the kernel!! Additionally, the changes have been merged into master but not officially released just yet.

So my question is does anyone have a sample build setup for Amazon FreeRTOS… not just the SDK. I cannot seem to get CMake and Platformio (either VSCode or Clion) and IDF to play nicely together. I can build everything through the CMake command line without Platformio following the AWS tutorials (what a pain) but really want an IDE.

My biggest issue is that CMake cannot find the AFR Toolchain

"/Users/greg.svitak/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/202.7319.72/" -DCMAKE_BUILD_TYPE=Debug -DVENDOR=espressif -DBOARD=esp32_wrover_kit -DCOMPILER=xtensa-esp32 -G "CodeBlocks - Unix Makefiles" /Users/greg.svitak/git/amazon-freertos-examples-platformio/freertos

CMake Error at tools/cmake/toolchains/find_compiler.cmake:23 (message):
  Compiler not found, you can specify search path with "AFR_TOOLCHAIN_PATH".
Call Stack (most recent call first):
  tools/cmake/toolchains/xtensa-esp32.cmake:6 (afr_find_compiler)
  /Users/userdir/Library/Application Support/JetBrains/Toolbox/apps/CLion/ch-0/202.7319.72/ (include)
  CMakeLists.txt:8 (project)

CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

Here is the sample repo that I cloned (from the AWS IOT Core product team). GitHub - tgsong/amazon-freertos-examples

Here is my platformio.ini

platform =
framework = espidf
build_flags = -DCORE_DEBUG_LEVEL=5 -DBA_BOARD=0 -DVENDOR=espressif -DBOARD=esp32_wrover_kit -DCOMPILER=xtensa-esp32

board = esp-wrover-kit

board_build.embed_txtfiles =


cmake_minimum_required(VERSION 3.13)


set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/freertos/tools/cmake/toolchains/xtensa-esp32.cmake)

# Add some extra components. IDF_EXTRA_COMPONENT_DIRS is an variable used by ESP-IDF
# to collect extra components.
    "components/foo" ABSOLUTE


# As of now there's no offical way to redefine config files outside of FreeRTOS source tree.
# This is a temporary approach to inject an include path so that this takes precedence over the
# config file directory inside FreeRTOS.
include_directories(BEFORE freertos-configs)

# Add freertos as an subdirectory. AFR_BOARD tells which board to target.
set(AFR_BOARD espressif.esp32_wrover CACHE INTERNAL "")

# Link against the mqtt demo so that we can use it. Dependencies of this demo are transitively
# linked.
target_link_libraries(afr_demo PRIVATE AFR::demo_mqtt)


Any help would be appreciated.


For others who want to try to do this… It appears this is not possible at the moment.

After a lot of research, I would wait until the AWS SDK includes the OTA Agent so it can be used in larger use cases.