Page 1 of 4

What is the purpose of two OTA partition?

Posted: Fri Nov 17, 2017 9:15 am
by Gfast2
Hi ESP-IDF,

Is the second one always reserved for back-up purpose?

(Yes, I know I still not investigate enough time on google about this question. But I just wanna know it faster... :oops: )

Cheer

Gfast2

Re: What is the purpose of two OTA partition?

Posted: Fri Nov 17, 2017 9:41 am
by WiFive
You can't erase currently running app

Re: What is the purpose of two OTA partition?

Posted: Fri Nov 17, 2017 10:11 am
by Gfast2
WiFive wrote:You can't erase currently running app
Hi WiFive,

Thanks for short + clear answer. I believe what I'm not clear is:
Is that means: The Bootloader will never ever update the partition of the factory partition. but only update the contents of one of both ota partition. So what is the point two wast another 1M precious spi flash space? :D

Re: What is the purpose of two OTA partition?

Posted: Fri Nov 17, 2017 10:27 am
by Gfast2
Perhapse I just investigate too much time on these meaning less point:

1. I figured out the csv partition table in docu about Partition Tables do not have "," on each line. But the example partition csv file for spiffs, they have. why? Are both correct? :oops:

2. "Factory app, two OTA definitions" from the docu show the Type for ota partition is "0" and subtype is "ota_1" or/and "ota_2", but in another docu said:
An OTA data partition (type data, subtype ota)
It does make me... not sure if I understand everything correctly. :oops:

Cheers

Gfast2

Re: What is the purpose of two OTA partition?

Posted: Fri Nov 17, 2017 10:47 am
by WiFive
Factory will not be updated, but it is also not required. But it is insurance to be able to factory reset to a (hopefully) known stable firmware even after many ota updates.

Re: What is the purpose of two OTA partition?

Posted: Fri Nov 17, 2017 11:00 am
by Gfast2
WiFive wrote:Factory will not be updated, but it is also not required. But it is insurance to be able to factory reset to a (hopefully) known stable firmware even after many ota updates.
Hi WiFive,

It is a very good point to reserve the factory app. It let me feel we a making something really works for another 100 years. :lol:

As a more concrete expression, I write two partition csv setting for the same purpose, according to two different docus I mentioned above.
I will checkout if both of them works:
1. for ota updating
2. for spiffs partition filesystem accessing

Code: Select all

# Name,   Type, Subtype, Offset,  Size
nvs,      data, nvs,     0x9000,  0x6000,
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 1M,
ota_1,    0,    ota_1,   ,        1M,
ota_2,    0,    ota_2,   ,        1M,
storage,  data, spiffs,  ,        0xF0000,

Code: Select all

# Name,   Type, Subtype, Offset,  Size
nvs,      data, nvs,     0x9000,  0x6000,
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 1M,
ota_1,    data, ota,     ,        1M,
ota_2,    data, ota,     ,        1M,
storage,  data, spiffs,  ,        0xF0000,

Re: What is the purpose of two OTA partition?

Posted: Fri Nov 17, 2017 12:12 pm
by Gfast2
Hi I come back,

With partition table:

Code: Select all

# Name,   Type, Subtype, Offset,  Size
nvs,      data, nvs,     0x9000,  0x6000,
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 1M,
ota_1,    0,    ota_1,   ,        1M,
ota_2,    0,    ota_2,   ,        1M,
storage,  data, spiffs,  ,        0xF0000,
I got error:

Code: Select all

W (201) SPIFFS: mount failed, -10025. formatting...
This error code is specified in "~/esp/esp-idf/components/spiffs/spiffs/src/spiffs.h" as "SPIFFS_ERR_NOT_A_FS", and then the task watch dog is triggered.

I think that is something wrong with "0xF0000".

cheers

Re: What is the purpose of two OTA partition?

Posted: Fri Nov 17, 2017 12:28 pm
by Gfast2
WiFive wrote:Factory will not be updated, but it is also not required. But it is insurance to be able to factory reset to a (hopefully) known stable firmware even after many ota updates.
Man can actually also remove this feature by:
If you want to conserve flash usage in an OTA project, you can remove the factory partition and use ota_0 instead.
RTFM ( :lol: ): Doc

Re: What is the purpose of two OTA partition?

Posted: Fri Nov 17, 2017 12:48 pm
by Gfast2
Ach!!!

Because:

0x10000 -> 64KB
0xF0000 -> 960KB

Which is no more available free space for the device (64KB + 1MB + 1MB + 1MB + 960KB > 4MB). So for my spiffs partition I just use "500KB" instead. Which let everything works again. :lol:

Code: Select all

# Name,   Type, Subtype, Offset,  Size
nvs,      data, nvs,     0x9000,  0x6000,
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 1M,
ota_0,    app,  ota_0,   ,        1M,
ota_1,    app,  ota_1,   ,        1M,
storage,  data, spiffs,  ,        500K,

CHEERS

Gfast2

Re: What is the purpose of two OTA partition?

Posted: Sun Apr 22, 2018 11:37 pm
by robpelu
Sorry I have arrived late to this post, but since the subject is very clear, didn't want to open a new one regarding the same thing.

I have a Flash shortage, and using OTA with one factory partition, just enough to connect and download the new binary.
And two OTA partitions to write the new image and have one as backup.
Now I'm considering using just the factory boot/update partition and one OTA.
When the device receives the update FW command, it selects the factory partition and restarts, so the update takes from there.
Up until now we have tested hundreds of times the update process via WIFI and there were no issues.

And now the question... do you see some danger in this approach, one that I couldn't see until now ?
The only one I see is that the update process failing to write somewhere in the OTA partition and then not possible to boot that one, but the factory firmware will keep executing to update again, and at some point it should succeed.

BR, Robert.