Partition scheme not working

Hey everyone,

I’m stuck with a pretty annoying issue on PlatformIO while working with an ESP32 chip and ESP-IDF. No matter what I try, I can’t seem to change the partition scheme from the default 1MB setup. I’ve tried using both the built-in schemes and a custom one, but nothing seems to work. PlatformIO just keeps defaulting to the 1MB partition, which is way too small for what I need.

Has anyone else bumped into this? How do you get PlatformIO to actually use a different partition scheme for ESP32 on ESP-IDF? I’m probably missing something obvious, but I’m at a loss here.

platformio.ini

[env:lolin32]
platform = espressif32
board = lolin32
framework = espidf
upload_port = COM5
monitor_speed = 115200
upload_speed = 115200
[env:custom_table]
board_build.partitions = default.csv

skconfig

# Partition Table
#
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="default.csv"
CONFIG_PARTITION_TABLE_FILENAME="default.csv"
CONFIG_PARTITION_TABLE_OFFSET=0x8000
CONFIG_PARTITION_TABLE_MD5=y
# end of Partition Table

default.csv

# 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,
spiffs,   data, spiffs,  0x290000,0x160000,
coredump, data, coredump,0x3F0000,0x10000,

I’m not familliar with esp-idf programming but the documentation recommends “partitions.csv” as name. See Project Configuration - ESP32 - — ESP-IDF Programming Guide latest documentation.

I suspect that there may be a naming conflict when using “default.csv”.

Thank you for your suggestion! I’ve already tried renaming my partition file to partitions.csv as recommended by the ESP-IDF documentation to see if that resolves the issue, but unfortunately, it didn’t make any difference. PlatformIO still defaults to the 1MB partition scheme despite the changes.
Error: The program size (1270337 bytes) is greater than maximum allowed (1048576 bytes)
My partition should be enought or I am wrong

I missed that you have a separate environment for this where only the partition table is specified, nothing else. Is there a specific reason for this?

Add the line to your lolin32 environment and try again.

Hello.
My environment is a little different from yours, but I have experienced and solved the same troubles as you.
(my environment is VSCODE+Platformio, but I think the basics are the same)
I would like to introduce it to you. Please refer to it.

Platformio refers to .json file to determine the partitions for your board that you mentioned in platformio.ini. of your project.
Even if you wrote the partition information file “***.csv” in the platformio.ini, it was not referenced. (I’m not quite sure why)

Two files are significant:

  1. (yourboard).json file that describes the characteristics of the board
  2. (yourpartition).csv file.

There are four steps required:

  1. Prepare (yourboard).json.
  2. Prepare (yourpartition).csv.
  3. Modify platformio.ini file of your project.
  4. Reopen the project.

Each of the above items is described below.
1. Prepare your (yourboard).json.
(1) First, look for “.platformio”, which is the folder created when you install platformio.
In my case it was under "C:".
(2) Next, please find the folder below.
.platformio\platforms\espressif32\boards
There are a lot of (board) .json in this folder, so you can find the .json file that you want. From the contents of the platformio.ini, I think it is probably “lolin32.json”.
(3) In order to customize the .json file, copy the .json file found in (2) with another suitable name (let’s call it “lolin32-tapirlan.json” for example).
(4) Open lolin32-tapirlan.json with a text editor, add “partitions” and modify “name” as shown below.

Note that .json files cannot be commented.
{
“build”: {
“arduino”:{
“ldscript”: “esp32_out.ld”, ← add “,” to the end of the line
“partitions”: “(yourpartition).csv” ← insert this

“name”: “WEMOS LOLIN32-tapirlan”, ← Be careful not to duplicate anything else

2. Prepare (yourpartition).csv.
Make sure that the file name is unique and that it is stored in the folder where the default.csv is located.
(e.g. below)
.platformio\packages\framework-arduinoespressif32\tools\partitions

  1. Modify the platformio.ini of your project.
    To reflect the changes in the current project, modify the description of the board as follows:

board = lolin32-tapirlan

Note that
board_build.partitions = default.csv
will be ignored if you write it, so please delete or comment it out.

  • When creating a new project, select “lolin32-tapirlan” according to the .json file created above when selecting the board. You should be able to refer to it, so select it.
    Check the contents of the auto-generated platformio.ini.
  1. Reopen the project.
    If you modify a platformio.ini, save all changes and then close and restart the project.

As you may have noticed, by changing the contents of the (yourboard).json ,
you can support PSRAM , configure the handling of USB ports, etc…
I’m not familiar with the description of .json files, but for the board settings, this .json file is very important, I think.