Change partition size
OUTDATED! ARDUINO IDE HAS NOW MANY PARTITIONS TO SELECT FROM!
[EDIT 1]
If using Arduino IDE go to my post ‘Change partition size (Arduino IDE)‘ which is focused on Arduino IDE and might be less confusing than this here (which is mixing ArduinoIDE and PlatformIO).
[EDIT 2]
If using PlatformIO (on Atom or Visual Code) there is now as well another post ‘Change partition size (PlatformIO)‘ that is focused on changes required for PlatformIO .
To change the partition sizes, e.g. because the program doesn’t fit anymore into the default partition size, there are 3 possibilities:
change the default partition table, this affects all ESP32 boards
this method is the easiest if the new partition sizes will be used for all projects and all boardscreate a new partition table only for a specific ESP32 board
this method can be used if the new partition sizes will be used for all projects but only for a specific boardclone an existing device and create a partition table only for this device
this method can be used if the new partition sizes will be used only for a specific project and a specific board
If the partition sizes are changed there is 1 main rule: The start addresses of the partitions must be a multiple of 0x1000!
Remark 1: At least in PlatformIO the partition sizes change only if you flash the board over USB/Serial. If the board is flashed over ArduinoOTA, the partition sizes do not change!
Remark 2: This change will be lost if the ESP32 package is updated !
The default partition table default.csv is located at
for PlatformIO: .platformio\packages\framework-arduinoespressif32\tools\partitions\default.csv
for Arduino IDE: Arduino\hardware\espressif\esp32\tools\partitions\default.csv
The default partition table looks like:
1 2 3 4 5 6 7 |
# Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x140000, app1, app, ota_1, 0x150000,0x140000, eeprom, data, 0x99, 0x290000,0x1000, spiffs, data, spiffs, 0x291000,0x16F000, |
A partition table with maximum size for the application and no EEPROM and SPIFFS partition could look like:
1 2 3 4 5 |
# Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x1F0000, app1, app, ota_1, 0x200000,0x200000, |
Another example with a small EEPROM and SPIFFS partition:
1 2 3 4 5 6 7 |
# Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x1E0000, app1, app, ota_1, 0x1F0000,0x1E0000, eeprom, data, 0x99, 0x3F0000,0x1000, spiffs, data, spiffs, 0x3F1000,0xF000, |
Method 1
Change the entries of default.csv to your desired partition sizes. (See paths above)In .platformio\platforms\espressif32\boards find the .json file matching with your board. In this example edit .platformio\platforms\espressif32\boards\esp32dev.json (or whatever board you use). Change “maximum_size”: 1310720 to “maximum_size”: 1966080 (or whatever partition size you defined for the app0 and app1 partitions)Open .platformio\packages\framework-arduinoespressif32\boards.txt. Find your matching board in the file. In this example it is esp32.name=ESP32 Dev Module. For your board change the entry xxx.upload.maximum_size=1310720 to xxx.upload.maximum_size=1966080 (or whatever partition size you defined for the app0 and app1 partitions)Reflash your board over USB/Serial
Method 2
[Reference issue 703] from @delcomp
Make a copy of esp32/tools/partitions/default.csv and rename it (my example partitions.csv) (See paths above)Make the required changesOpen esp32/boards.txt and find the board (<YOUR_BOARD_NAME>)you are usingMake the following changes (size depends on your configuration)
1 2 3 4 |
#<YOUR_BOARD_NAME>.upload.maximum_size=1310720 <YOUR_BOARD_NAME>.upload.maximum_size=1835008 # Here goes your new app partition size !!! #<YOUR_BOARD_NAME>.build.partitions=default <YOUR_BOARD_NAME>.build.partitions=partitions # Here goes your new app partition size file name!!! |
In .platformio\platforms\espressif32\boards edit esp32dev.json (or whatever board you are using) and add “partitions”: “partitions.csv” into the build object. It should look like
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
{ "build": { "core": "esp32", "extra_flags": "-DARDUINO_ESP32_DEV", "f_cpu": "240000000L", "f_flash": "40000000L", "flash_mode": "dio", "ldscript": "esp32_out.ld", "mcu": "esp32", "variant": "esp32", "partitions": "partitions" }, "connectivity": [ "wifi", "bluetooth", "ethernet", "can" ], "frameworks": [ "arduino", "espidf" ], "name": "Espressif ESP32 Dev Module MaxAppPart", "upload": { "flash_size": "4MB", "maximum_ram_size": 294912, "maximum_size": 1966080, "require_upload_port": true, "speed": 115200, "wait_for_upload_port": true }, "url": "https://en.wikipedia.org/wiki/ESP32", "vendor": "Espressif" } |
Reflash your board over USB/Serial
Method 3
In this example I go for the maximum app partition size (0x1F0000) and no EEPROM and no SPIFFS partition. If you change to a different partition size you need to adapt the value 2031616 (== 0x1F0000) to the value of your partition size. E.g. a partition size of 0x1E0000 would equal to a value of 1966080 inside the different files.
Make a copy of default.csv and rename it (my example partitions.csv)Make the required changesIn boards.txt make a copy of the board you want to clone.
e.g make a copy of the ESP32 Dev Module and name it as ESP32 Dev Module MaxAppPart:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
############################################################## esp32maxapp.name=ESP32 Dev Module MaxAppPart # Here goes your new board name !!!** esp32maxapp.upload.tool=esptool esp32maxapp.upload.maximum_size=2031616 # Here goes your new app partition size !!!** esp32maxapp.upload.maximum_data_size=294912 esp32maxapp.upload.wait_for_upload_port=true esp32maxapp.serial.disableDTR=true esp32maxapp.serial.disableRTS=true esp32maxapp.build.mcu=esp32 esp32maxapp.build.core=esp32 esp32maxapp.build.variant=esp32 esp32maxapp.build.board=ESP32_MAXAPP # Here goes your new board name !!!** esp32maxapp.build.f_cpu=240000000L esp32maxapp.build.flash_size=4MB esp32maxapp.build.flash_freq=40m esp32maxapp.build.flash_mode=dio esp32maxapp.build.boot=dio esp32maxapp.build.partitions=partitions # Here goes your new app partition size file name!!!** esp32maxapp.menu.FlashMode.qio=QIO esp32maxapp.menu.FlashMode.qio.build.flash_mode=dio esp32maxapp.menu.FlashMode.qio.build.boot=qio esp32maxapp.menu.FlashMode.dio=DIO esp32maxapp.menu.FlashMode.dio.build.flash_mode=dio esp32maxapp.menu.FlashMode.dio.build.boot=dio esp32maxapp.menu.FlashMode.qout=QOUT esp32maxapp.menu.FlashMode.qout.build.flash_mode=dout esp32maxapp.menu.FlashMode.qout.build.boot=qout esp32maxapp.menu.FlashMode.dout=DOUT esp32maxapp.menu.FlashMode.dout.build.flash_mode=dout esp32maxapp.menu.FlashMode.dout.build.boot=dout esp32maxapp.menu.FlashFreq.80=80MHz esp32maxapp.menu.FlashFreq.80.build.flash_freq=80m esp32maxapp.menu.FlashFreq.40=40MHz esp32maxapp.menu.FlashFreq.40.build.flash_freq=40m esp32maxapp.menu.FlashSize.4M=4MB (32Mb) esp32maxapp.menu.FlashSize.4M.build.flash_size=4MB esp32maxapp.menu.FlashSize.2M=2MB (16Mb) esp32maxapp.menu.FlashSize.2M.build.flash_size=2MB esp32maxapp.menu.FlashSize.2M.build.partitions=minimal esp32maxapp.menu.UploadSpeed.921600=921600 esp32maxapp.menu.UploadSpeed.921600.upload.speed=921600 esp32maxapp.menu.UploadSpeed.115200=115200 esp32maxapp.menu.UploadSpeed.115200.upload.speed=115200 esp32maxapp.menu.UploadSpeed.256000.windows=256000 esp32maxapp.menu.UploadSpeed.256000.upload.speed=256000 esp32maxapp.menu.UploadSpeed.230400.windows.upload.speed=256000 esp32maxapp.menu.UploadSpeed.230400=230400 esp32maxapp.menu.UploadSpeed.230400.upload.speed=230400 esp32maxapp.menu.UploadSpeed.460800.linux=460800 esp32maxapp.menu.UploadSpeed.460800.macosx=460800 esp32maxapp.menu.UploadSpeed.460800.upload.speed=460800 esp32maxapp.menu.UploadSpeed.512000.windows=512000 esp32maxapp.menu.UploadSpeed.512000.upload.speed=512000 esp32maxapp.menu.DebugLevel.none=None esp32maxapp.menu.DebugLevel.none.build.code_debug=0 esp32maxapp.menu.DebugLevel.error=Error esp32maxapp.menu.DebugLevel.error.build.code_debug=1 esp32maxapp.menu.DebugLevel.warn=Warn esp32maxapp.menu.DebugLevel.warn.build.code_debug=2 esp32maxapp.menu.DebugLevel.info=Info esp32maxapp.menu.DebugLevel.info.build.code_debug=3 esp32maxapp.menu.DebugLevel.debug=Debug esp32maxapp.menu.DebugLevel.debug.build.code_debug=4 esp32maxapp.menu.DebugLevel.verbose=Verbose esp32maxapp.menu.DebugLevel.verbose.build.code_debug=5 ############################################################## |
change the .upload.maximum_size to your new app partition size, in the example esp32maxapp.upload.maximum_size=2031616change the esp32maxapp.build.partitions name to your new partition table name, in the example esp32maxapp.build.partitions=maxappchange the esp32maxapp.name name to your new board name, in the example esp32maxapp.name=ESP32 Dev Module MaxAppPartchange the esp32maxapp.build.board name to your new board name, in the example esp32maxapp.build.board=ESP32_DEV_MAXAPP(FOR PLATFORMIO) make a copy of the json file describing the board you cloned, in this example .platformio\platforms\espressif32\boards\esp32dev.json and name it esp32maxapp.json. Change in esp32maxapp.json “variant”: “esp32” to “variant”: “esp32maxapp” “name”: “Espressif ESP32 Dev Module” to “name”: “Espressif ESP32 Dev Module MaxAppPart”. Change “maximum_size”: 1310720 to “maximum_size”: 2031616 and add “partitions”: “partitions” in the build block. Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
{ "build": { "core": "esp32", "extra_flags": "-DARDUINO_ESP32_DEV", "f_cpu": "240000000L", "f_flash": "40000000L", "flash_mode": "dio", "ldscript": "esp32_out.ld", "mcu": "esp32", "variant": "esp32maxapp", "partitions": "partitions" }, "connectivity": [ "wifi", "bluetooth", "ethernet", "can" ], "frameworks": [ "arduino", "espidf" ], "name": "Espressif ESP32 Dev Module MaxAppPart", "upload": { "flash_size": "4MB", "maximum_ram_size": 294912, "maximum_size": <strong>2031616</strong>, "require_upload_port": true, "speed": 115200, "wait_for_upload_port": true }, "url": "https://en.wikipedia.org/wiki/ESP32", "vendor": "Espressif" } |
(FOR PLATFORMIO) change in your projects platformio.ini the entry board = esp32dev to board = esp32maxapp(FOR PLATFORMIO) copy .platformio\packages\framework-arduinoespressif32\variants\esp32 to .platformio\packages\framework-arduinoespressif32\variants\esp32maxapp(FOR ARDUINO IDE) change in menu Tools→Board to Espressif ESP32 Dev Module MaxAppPartReflash your board over USB/Serial







14:42
Thank you for the summary. I followed the first method and it worked as per instructions. I am using Arduino IDE on raspberry pi, for point 3 in Method 1, I have:
PiHome/Arduino/hardware/espressif/esp32/boards.txt
21:44
Thank you for this article. However, how do I reflash HUZZAH32 board? Do I just upload a new Arduino sketch or there is more to it? Thank you.
08:28
Yes, just upload the new sketch.
03:36
Or method -1 Just select from ide “ESP32 Dev Board” and after that select from menu suitable partition table for you.
10:23
Yes, that’s what I refer to in Change partition size (Arduino IDE)
19:32
In method 2 step 5 I needed to add the extension to the partitions definition. So instead of:
“partitions”: “partitions”
it should be:
“partitions”: “partitions.csv”
Without the extension platformio fails with “[.pio\build\esp32doit-devkit-v1\partitions.bin] Source
partition' not found, needed by target
.pio\build\esp32doit-devkit-v1\partitions.bin’.”19:40
Good finding. Thanks for pointing me to this.
00:23
I can’t find, partition scheme in the tools bar.
i am using Arduino 1.8.12
09:18
Might depend on what ESP32 board you selected. For Adafruit ESP32 Feather it is available:
