Partitions.csv for Arduino ESP32S3

Hi,

I try to modify the partitions table for my Arduine Nano ESP32S3 project, without any success. My file is in the partitions directory, as a partitions.csv and it is the following:

Name, Type, SubType, Offset, Size, Flags

nvs, data, nvs, 0x9000, 0x6000,
otadata, data, ota, 0xf000, 0x2000,
app0, app, ota_0, 0x20000, 0x600000,
app1, app, ota_1, 0x620000, 0x600000,
spiffs, data, spiffs, 0xc20000, 0x300000,

It is also set in the platformio.ini as:

[env:arduino_nano_esp32]
platform = espressif32
board = arduino_nano_esp32
framework = arduino
monitor_speed = 115200
board_build.mcu = esp32s3
board_build.filesystem = littlefs
board_build.flash_size = 16MB
board_build.partitions = partitions/partitions.csv

The compiler finds this csv file, because when I used the littlefs name instead of the spiffs in the file, I got an error message. Changing to spiffs the project builds smoothly and I can download it. When however I run a small reporting program on the ESP about the existing partitions, I got a completely different setup, as:
=== Application Partitions ===
Name: app0, Type: 0x0, SubType: 0x10, Offset: 0x10000, Size: 0x100000
Name: app1, Type: 0x0, SubType: 0x11, Offset: 0x110000, Size: 0x100000
=== Data Partitions ===
Name: nvs, Type: 0x1, SubType: 0x2, Offset: 0x9000, Size: 0x5000
Name: otadata, Type: 0x1, SubType: 0x0, Offset: 0xe000, Size: 0x2000
Name: spiffs, Type: 0x1, SubType: 0x82, Offset: 0x210000, Size: 0x1d0000
Name: part2, Type: 0x1, SubType: 0x82, Offset: 0x3e0000, Size: 0x20000

I have no idea from this setup arises, as this is not my intendent setup and not any of the setups defined in the .platformio\packages\framework-arduinoespressif32\tools\partitions library.
Does anybody have the idea from where the compiler gets this partition scheme?
Thanks in advance!

Why do you use an extra folder here? Usually the partitions.csv is placed at the same level as the platformio.ini:

.
├── .pio
├── .vscode
├── include
├── lib
├── src
│   └── main.cpp
├── test
├── .gitignore
├── partitions.csv
└── platformio.ini

This partition table doesn’t look optimal. There are “holes” which waste usable memory. But it looks similar to to the default_16MB.cvs. Have you tried this?

This can be removed as it is already set in arduino_nano.esp32.json in line 29

This can be removed, because it is wrong.
The correct setting is board_upload.flash_size and is also already set in arduino_nano.esp32.json in line 45

Well, I’ve tried your suggestions (thank you for them) just now, but nothing has changed :frowning:
I seems to me that there is a “burned-in” partition scheme what I can’t overwrite for whatever reason

Unless you have ‘played around’ with the fuses, nothing like this should happen.

Can you share your project so that I can test it?

Of course! Is it OK if I put the complete project folder onto a shared Google-drive and send you the link to it? If yes, then I can do it tomorrow afternoon.
Meanwhile, let me tell you the background of this project!
As I had to realize, the Arduino Nano ESP32 boards are not able to create a Littlefs file system out of the box. There is a procedure on the Arduino’s site (https://support.arduino.cc/hc/en-us/articles/9810414060188-Reset-the-Arduino-bootloader-on-the-Nano-ESP32) to make the board capable to handling Littlefs.
Before this procedure the standard littlefs test program willl fail at mounting the file system. After executing this procedure the test will run without any problem. I told you this situation because you mentioned the playing around the fuses. Anyway, a dare to hope, that this procedure does not make anything with the fuses.
So, after executing the above descriebed steps, you can use the liitlefs, as you would expect it. The only problem however, that the size of this build is not enough for my application, which is definitely larger than 1 MB. This is the point, where I had to start playing with the partitions files, but without any success, up till now.
Let me thank you in advance, if you can allocate some of your time to help me to solve this problem!
Zsolt

That’s okay. Please try to keep it as simple as possible. Just to reproduce the issue.

LitteleFS can be used out of the box without any problems !?

The steps described in the instructions are generally used to upload new firmware. First, the ESP32 is set to download mode, then the new firmware is uploaded. There is nothing special about this. But this happens usually automatically.

As you can see here the default partition table is app3M_fat9M_fact512k_16MB.csv.
This table defines a 3 MB app partition, 512k factory app partition and 9 MB data partition (FFat).

Here is the link: ESP Upload.zip - Google Drive

The program is very simple, it writes out the partitions after reseting…

The current printout is:
=== Application Partitions ===
Name: app0, Type: 0x0, SubType: 0x10, Offset: 0x10000, Size: 0x100000
Name: app1, Type: 0x0, SubType: 0x11, Offset: 0x110000, Size: 0x100000
=== Data Partitions ===
Name: nvs, Type: 0x1, SubType: 0x2, Offset: 0x9000, Size: 0x5000
Name: otadata, Type: 0x1, SubType: 0x0, Offset: 0xe000, Size: 0x2000
Name: spiffs, Type: 0x1, SubType: 0x82, Offset: 0x210000, Size: 0x1d0000
Name: part2, Type: 0x1, SubType: 0x82, Offset: 0x3e0000, Size: 0x20000

Please post the output of the following sketch

#include <Arduino.h>
#include "esp_partition.h"

void listPartitions() {
  const esp_partition_t   *partition;
  esp_partition_iterator_t partition_iterator = esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
  Serial.println("Name                 | Type  | SubType | Offset     | Size");
  Serial.println("---------------------+-------+---------+------------+-----------");
  while (partition_iterator != NULL) {
    partition = esp_partition_get(partition_iterator);
    Serial.printf("%-20s | 0x%02x  | 0x%02x    | 0x%08x | 0x%08x\n",
                  partition->label,
                  partition->type,
                  partition->subtype,
                  partition->address,
                  partition->size);
    partition_iterator = esp_partition_next(partition_iterator);
  }

  esp_partition_iterator_release(partition_iterator);
}

void setup() {
  Serial.begin(115200);
  listPartitions();
}

void loop() {
}

with the following platformio.ini file:

[env:arduino_nano_esp32]
platform = espressif32 @ 6.9.0
framework = arduino
board = arduino_nano_esp32
monitor_speed = 115200

board_build.partitions = default_16MB.csv
1 Like

The result:

Name                 | Type  | SubType | Offset     | Size      
---------------------+-------+---------+------------+-----------
nvs                  | 0x01  | 0x02    | 0x00009000 | 0x00005000
otadata              | 0x01  | 0x00    | 0x0000e000 | 0x00002000
app0                 | 0x00  | 0x10    | 0x00010000 | 0x00100000
app1                 | 0x00  | 0x11    | 0x00110000 | 0x00100000
spiffs               | 0x01  | 0x82    | 0x00210000 | 0x001d0000
part2                | 0x01  | 0x82    | 0x003e0000 | 0x00020000

Does this also happen using the ArduinoIDE?

I’m running out of ideas…

Well, unfortunately I have no idea, how a custom partitions scheme can be assigned in Arduino IDE. I read a tons of article about this topic, but everybody handles this question like that, what you should know as sooon as you were born. Most of the articles refer to folders, what I can’t even find in my Arduino IDE 2.3.2 installation…
To be honest, I’ve already gone through on a similar siituation about a year ago. The problem was the same: my project was bigger, than 1 MB, so I could not even upload it to the same Arduino Nano ESP32 module. After a long investigation I reached a point, where I installed an Espressif IDE, created a single Hello World program, downloaded it and after this the partitions have changed so that I could upload my bigger, than 1 MB code from the Platformio Arduino environment.
Meanwhile I have uninstalled the Espressif IE, as it was huge and needed an airplane pilot-exam to use it. In case if there is no other solution for this problem, I’ll get a deep breath and install Espressif IDE and try the last way again.
What is however strange for me, that I haven’t found other Arduino Nano ESP32 user, who suffered from the same problem…

In the ArduinoIDE you can choose the partition by selecting them in the menu, but you can’t choose a custom partition table. This is just fur testing why your board doesn’t accept new parition tables via platformio.

Change the partition table and flash the sketch via ArduinoIDE and see if the change has been applied successfully.

There is only one available partition scheme in the IDE for Arduino Nano Esp32


I compiled your code with this setup, but the result remained the same…

The next thing I would try is to erase the entire flash.

PlatformIO Icon / Porject Tasks / Platform / Erase Flash

Then upload the sketch again.