Page 1 of 1

Dynamically changing the partition file.

Posted: Thu Apr 18, 2019 5:55 pm
by fly135
I'm would like to build multiple versions of my app to retain backwards compatibility with devices that must use OTA. I need to change the partition layout going forward, but want to keep the old one for OTA updates. I'm thinking that just building a different version to be OTA'd might be ok, since you can't change the partitions with OTA anyway. But I'm not sure that the code won't have something depends on partition layout.

Basically I'm splitting a partition I used for a file system into two paritions of FS and a second NVS.

So this....

storage, data, spiffs, 0x210000, 0xF0000,

later becomes this....

storage, data, spiffs, 0x210000, 0x80000,
secstore, data, nvs, 0x290000, 0x70000,

Can I use an environment variable or compiler define to switch between two partition definition files? Or can I just ignore the difference when I'm not flashing over USB? I.E. use bin file for OTA only.

John A

Re: Dynamically changing the partition file.

Posted: Fri Apr 19, 2019 2:30 am
by ESP_Sprite
As far as I'm aware, everything running on the ESP32 proper should use the partition table to find where things live, not offsets. That should allow you to upload the same OTA package to devices with different partition layouts without issue. As you noticed, serial uploads to the bootloader are an exception, as they use absolute addresses.

Re: Dynamically changing the partition file.

Posted: Fri Aug 30, 2019 12:51 pm
by luisonoff
For future users who find this: dynamically changing the partition table is doable.
I explain how we did it in this other topic: viewtopic.php?f=2&t=11482&p=48589#p48589