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


I’m using a LILYGO® TTGO T-Display ESP32 ( with 16MB flash size, and I need to display an animated GIF.
Without the GIF, my projects uses 1.003.306 bytes out of 1.835.008, but the GIF weighs 1.8MB, so it fails with error section '.flash.rodata' will not fit in region 'drom0_0_seg'

I guess I should change partiton size, but can’t find any info on this subject…

Any help would be appreciated.


Processing esphome-the-sub (board: featheresp32; framework: arduino; platform: platformio/espressif32 @ 3.3.2)
HARDWARE: ESP32 240MHz, 320KB RAM, 16MB Flash
Linking .pioenvs/esphome-the-sub/firmware.elf
RAM:   [=         ]  13.4% (used 43796 bytes from 327680 bytes)
Flash: [=====     ]  54.7% (used 1003306 bytes from 1835008 bytes)
Building .pioenvs/esphome-the-sub/firmware.bin
============================================= [SUCCESS] Took 35.00 seconds =============================================

Right now that’s not supported by ESPHome, unfortunately.

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:

  name: ${devicename}
  platform: ESP32
  board: featheresp32
    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.


So for a 16BM flash, you split it into the two 8MB OTA partitions? The board I’m working with has a 32MB flash, so it makes sense to split that evenly. The two partitions are probably the running one, and the one to load an update into and there is a boot flag marking the partition to boot from.

Actually the main partitions are a bit smaller, since there are some other partitions in common but yes, that is the idea. It has passed some time since I played with this, I seem to remember that without two OTA partitions, OTA doesn’t work.

Yep, understood. Start with the 16MB, or in my case 32MB, subtract the system partitions, then divide what is left evenly between the two ota partitions. Thanks for pointing out how to do this!

Hi Marco , can you help me create a custom_partitions.csv for my ESP32-S3-WROOM-1-N16R8(16M Flash/8SRAM)

Right now its configured as board: esp32-s3-devkitc-1 and only shows up as 8MB flash

Alright I think I answered my own question after trying a bit … Just if others hit this topic needing a partition table for an esp32s3 with 16MB flash I think this should work - please correct me if im wrong:

I found this default partition table in my project folder just searching for .csv files:

nvs, data, nvs, 0x009000, 0x005000,
otadata, data, ota, 0x00e000, 0x002000,
app0, app, ota_0, 0x010000, 0x1C0000,
app1, app, ota_1, 0x1D0000, 0x1C0000,
eeprom, data, 0x99, 0x390000, 0x001000,
spiffs, data, spiffs, 0x391000, 0x00F000

I then convertet all the partition sizes (the last column) to decimal because it works better in my head:

Hex size decimal size
0x005000 20480
0x002000 8192
0x1C0000 1835008
0x1C0000 1835008
0x001000 4096
0x00F000 61440

If I then add together all the partitions EXCEPT app0 and app1 then I got: 94208
And my 16MB Esp should have a total of 16777216 Bytes
Then I subtracted 94208 from 16777216 and got 16683008
Which I devided into two (because it needs two app partitions) and got 8341504

So my new partition table is like this:

nvs,      data, nvs,     0x009000, 0x005000,
otadata,  data, ota,     0x00e000, 0x002000,
app0,     app,  ota_0,   , 8341504,
app1,     app,  ota_1,   , 8341504,
eeprom,   data, 0x99,    , 0x001000,
spiffs,   data, spiffs,  , 0x00F000
  • The “Offset” field for some partitions is empty. The tool fills in each blank offset, starting after the partition table and making sure each partition is aligned correctly.
    Read more.



Uhm… I’m sorry but this was a lot of time ago and I stopped playing with partition sizes. AW the best option is to experiment and find a working configuration, you should always be able to flash a working firmware by USB :innocent:

It’s not clear to me how it works today if I buy an ESP32 with more than the default 4MB flash.

  • Does ESPHome automatically use the extra space?
  • Does it support it but only with some manual configuration?
  • Does it not support it?

Thanks for any insights you may have!