Change partition size

[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 postChange 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:

  1. 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 boards
  2. create 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 board
  3. clone 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:

A partition table with maximum size for the application and no EEPROM and SPIFFS partition could look like:

Another example with a small EEPROM and SPIFFS partition:

Method 1

  1. Change the entries of default.csv to your desired partition sizes. (See paths above)
  2. 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)
  3. 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)
  4. Reflash your board over USB/Serial

Method 2

[Reference issue 703] from @delcomp

  1. Make a copy of esp32/tools/partitions/default.csv and rename it (my example partitions.csv) (See paths above)
  2. Make the required changes
  3. Open esp32/boards.txt and find the board (<YOUR_BOARD_NAME>)you are using
  4. Make the following changes (size depends on your configuration)

  1. In .platformio\platforms\espressif32\boards edit esp32dev.json (or whatever board you are using) and add “partitions”: “partitions” into the build object. It should look like

  1. 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.

  1. Make a copy of default.csv and rename it (my example partitions.csv)
  2. Make the required changes
  3. In 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. change the .upload.maximum_size to your new app partition size, in the example esp32maxapp.upload.maximum_size=2031616
  2. change the esp32maxapp.build.partitions name to your new partition table name, in the example esp32maxapp.build.partitions=maxapp
  3. change the esp32maxapp.name name to your new board name, in the example esp32maxapp.name=ESP32 Dev Module MaxAppPart
  4. change the esp32maxapp.build.board name to your new board name, in the example esp32maxapp.build.board=ESP32_DEV_MAXAPP
  5. (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. (FOR PLATFORMIO) change in your projects platformio.ini the entry board = esp32dev to board = esp32maxapp
  2. (FOR PLATFORMIO) copy .platformio\packages\framework-arduinoespressif32\variants\esp32 to .platformio\packages\framework-arduinoespressif32\variants\esp32maxapp
  3. (FOR ARDUINO IDE) change in menu Tools→Board to Espressif ESP32 Dev Module MaxAppPart
  4. Reflash your board over USB/Serial

 

Loading...
Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail

One comment

  • Buddy Scottie

    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

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Free Link Directory