What is the purpose of two OTA partition?

snahmad75
Posts: 263
Joined: Wed Jan 24, 2018 6:32 pm

Re: What is the purpose of two OTA partition?

Postby snahmad75 » Tue May 08, 2018 9:03 pm

ok, It was exceed more than 4MB

Now I reduce it under 4MB

# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota_0, app, ota_0, 0x10000, 0x145000
ota_1, app, ota_1, , 0x145000
storage, data, fat, ,0x100000

Still no output. not working.

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

Re: What is the purpose of two OTA partition?

Postby chegewara » Tue May 08, 2018 10:14 pm

If i may suggest something. Try to fix it in few steps:
This works

# 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, 0x1f0000
storage, data, fat, ,1M

step 1: change

Code: Select all

 factory, app, factory, 0x10000, 0x1f0000
to

Code: Select all

ota, app, ota_1, 0x10000, 0x1A0000

step 2: change

Code: Select all

storage, data, fat, ,1M
to

Code: Select all

storage, data, fat, ,0x80000
(im assuming you still want to maximize ota partitions and have 512kB storage, other way skip it)
step 3: if above app with steps works add above storage partition

Code: Select all

ota, app, ota_2, 0x10000, 0x1A0000


PS one more thing is worth to mention. when you are working with ota partitions each time you make flash thru usb its recommended to perform make erase_flash first

snahmad75
Posts: 263
Joined: Wed Jan 24, 2018 6:32 pm

Re: What is the purpose of two OTA partition?

Postby snahmad75 » Wed May 09, 2018 8:33 am

ok, I will try step by step as you suggested.

I always do make erase_flash first

snahmad75
Posts: 263
Joined: Wed Jan 24, 2018 6:32 pm

Re: What is the purpose of two OTA partition?

Postby snahmad75 » Wed May 09, 2018 9:23 am

I tried out step #1 with storage. It stops working.

# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota, app, ota_1, 0x10000, 0x1A0000
storage, data, fat, ,1M

snahmad75
Posts: 263
Joined: Wed Jan 24, 2018 6:32 pm

Re: What is the purpose of two OTA partition?

Postby snahmad75 » Wed May 09, 2018 9:32 am

Sorry my mistake step #1 is working. wrong ota partition name. Now I will try adding second ota partition and check.

# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota_0, app, ota_0, 0x10000, 0x1A0000
storage, data, fat, ,1M

snahmad75
Posts: 263
Joined: Wed Jan 24, 2018 6:32 pm

Re: What is the purpose of two OTA partition?

Postby snahmad75 » Wed May 09, 2018 10:00 am

All working now. Thanks for yours input.

# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota_0, app, ota_0, 0x10000, 0x1A0000
ota_1, app, ota_1, , 0x1A0000
storage, data, fat, ,0x80000

I have sector size=512 in my config. 4k sector is not good for 0.5 Mb storage.

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

Re: What is the purpose of two OTA partition?

Postby chegewara » Wed May 09, 2018 11:46 am

I have to appologize, it would take shorter to solve your issue if i have read more about storage partitions and sector size dependency.

PS now you can try to adjust partitions size to use all available flash

snahmad75
Posts: 263
Joined: Wed Jan 24, 2018 6:32 pm

Re: What is the purpose of two OTA partition?

Postby snahmad75 » Wed May 09, 2018 12:06 pm

Thanks for your input. Yes sector size is another input.
For now OTA size is big enough for me. I may increase it in future if my application code size increase. I guess I can increase now to utilise remain bytes to test.

snahmad75
Posts: 263
Joined: Wed Jan 24, 2018 6:32 pm

Re: What is the purpose of two OTA partition?

Postby snahmad75 » Thu May 10, 2018 7:10 pm

Do I always need two OTA paritition for Update application over air.

I am considering another option to reduce my size in ROM. Can I have only OTA partition.

When OTA starts. I get .bin image via http get chunk by chunk and write to my SD card storage and overwrite my application reading from sd card file chunk by chunk.
Is this feasible?

My partition will look like this.

# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
ota_0, app, ota_0, 0x10000, 0x1A0000
storage, data, fat, ,0x80000

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

Re: What is the purpose of two OTA partition?

Postby chegewara » Thu May 10, 2018 7:38 pm

You cant write to partition you are running from, so you need at least 2 partitions:
- 2x OTA
- factory + OTA

But now when you asking this question i have idea. Maybe, but just maybe, it is possible to write ota.bin image to sd card, then reboot esp32. Now, when bootloader find ota.bin file on SD card then perform ota update, delete image from sd card, restart esp32. Even if this is not possible then you can have similar procedure on factory partition. This way you can have two options to ota update, from sd card or from internet. Im assuming that ota update procedure from sd card requires minimum partition size, far less than your regular application.

Who is online

Users browsing this forum: No registered users and 14 guests