Bug in ESP32 Partition Handling?


I have created a custom partition table, and the table itself is loaded and working correctly.

I have been experimenting with various partition tables on my 4MB ESP32-WROOM-32 device, and had some confusion.

My original partition table looked like this:

# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x1C0000,
app1, app, ota_1, 0x1D0000,0x1C0000,
eeprom, data, 0x99, 0x390000,0x1000,
spiffs, data, spiffs, 0x391000,0x6F000,

For this when I study the esptool command generated by PlatformIO it looks correct and the flashing is happening at the following locations:

0x1000 bootloader_dio_40m.bin 
0x8000 partitions.bin 
0xe000 boot_app0.bin 
0x10000 firmware.bin

This looks perfectly fine. However, when I change the partition table to look like this:

# Espressif ESP32 Partition Table
# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x6000
phy_init, data, phy, 0xf000, 0x1000
factory, app, factory, 0x10000, 2M

In this case too, the esptool command is still the same. It is still trying to upload the 4 bin files. The part I dont understand is that why is it still uploading “boot_app0.bin” @ offset 0xe000? Now my nvs partition should be occupying this space.

Can somebody please help me understand? Is this is a bug, something I am doing wrong, or normal behaviour?



Just a followup, do I need to “reset” the system so that it recompiles or recalculates the partitions needed?



You can CLEAN project if you do changes in partition tables. For example, pio run -t clean.