This repo shows how to set up a CMake project for ESP32 and use amazon freertos as an external library.
See the official document for software prerequisite, https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_espressif.html
Build instruction,
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=amazon-freertos/tools/cmake/toolchains/xtensa-esp32.cmake -GNinjaTo flash,
cmake --build build --target flashTo monitor the output,
export ESPPORT <replace-with-serial-port-of-ESP32>
amazon-freertos/vendors/espressif/esp-idf/tools/idf.py monitorIf you changed some configuartion and run into this, usually it's because of missing dependent libraries/demos. To fix it, first find out which CMake target the missing functions belong to, normally it should be in the CMakeLists.txt closest to the source file where the functions are defined. Then add the CMake target to your application dependency list using the target_link_libraries command in the root level CMakeLists.txt. For example,
- Linker complains about
undefined reference to NumericComparisonInit. NumericComparisonInitis defined inamazon-freertos/demos/ble/iot_ble_numericComparison.c.amazon-freertos/demos/ble/CMakeLists.txtdefines the targetble_numeric_comparisonwhich has this source file.- Link
AFR::demo_ble_numeric_comparisontarget withtarget_link_librariesto your application target. (demo_prefix is added because it's a demo module, all target names can be found in the summary of CMake output)