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.
i-want-to-integrate-ota-into-esp32/19429
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?
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 :
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.
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
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.
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.
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.
@JouniV
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.