ESP32 - Ota Demo Doesn't Link

HenryMcDonald wrote on May 22, 2018:

I’m attempting to get the OTA demo working on the ESP32, but if I uncomment out the vStartOTAUpdateDemoTask in AWS_Demo_Runner.c, the application doesn’t link. It appears that none of the OTA code in /lib/ota or in /demos/common/ota is getting compiled.

This is my output when I attempt to build the project:

CC build/amazon-freertos-common/demos/common/demo_runner/aws_demo_runner.o
AR build/amazon-freertos-common/libamazon-freertos-common.a
LD build/aws_demos.elf
/home/henrymcdonald/controller-0-10v/demos/espressif/esp32_devkitc_esp_wrover_kit/make/build/amazon-freertos-common/libamazon-freertos-common.a(aws_demo_runner.o):(.literal.DEMO_RUNNER_RunDemos+0x0): undefined reference to `vStartOTAUpdateDemoTask'
/home/henrymcdonald/controller-0-10v/demos/espressif/esp32_devkitc_esp_wrover_kit/make/build/amazon-freertos-common/libamazon-freertos-common.a(aws_demo_runner.o): In function `DEMO_RUNNER_RunDemos':
/home/henrymcdonald/controller-0-10v/demos/common/demo_runner/aws_demo_runner.c:58: undefined reference to `vStartOTAUpdateDemoTask'
collect2: error: ld returned 1 exit status
/home/henrymcdonald/controller-0-10v/demos/espressif/esp32_devkitc_esp_wrover_kit/make/../../../../lib/third_party/mcu_vendor/espressif/esp-idf/make/project.mk:393: recipe for target '/home/henrymcdonald/controller-0-10v/demos/espressif/esp32_devkitc_esp_wrover_kit/make/build/aws_demos.elf' failed
make: *** [/home/henrymcdonald/controller-0-10v/demos/espressif/esp32_devkitc_esp_wrover_kit/make/build/aws_demos.elf] Error 1

vStartOTAUpdateDemoTask is defined in {project root}/demos/common/ota/aws_ota_update_demo.c

I think that this may be a Makefile issue, but I’m perplexed so far at how the Makefile decides what .c files to include in the compilation. I’ll keep digging into that while I hope to receive a response here with some help.

awsXueli wrote on May 22, 2018:

Thanks for the interest on OTA update for ESP32. However, OTA update is currently not supported on ESP32. We did not include OTA demo in the aws_demo project for ESP32.

bradstewart wrote on May 22, 2018:

I’m also looking to use an ESP32 with FreeRTOS. Is there an available roadmap that shows if support is expected to come in the future?

esp-idf includes an OTA update example. As this is my first time ever considering using FreeRTOS (or any RTOS on an embedded system), I’m not sure how difficult it is to get external code working on the system. Do you, or anyone else that is reading this, have any insight? How difficult can I expect it to be to get this OTA example working?

aws-Xueli wrote on May 25, 2018:

In general, we plan to continue to work with our semiconductor partners to support (AWS IoT) OTA with Amazon FreeRTOS. Prioritization of those efforts is based largely on customer feedback such as this.

Regarding the OTA example provided in ESP-IDF, I haven’t tried it, although their documentation looks straightforward, https://github.com/espressif/esp-idf/blob/master/examples/system/ota/README.md.

(If you are asking what portions of the ESP-IDF implementation of OTA are reusable in a port of Amazon FreeRTOS OTA then, at a broad level, I would first point out that the former downloads the new firmware image over HTTP, while the latter uses MQTT over mutually-authenticated TLS. But note that the existing ESP32 port of Amazon FreeRTOS in https://github.com/aws/amazon-freertos/blob/master/demos/espressif/esp32_devkitc_esp_wrover_kit/common/application_code/main.c already includes the necessary MQTT and network transport plumbing. The reusable logic from the ESP-IDF OTA example will be in how and where the new image is stored on the device, and how the app triggers a device reset once the new image has been validated.)

If you are looking to port the Amazon FreeRTOS OTA library to ESP32, that effort will mainly consist of implementing our OTA “Platform Abstraction Layer” (PAL). Here are some documentation links to get you started:

General introductions to our OTA:
https://docs.aws.amazon.com/freertos/latest/userguide/freertos-ota-dev.html
https://docs.aws.amazon.com/freertos/latest/userguide/dev-guide-ota-workflow.html

The OTA PAL interfaces that need to be ported:
https://docs.aws.amazon.com/freertos/latest/userguide/porting-ota-pal.html
https://github.com/aws/amazon-freertos/blob/master/lib/include/private/aws_ota_pal.h

The PAL is driven by the OTA Agent (which in turn is driven by the app). For reference, the Agent API is documented here:
https://docs.aws.amazon.com/freertos/latest/lib-ref/aws__ts__ota__agent_8h.html

An OTA update is initiated from a job created in AWS IoT (either via console or API; the “-workflow” link above describes both). The Amazon FreeRTOS OTA cloud service uses AWS IoT Device Management to create those jobs. General information about Device Management jobs can be found in https://docs.aws.amazon.com/iot/latest/developerguide/iot-jobs.html.

Hope this helps.

lesudu wrote on June 08, 2018:

Hello,

I am also working with ESP32 and just found out that OTA is not yet supported with Amazon FreeRTOS. Is the work going on and when can we expect OTA functionality for this hardware?

Thanks.

Regards,
Sudarshan

Gaurav-Aggarwal-AWS wrote on June 08, 2018:

Hello,

Thank you for your query.

Amazon FreeRTOS does not support OTA on ESP32 as of now. We will keep you updated if anything changes.

Thanks.

Gaurav-Aggarwal-AWS wrote on June 09, 2018:

Thank you for your feedback. This is important to us as it helps us in prioritizing our work.

Thanks.

msn444 wrote on June 08, 2018:

Here’s one more vote for making it a priority!

darshu wrote on June 18, 2018:

Hello,

I am planning to use the ESP32 OTA feature soon. Here is another upvote!

Gaurav-Aggarwal-AWS wrote on June 18, 2018:

Thank you for your feedback.

DanG-AWS wrote on October 02, 2018:

The OTA update feature for Amazon FreeRTOS is now supported on ESP32. For example, please see https://github.com/aws/amazon-freertos/blob/master/lib/ota/portable/espressif/esp32_devkitc_esp_wrover_kit/aws_ota_pal.c.