Updating a specific partition with AWS's FreeRTOS OTA

Hello,

I am looking to perform an OTA update of a specific partition (SPIFFS filesystem) on my device (ESP32-S3). Is this possible with AWS’s FreeRTOS OTA update? I initially tried to specify the device path (/spiffs/) as the region but I believe I am doing this incorrectly. Any help would be greatly appreciated.

Kind Regards,
Kevin

Hi Kevin,

In the most general sense the OTA Library does allow full customization of how binaries are saved on your particular platform. This is done by implementing the OTA PAL functions described here:

https://aws.github.io/ota-for-aws-iot-embedded-sdk/v3.4.1/ota_pal_interface.html#ota_pal_interface_overview

Espressif has MQTT/HTTP examples including implementations of the OTA PAL functions found here:

Espressif also had documentation on setting up custom partitions for your device:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/partition-tables.html

I hope this helps, if you have any further questions please let us know.

Thanks!

Also, you can use the fileType during OTA Create to differentiate between files if you want to update both the main firmware and another specific partition as you described.

@joshzarr Thank you for pointing me to the OTAPal Functions. I am currently basing my OTA off the HTTP example and using AWS’s Jobs (in IoT Core → Remote actions → Jobs) I add my firmware’s binary and provide all necessary credentials. Remote actions → Jobs only lets me place one file binary file (which is just a binary built from esp-idf) but I also have a separate filesystem binary file where I would like to write to a different partition. I believe this can tie into what @aggarg mentioned. Is it possible to set up a Job template with specific parameters (e.g. fileType, addr to flash) to perform this? Or do I use AWS’s CLI to create a new type of file, including the two binary files and parameters?

If you want to use IoT Core → Remote actions → Jobs →Create FreeRTOS OTA update job, can you not create 2 separate jobs - one for the main firmware and other for the filesystem binary?

@aggarg I have tried it as a separate job but was not able to have a successful update due to a checksum error. For a the separate job of the filesystem binary, I am just unsure on how to use IoT core remote actions to write the filesystem binary to a particular partition address on my device. For my main firmware I have no issues of specifying “/” as my path to my device as it will write to one of my OTA partitions on my device.

For the checksum - how are you signing the device? If the filesystem binary is provided as a separate job just like the firmware update, then the signing should be very similar.

As for writing to the partition, you’ll need to update your OpenFile (aka OtaPalCreateFileForRx_t) and CloseFile (aka OtaPalCloseFile_t) PAL methods to open/close the file in the particular partition. As @aggarg mentioned, you can use the filetype which is stored in the FileContext in the Open & Close PAL functions to determine which partition to create the file in.