esp32 amazon freertos

tcpipchip wrote on September 18, 2019:

Good morning team
I am writing a book about Alexa + lambda + mqtt and i will use the amazon freertos on esp32 to be the endpoint.
I followed the steps described in
https://docs.aws.amazon.com/en_pv/freertos/latest/userguide/getting_started_espressif.html
I got to sucess to create the thing.
But my problem is how to compile using the CMake, looks that the documentarion is poor in that point.
I already have the git of freertos and toolchain installed. I guess that the esp-idf already copied during freertos git.
sboxes@osboxes:~/esp$ ls
amazon-freertos xtensa-esp32-elf

osboxes@osboxes:~/esp/amazon-freertos$ cmake -DAFR_TOOLCHAIN_PATH=’/home/osboxes/esp/xtensa-esp32-elf/bin’ -DVENDOR=espressif -DBOARD=esp32_wrover_kit -DCOMPILER=xtensa-esp32 -S . -B /home/osboxes/esp/amazon-freertos/vendors/espressif/boards/esp32
CMake Warning at PreLoad.cmake:34 (message):
CMAKE_TOOLCHAIN_FILE is already defined to toolchain_file.cmake, you need
to delete cache and reconfigure if you want to switch compiler.

CMake Error at /usr/share/cmake-3.13/Modules/CMakeDetermineSystem.cmake:100 (message):
Could not find toolchain file: /path/to/toolchain_file.cmake
Call Stack (most recent call first):
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
– Configuring incomplete, errors occurred!
osboxes@osboxes:~/esp/amazon-freertos$

Can you help me with steps now how to compile with CMake?

Thanks!

Edited by: tcpipchip on Sep 18, 2019 2:32 AM

Gaurav-Aggarwal-AWS wrote on September 18, 2019:

Would you please try adding ‘/home/osboxes/esp/xtensa-esp32-elf/bin’ to your PATH, so that you do not need to specify AFR_TOOLCHAIN_PATH:


export PATH=$PATH:/home/osboxes/esp/xtensa-esp32-elf/bin

Also, try building in a separate directory. Below are the commands I used to build and these work for me:

  1. Directory contents (similar as you):

aggarg@ud6fb67faac6558:~/workplace/tmp/esp$ ls
amazon-freertos  xtensa-esp32-elf

  1. Build Commands:

cd amazon-freertos/
mkdir build
cmake -DVENDOR=espressif -DBOARD=esp32_wrover_kit -DCOMPILER=xtensa-esp32 -S . -B build/
cd build/
make all -j4

Which cmake version are you using?

Thanks.

tcpipchip wrote on September 19, 2019:

Gaurav-Aggarwal

Thank you so much! Looks now that compiles!!!
.
.
.
.
target microcontroller:
vendor: Espressif
board: ESP-WROVER-KIT
description: Development board produced by Espressif that has support for
LCD, MicroSD card, and USB JTAG interface. It 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.0.0-13-generic
Toolchain: xtensa-esp32
Toolchain path: /home/osboxes/esp/xtensa-esp32-elf
CMake generator: Unix Makefiles

Amazon FreeRTOS modules:
Modules to build: ble, ble_wifi_provisioning, common, crypto, defender,
dev_mode_key_provisioning, freertos_plus_tcp, greengrass,
https, kernel, mqtt, ota, pkcs11, pkcs11_implementation,
platform, secure_sockets, serializer, shadow, tls, wifi
Enabled by user: ble, ble_wifi_provisioning, defender, greengrass, https, mqtt,
ota, pkcs11, pkcs11_implementation, platform, secure_sockets,
shadow, wifi
Enabled by dependency: ble_hal, common, crypto, demo_base, dev_mode_key_provisioning,
freertos, freertos_plus_tcp, kernel, pkcs11_mbedtls,
secure_sockets_freertos_plus_tcp, serializer, tls, utils
3rdparty dependencies: http-parser, jsmn, mbedtls, pkcs11, tinycbor
Available demos: demo_ble, demo_ble_numeric_comparison, demo_defender,
demo_greengrass_connectivity, demo_https, demo_mqtt, demo_ota,
demo_shadow, demo_tcp, demo_wifi_provisioning
Available tests:

– Configuring done
– Generating done
– Build files have been written to: /home/osboxes/esp/amazon-freertos/build

make all -j4
compiled all :slight_smile:

THANK YOU SO MUCH!
I will verify now if runs on a U-BLOX NINA W102, flash with 2Mb.

Do you know wich models (ESP32) runs the rtos, will need really 4Mb ?
and about
cd amazon-freertos/
mkdir build
cmake -DVENDOR=espressif -DBOARD=esp32_wrover_kit -DCOMPILER=xtensa-esp32 -S . -B build/
cd build/
make all -j4

How can i ask to compile other example ?

Gaurav-Aggarwal-AWS wrote on September 19, 2019:

The currently supported ESP boards with Amazon FreeRTOS are ESP32-DevKitC and the ESP-WROVER-KIT as mentioned here: https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_espressif.html

The following hash defines are available in the config file
/vendors/espressif/boards/esp32/aws_demos/config_files/aws_demo_config.h:


CONFIG_MQTT_DEMO_ENABLED
CONFIG_SHADOW_DEMO_ENABLED
CONFIG_GREENGRASS_DISCOVERY_DEMO_ENABLED
CONFIG_TCP_ECHO_CLIENT_DEMO_ENABLED
CONFIG_DEFENDER_DEMO_ENABLED
CONFIG_OTA_UPDATE_DEMO_ENABLED
CONFIG_BLE_GATT_SERVER_DEMO_ENABLED
CONFIG_HTTPS_SYNC_DOWNLOAD_DEMO_ENABLED
CONFIG_HTTPS_ASYNC_DOWNLOAD_DEMO_ENABLED

Please define the corresponding macro to enable a demo and remove the MQTT one. For example, currently your config file will have:


#define CONFIG_MQTT_DEMO_ENABLED

Change it to the following to enable shadow demo:


#define CONFIG_SHADOW_DEMO_ENABLED

Thanks.

tcpipchip wrote on September 21, 2019:

Thank you so much!

Do you know wich CSV partition file open during compile ?

I want to change to port to U-BLOX NINA W102 using the following csv

partitions_singleapp.csv

Gaurav-Aggarwal-AWS wrote on September 22, 2019:

I am not sure about that and this seems something specific to Espressif. The best would be to post a question to Espressif on GitHub: https://github.com/espressif/esp-idf

Thanks.