OTA (Over The Air) update implementation for ESP32E board

We are trying to implement OTA (Over The Air) update for ESP32E board from AWS. We have seen the following discussion, so we know what should be done.


Additionally, we have noticed that the old OTA library is deprecated from 2024. For some reason, we are not able to compile the codes needed by the OTA library, there are error messages. We are using esp-idf for compiling. What are the requirements for the succesful compilation of the OTA library codes?

All help is welcome, our schedule is very short.

1 Like

Hi @JouniV
Welcome to the FreeRTOS Community Forums!

This repository contains a project that demonstrates how to integrate FreeRTOS modular software libraries with the hardware capabilities of Espressif SoCs. It has been tested on the following boards :

  1. ESP32
  2. ESP32-C3
  3. ESP32-S3

Can you give this a try on the ESP32E board ?


Hi @karahulx

Thank you for the help. :blush:

We are following the link instructions you have provided for us. We noticed the following sentence in the instructions.

The demos use the [coreMQTT] library, while the [coreMQTT-Agent] library is employed to manage thread safety for the MQTT connection.

We have not included the coreMQTT and coreMQTT-Agent libraries into our project yet. Currently, we are suspecting that this is causing our compile time issues. We try to include those libraries by using the following instructions. We will let you know the results of that test.

Step 1: Set Up ESP-IDFDownload and Set Up ESP-IDF: Ensure you have the latest version of the ESP-IDF. Follow the instructions in the official ESP-IDF documentation to set up the environment: ESP-IDF Get Started

Step 2: Clone the core_mqtt RepositoryClone the core_mqtt repository: You need to clone the core_mqtt repository from GitHub. Navigate to your ESP-IDF project’s components directory and clone the repository:cd /path/to/your/esp-idf-project/components
git clone FreeRTOS/coreMQTT.git

Step 3: Include core_mqtt in Your ProjectModify CMakeLists.txt: Ensure that your project’s CMakeLists.txt includes the core_mqtt component. Typically, this file is located in the root directory of your project.

cmake_minimum_required(VERSION 3.5)


Add the coreMQTT component

set(EXTRA_COMPONENT_DIRS components/coreMQTT)

Step 4: Configure and Build Your ProjectConfiguration: Ensure all required configurations for MQTT are set in your project. You may need to adjust configurations for your specific use case, such as MQTT broker URL, port, etc. Build the Project: Navigate to your project directory and build it:cd /path/to/your/esp-idf-project
idf.py menuconfig
idf.py build

1 Like

Attempt to compile iot-reference-esp32c3 with espressif/idf docker image v4.4.7 fails with following error, what could be wrong?

[ 99%] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/demo_tasks/temp_sub_pub_and_led_control_demo/temp_sub_pub_and_led_control_demo.c.obj
In file included from /workspace/iot-reference-esp32c3/main/demo_tasks/temp_sub_pub_and_led_control_demo/temp_sub_pub_and_led_control_demo.c:81:
/workspace/iot-reference-esp32c3/main/demo_tasks/temp_sub_pub_and_led_control_demo/hardware_drivers/app_driver.h:23:10: fatal error: driver/temp_sensor.h: No such file or directory
#include “driver/temp_sensor.h”
compilation terminated.
make[2]: *** [esp-idf/main/CMakeFiles/__idf_main.dir/build.make:170: esp-idf/main/CMakeFiles/__idf_main.dir/demo_tasks/temp_sub_pub_and_led_control_demo/temp_sub_pub_and_led_control_demo.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:5630: esp-idf/main/CMakeFiles/__idf_main.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I see, I just had to comment out line 23 on hardware_drivers/app_driver.h:

//#include “driver/temp_sensor.h”

1 Like

Hi @karahulx

We were able to compile the all library codes by following the instructions of this discussion. :blush:

Our next task is to test these libraries in our project. We will let you know the test results.

1 Like

Hi @karahulx

We want to store the OTA AWS certificates into the flash of ESP32E board. We have used SPIFFS for that purpose in the main.c file of our project. For some reason, the linker does not find those functions. What could cause that issue? We checked that those functions are inside of libspiffs.a library file. Could this be a circular dependency issue and we should repeat some libraries at least twice on the linker command line?

Here are the linker error messages:

main.c: undefined reference to esp_spiffs_format' undefined reference to esp_vfs_spiffs_register’ control_flash.c: undefined reference to esp_spiffs_info' undefined reference to esp_vfs_spiffs_register’

[ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/esp_spiffs.c.obj [ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs_api.c.obj [ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_cache.c.obj [ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_check.c.obj [ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_gc.c.obj [ 89%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_hydrogen.c.obj [ 90%] Building C object esp-idf/spiffs/CMakeFiles/__idf_spiffs.dir/spiffs/src/spiffs_nucleus.c.obj [ 90%] Linking C static library libspiffs.a [ 90%] Built target __idf_spiffs

Description of the circular dependency issue:

Circular Dependencies[]

It’s possible for a project to contain Component A that requires (REQUIRES or PRIV_REQUIRES) Component B, and Component B that requires Component A. This is known as a dependency cycle or a circular dependency.

CMake will usually handle circular dependencies automatically by repeating the component library names twice on the linker command line. However this strategy doesn’t always work, and the build may fail with a linker error about “Undefined reference to …”, referencing a symbol defined by one of the components inside the circular dependency. This is particularly likely if there is a large circular dependency, i.e., A > B > C > D > A.

Hello JouniV,
I have reached out to espressif for help and would advise you according to their recommendation.

Best Regards,

1 Like

Hello @rawalexe

Thank you for the help, we will wait for that recommendation. :blush:

Best Regards

Have you looked at the following docs from Espressif -

1 Like

Hello @aggarg

Yes, we have seen that documentation.

The following linker definition partially solved our issue.

target_link_libraries(${COMPONENT_LIB} __idf_spiffs “-u esp_spiffs_format”)

Additionally, we had to use the following linker definition in front of that other definition. These two linker definitions together solved our linker issue.

cmake_policy(SET CMP0079 NEW)

We will let you know the results of our AWS OTA test.

Best Regards

1 Like

Thank you for sharing your solution!

1 Like

Hi @aggarg

FreeRTOS AWS OTA library:


I am sorry for the late response. Would it be possible to replace the WI-FI network layer of that FreeRTOS AWS OTA library with the following FreeRTOS Cellular Interface library network layer? Our customer wants us to use 4G modem for Internet connections. So, we are not allowed to use the WI-FI of the ESP32E chip. There is an UART connection between the ESP32E chip and 4G modem, these both components are on the same printed circuit board made by our customer.

FreeRTOS Cellular Interface library:


Best Regards

It is possible to use cellular interface library for network layer for AWS IoT OTA. You will need to implement the transport interface to communicate with cellular modem through UART. You can also use or reference our reference modem ports ( BG96, HL7802 and SARA-R4 ) to integrate your 4G modem with cellular interface.

Hi @Fresh

Thank you for the help. :blush:

Our modem is Quectel EG21-G.

We are currently testing the direct AT commands of that modem. It is possible that we will achieve the needed functionality with this technique.

We will let you know the results of our test.

Best Regards