Using OTA with multi-partition application

User avatar
mbratch
Posts: 146
Joined: Fri Jun 11, 2021 1:51 pm

Using OTA with multi-partition application

Postby mbratch » Thu Sep 22, 2022 4:17 pm

I have an application that's pretty straightforward, but uses two partitions: one for the factory app, and SPIFFS partition for web pages and javascript, etc, which is the embedded web app used to access and configure, etc. More specifically:

Code: Select all

# Name        Type       SubType      Offset      Size
nvs           data       nvs          0x9000      0x6000
phy_init      data       phy          0xf000      0x1000
factory       app        factory      0x10000     0x130000
www           data       spiffs       0x140000    0x20000
I want to add OTA capability, but I'm unsure as to how to handle the www partition. I need two partitions for each "instance" of the application, but the OTA examples seem to only use one partition per application instance (ota_1, ota_2, etc...).

So I reckon it needs maybe to look something like this, although I suppose this isn't really correct for what I'm trying to achieve (e.g., how do I do OTA for the www partitions?):

Code: Select all

# Name        Type       SubType      Offset      Size
nvs           data       nvs          0x9000      0x4000
otadata       data       ota          0xd000      0x2000
phy_init      data       phy          0xf000      0x1000
factory       app        factory      0x10000     0x130000
www           data       spiffs       0x140000    0x20000
ota_0         app        factory      0x160000    0x130000
www_0         data       spiffs       0x290000    0x20000
ota_1         app        factory      0x2B0000    0x130000
www_1         data       spiffs       0x3E0000    0x20000
How is OTA done when each instance of the app is multiple partitions? Seems like this would be a common scenario, so I'm sure I'm just missing something obvious in the docs or examples that I've overlooked. So maybe I just need to be pointed at the right thing.

boarchuz
Posts: 471
Joined: Tue Aug 21, 2018 5:28 am

Re: Using OTA with multi-partition application

Postby boarchuz » Fri Sep 23, 2022 6:26 am

If these files are so tightly coupled with the firmware, embedding them in the firmware might be more suitable than a separate SPIFFS partition.

Does the firmware function properly without the files? If not, I would suggest they must be embedded in the binary. Are they ever altered, except in the case of a firmware update? Do you gain anything by having these accessible from different firmwares?

If there are optional and/or user-uploaded files then these may be good candidates for SPIFFS (eg. images) or even NVS (eg. settings).

Who is online

Users browsing this forum: No registered users and 45 guests