How to increase partition size (to use 16MB of flash instead of 4MB)

I managed to make it work: I created an ad-hoc partition csv file, managed to point esphome to it and successfully compiled. Everything works, including OTA updates.
I created a custom_partitions.csv file in esphome (at the same level of my YAML file) like this:

# Name,   Type, SubType, Offset,   Size,     Flags
nvs,      data, nvs,     0x009000, 0x005000,
otadata,  data, ota,     0x00e000, 0x002000,
app0,     app,  ota_0,   0x010000, 0x7F0000,
app1,     app,  ota_1,   0x800000, 0x7F0000,
eeprom,   data, 0x99,    0xFF0000, 0x001000,
spiffs,   data, spiffs,  0xFF1000, 0x00F000

then added to YAML the board_upload options under platformio_options:

esphome:
  name: ${devicename}
  platform: ESP32
  board: featheresp32
  platformio_options:
    board_upload.flash_size: 16MB
    board_upload.maximum_ram_size: 327680
    board_upload.maximum_size: 16777216
    board_build.partitions: "../../../custom_partitions.csv"

With these lines I was able to compile, upload and use a configuration that didn’t fit in the default, 4MB, scheme.
Didn’t try to remove app1 partition to further increase available size, don’t know if it is used in OTA updates.
Hope it helps someone, since I didn’t find any info on this.

12 Likes