esp32partitionplatformio

ESP32 max partition table size doesn't seem to matter


I'm programming the ESP32 S2 WROOM with PlatformIO with a custom partition table that allows me to store as much data as possible in the app0 partition, and quite a lot of user settings in the nvs partition.

I tried seeing how large I could get the partitions, first I worked by manually calculating the partition offsets, and increasing sizes to humongous numbers like 600MB since the compiler didn't seem to care about the sizes of any of my partitions as long as they stayed within range of a 32-bit number. This is not good since my ESP model should only be allowed to store a max of 4MB, so I tried overflowing the memory offsets, and sizes in different ways to see if the compiler really didn't care... it didn't. This is a problem since I will now never know if the partition table I made is actually valid. This is the latest iteration: partitions table picture

Also yes, when compiling my code I could see app0 size was increased so it actually reads the table.

In short: Tried: Trying to set memory sizes of the different partitions to humongous sizes

Expected result: Compiler would yell at me for using invalid memory adresses/sizes

What actually happened: Compiler didn't care


Solution

  • The partitioning tools do not know what is the size of the SPI Flash on board your device. That's because the Flash is an external component and can theoretically come in any size sold on the market. Espressif sells devkits with Flash chips in sizes 4-32 MiB. Also, you can install your own Flash chip of any size.

    Only when you get around to writing your image into a specific device does it make sense to check if it fits, and the flasher tool does exactly that. Before that, it's your responsibility to do the arithmetic :)