(resolved) OTA and the otadata partition

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: OTA and the otadata partition

Postby mzimmers » Mon Oct 29, 2018 9:33 pm

OK, thanks. So if I wanted to give the user a (short) menu of partition options, how do I tell which have been programmed? Is there an ESP facility for this, or do I just make something up myself (like a string in the image that my utility searches for)?

PS: the OTA is actually working...I'm impressed.

chegewara
Posts: 2207
Joined: Wed Jun 14, 2017 9:00 pm

Re: OTA and the otadata partition

Postby chegewara » Tue Oct 30, 2018 7:36 am

Every partition have label, you can store in NVS which partition has been OTA updated lately. In addition factory partition and you have menu.

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: OTA and the otadata partition

Postby mzimmers » Wed Oct 31, 2018 10:59 pm

A label doesn't tell me whether that partition has been programmed with a valid image. Is there a way to take a closer look?

I want to provide my user with a menu of the *programmed* partitions. No point in offering him an invalid choice.

chegewara
Posts: 2207
Joined: Wed Jun 14, 2017 9:00 pm

Re: OTA and the otadata partition

Postby chegewara » Wed Oct 31, 2018 11:37 pm

It surely does tell you that. When you do OTA you know what partition you are flashing and for sure you know that OTA has been succeeded or not. So when you know that you OTA flash ends with success you can retrieve label from that partition and store it in NVS. But of course its only theory.

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: OTA and the otadata partition

Postby mzimmers » Thu Nov 01, 2018 4:57 pm

Hi Chegewara - I don't think we're talking about the same thing. Here's my scenario: I create the following partitions:

nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
ota_0,app,ota_0,0x110000,1M,
ota_1,app,ota_1,0x210000,1M,

As you can see, I have three app partitions. At this time, all have labels, but none are necessarily flashed with anything. I could write all 0s to any of those partitions and it would still have its label.

I'm hoping for a way to quickly examine each app partition to see whether it has been validly programmed or not. Like looking for an identifier at some known offset or something. But I don't know of a way to do that.

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: OTA and the otadata partition

Postby fly135 » Thu Nov 01, 2018 5:00 pm

If your factory partition has nothing and previous OTAs have not been done then you don't have anything. So if your app is running you know that the factory has been programmed. Not sure why you need to know about OTAs because when you perform an OTA that is handled in the code. WRT NVS, just read a parameter that you expect to be there and if it isn't then it hasn't been programmed.

John A

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: OTA and the otadata partition

Postby mzimmers » Thu Nov 01, 2018 5:23 pm

I hear what you're saying, but I see value in giving the user the option of selecting between various programs. Something like this:
partition.PNG
partition.PNG (7.29 KiB) Viewed 8069 times
Only with more meaningful names. As my company begins using the ESP32 for more of our product lines, I envision us programming multiple images at mfg. time. (Maybe I'm overthinking this.)

But this is no big deal. Currently I'm much more interested in serialization; I'll probably start a new thread on that this afternoon.

chegewara
Posts: 2207
Joined: Wed Jun 14, 2017 9:00 pm

Re: OTA and the otadata partition

Postby chegewara » Thu Nov 01, 2018 6:08 pm

mzimmers wrote:Hi Chegewara - I don't think we're talking about the same thing. Here's my scenario: I create the following partitions:

nvs,data,nvs,0x9000,16K,
otadata,data,ota,0xd000,8K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
ota_0,app,ota_0,0x110000,1M,
ota_1,app,ota_1,0x210000,1M,

As you can see, I have three app partitions. At this time, all have labels, but none are necessarily flashed with anything. I could write all 0s to any of those partitions and it would still have its label.

I'm hoping for a way to quickly examine each app partition to see whether it has been validly programmed or not. Like looking for an identifier at some known offset or something. But I don't know of a way to do that.
Maybe we are just slightly on different tracks. I thinking just like John, when you have esp32 running then you have factory app flashed (lets say in manufacturing process). Now each time you perform OTA update you know exactly which ota partition you are updating, when process is done, you know that updating is successful or not. When it is successful then read label of that partition and store in NVS that partition is flashed with application and can be performed start from that partition. You can track this with bit flags, one bit for each partition and/or with partition labels. Many possibilities.

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: OTA and the otadata partition

Postby mzimmers » Thu Nov 01, 2018 6:42 pm

fly135 wrote: How about OTADATA?

Code: Select all

# Name,   Type, SubType, Offset,  Size, Flags
# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild
nvs,      data, nvs,     0x9000,  0x4000
otadata,  data, ota,     0xd000,  0x2000
phy_init, data, phy,     0xf000,  0x1000,
factory,  app,  factory, 0x10000, 2M,
storage,  data, spiffs,  ,        0xF0000,
ota_0,    0, ota_0,     0x400000, 2M,
ota_1,    0, ota_1,     0x600000, 2M,
How did you get 2M of space for your app partitions? I tried that and got an error:

Code: Select all

I (10) boot: ESP-IDF v3.1.1-rc2-2-gd1d2ce8c2-dirty 2nd stage bootloader
I (11) boot: compile time 11:35:13
I (39) boot: Enabling RNG early entropy source...
I (39) boot: SPI Speed      : 40MHz
I (39) boot: SPI Mode       : DIO
I (41) boot: SPI Flash Size : 4MB
E (45) flash_parts: partition 4 invalid - offset 0x210000 size 0x200000 exceeds flash chip size 0x400000
E (55) boot: Failed to verify partition table
E (60) boot: load partition table error!
user code done

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: OTA and the otadata partition

Postby fly135 » Fri Nov 02, 2018 2:41 pm

I have a 16MB flash on my board. So I've still got 8MB unused.

Who is online

Users browsing this forum: Google [Bot], lpinter, Majestic-12 [Bot] and 128 guests