Expansion of NVS partition requires adapt default app partition address in esptool
If you want to increase the size of the NVS partition, the start address of the app partition changes as well. But Arduino IDE (using esptool to flash the ESP32) has the start address hard-coded.
If, for example, you change your partition table into
Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x15000,
otadata, data, ota, 0x1e000, 0x2000,
app0, app, ota_0, 0x20000, 0x140000,
app1, app, ota_1, 0x160000,0x140000,
eeprom, data, 0x99, 0x2A0000,0x1000,
spiffs, data, spiffs, 0x2A1000,0x15F000,
The new start address for the application would be 0x20000 instead of 0x10000. Arduino IDE would flash the application, but to the wrong address.
To flash the app to the correct address there are 2 possibilities:
- Start esptool manually with the correct app start address
- Tell Arduino IDE to flash the app to the correct app start address.
The second one can be achieved by changing the file platform.txt in your <SKETCHBOOK_FOLDER>\hardware\espressif\esp32 folder.
Inside platform.txt search for the entries tools.esptool.upload.pattern and tools.esptool.upload.pattern.linux
The pattern look like
Change the 0x10000 in the patterns to 0x20000 and esptool will flash the application to the correct location.