How to integrate an esspressif library into an arduino framework project

Hi, I have an ESP32 board with the following .ini file:

platform = espressif32
board = firebeetle32
framework = arduino

I know that the arduino frameworks provides access to many libraries from the espressif platform, however, not afaik to GitHub - espressif/esp-aws-iot: AWS IoT SDK for ESP32 based chipsets . I was wondering if it is possible to make use of the source code available in this repo within my project?

Since I do not have any experience in Cmake and esp-idf I do not know how to properly build the source/library content and link it to my arduino framework project.

Hope someone can provide me with some intel if this is possible and explain me the way of properly building/linking such “external” libraries.


1 Like

Do an ESP-IDF + Arduino-ESP32 build, just just like

shows, then add the esp-aws-iot component, just

does and the documentation describes.

Thank you for your answer, but I am not completely sure what you want me to do.

  1. I followed the README instructions from the blink example and I builded it successfully within a seperate pio project in an arduino framework - was this what you wanted me to do?

then add the esp-aws-iot component

Well I was not sure what you meant by that either but I checked the documentation and found the example I think you wanted me to find:

# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)


Since my project is in the arduino framework, there are no CMakeLists, so I added the espidf framework and I do have two frameworks now: framework = arduino, espidf

After that I copied the esp-aws-iot folder to my project following the instrcution from the documentation and added the lines from above into my CMakeLists.txt file in the src-folder:

Using EXTRA_COMPONENT_DIRS option in the root CMakeLists.txt file. This option represents a list of extra directories to search for components.

I tried building the blink example again but CMake is throwing some errors - here is the terminal output:

Warning! Arduino framework as an ESP-IDF component doesn’t handle the variant field! The default esp32 variant will be used.
Reading CMake configuration…
– Project is not inside a git repository, or git repository has no commits; will not use ‘git describe’ to determine PROJECT_VER.
– Building ESP-IDF components for target esp32
– Found Git: C:/Program Files/Git/cmd/git.exe (found version “”)
– Configuring incomplete, errors occurred!
See also “C:/0_GithubRepos/ESP-IDF/.pio/build/firebeetle32/CMakeFiles/CMakeOutput.log”.

fatal: not a git repository (or any of the parent directories): .git
CMake Error at .pio/build/firebeetle32/CMakeFiles/git-data/grabRef.cmake:48 (file):
file failed to open for reading (No such file or directory):


Call Stack (most recent call first):
C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/project.cmake:59 (git_describe)
C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/project.cmake:380 (__project_get_revision)
CMakeLists.txt:3 (project)

CMake Error at C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/component.cmake:219 (message):
CMake Warning (dev) at

Syntax Warning in cmake code at column 51

Argument not separated from preceding token by whitespace.

Call Stack (most recent call first):

C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/scripts/component_get_requirements.cmake:3 (include)

This warning is for project developers. Use -Wno-dev to suppress it.

fatal: Needed a single revision

fatal: Needed a single revision

CMake Error at

define_property command is not scriptable

Call Stack (most recent call first):

C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/kconfig.cmake:1 (include)
C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/idf.cmake:41 (include)
C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/project.cmake:12 (include)
src/CMakeLists.txt:5 (include)
C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/scripts/component_get_requirements.cmake:106 (include)
C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/scripts/component_get_requirements.cmake:124 (__component_get_requirements)

Call Stack (most recent call first):
C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/build.cmake:488 (__component_get_requirements)
C:/Users/wes39504/.platformio/packages/framework-espidf/tools/cmake/project.cmake:384 (idf_build_process)
CMakeLists.txt:3 (project)

So I am quite sure this is not want you wanted me to do, but maybe you could elaborate what I could do to use the library in my current arduino framework based pio project.

I don’t get any such errors when I just created the proejct. See

Your example you compiles fine on my computer as well but I think you did not copy the aws-iot stuff into the blink example, did you?

I made a fresh start.

  1. I created a pio project using the espidf-arduino-blink folder

  2. I adapted the platformio.ini to

platform = espressif32
board = firebeetle32
framework = arduino, espidf
build_flags =
monitor_speed = 115200
  1. I created a folder called components in the root directory of the project (same hierachy level as src or lib folder)
  2. I copied the complete esp-aws-iot folder into the components folder
  3. In root-folder’s!!! CMakeLists.txt file I replaced the project name with: project(arduino_with_aws) like in your example.
  4. I compiled and it worked.
  5. I added the function parseUnsignedInteger32Value() and #include "aws_iot_json_utils.h"in the header to see if I can actually access the libraries.
  6. I compiled and it worked.

Thank you for your help @maxgerhardt . My goal was to understand how to incorporate further espidf libraries into my arduino framework and I think I can handle it now - will come back if I have further questions.

EDIT: If I want to add something like to my project, could I simply add those libraries into my component folder, take on example from the repo’s example folder as main.cpp and use both plattforms (arduino, espidf) again?

1 Like