re-flashing factory partition

alsaleem00
Posts: 8
Joined: Tue Oct 06, 2020 12:40 pm

re-flashing factory partition

Postby alsaleem00 » Sat Feb 20, 2021 2:33 am

I configured my partition table with
- factory partition.
- one ota partition
(also using - custom bootloader)

The reason for not having two ota's is that my ota app is large and the 4MB flash can not hold ota0+ota1 (ota app ~ 2.1MB). Thus, created a factory app (~1MB) to re-flash the ota app. Factory is flashing new ota apps from a bin file in sdcard.

In rare case and in controlled setup, I need to re-flash the factory partition by ota app.
When I used the ota functions

Code: Select all

upd_part = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, NULL);
I get the correct factory partition location, but

Code: Select all

esp_ota_begin(upd_part, OTA_SIZE_UNKNOWN, &update_handle);
returns invalid argument error. I guess this is because it is the factory partition, right?

Is there a way to make (esp_ota_begin) accepts operation even if it is the factory?
Thanks.

alsaleem00
Posts: 8
Joined: Tue Oct 06, 2020 12:40 pm

Re: re-flashing factory partition

Postby alsaleem00 » Sat Feb 20, 2021 7:10 pm

I was able to re-flash the factory partition using the API

Code: Select all

esp_partition_erase_range();
esp_partition_write();
Thanks!

Who is online

Users browsing this forum: jcolebaker and 127 guests