Partitioning ESP32

jespertp
Posts: 3
Joined: Thu Apr 18, 2024 1:11 pm

Partitioning ESP32

Postby jespertp » Thu Apr 18, 2024 1:17 pm

Hi,

I need to change the partitions of my ESP32 filesystem, to support larger app.
I need OTA..
My board has 4MB flash.

I come up with this, but I'm not sure this is correct, and will support my needs?

Image
Attachments
partitions.png
partitions.png (22.75 KiB) Viewed 2363 times

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: Partitioning ESP32

Postby ESP_Sprite » Fri Apr 19, 2024 1:19 am

If you need OTA, you need two OTA partitions, ideally of the same size. (The factory partition is not required for OTA, though, so unless you know you need a factory partition, you can convert that into an OTA partition, giving you two 1.5MiB-sized OTA partitions.)

Do you need to store files into internal flash? If not, you can also get rid of the spiffs partition.

jespertp
Posts: 3
Joined: Thu Apr 18, 2024 1:11 pm

Re: Partitioning ESP32

Postby jespertp » Fri Apr 19, 2024 6:31 am

Okay, I don't think I need the factory, so I will try to make two ota partitions. Like this?:

Image

I was planning to use the spiffs to save a config file. Would that nok be a good place to store it?
Attachments
partitions.png
partitions.png (23.04 KiB) Viewed 2257 times

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: Partitioning ESP32

Postby ESP_Sprite » Fri Apr 19, 2024 8:31 am

Dependent on what configuration you need, nvs could also be a good place to store it.

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: Partitioning ESP32

Postby lbernstone » Fri Apr 19, 2024 8:32 am

There is also a pre-built called 'Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)'
https://github.com/espressif/arduino-es ... spiffs.csv

jespertp
Posts: 3
Joined: Thu Apr 18, 2024 1:11 pm

Re: Partitioning ESP32

Postby jespertp » Fri Apr 19, 2024 9:01 am

ESP_Sprite wrote:
Fri Apr 19, 2024 8:31 am
Dependent on what configuration you need, nvs could also be a good place to store it.
The plan is to just store an .json file...

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: Partitioning ESP32

Postby ESP_Sprite » Fri Apr 19, 2024 11:44 am

If the JSON is a single key/value store, you'd probably best off using the NVS (or specifically for Arduino, the 'preferences' library) rather than a spiffs. Just take the keys that you would put into the JSON file and feed them into the Preferences lib instead.

HaJoVe
Posts: 2
Joined: Wed May 01, 2024 2:22 pm

Re: Partitioning ESP32

Postby HaJoVe » Sat May 04, 2024 6:22 am

Hello,

I have programmed several ESP32 Devkit C V4 and ESP32 S3 DevKitC 1 N16R8 with the Arduino IDE version 2.x. In some projects, customization of the partition table was required.
There are some instructions on the Internet on the subject of partition tables, but they are quite complex to use.
I studied the topic intensively and wrote my own program in C#.
Below I show a few excerpts from the program description.
The program can be switched between “German” and “English”.
The program does not change the Arduino IDE system file, but rather adds the file “boards.local.txt” to the Arduino IDE.
When the Arduino IDE version is updated, the “boards_local.txt” file is deleted.
Since the program saves the changes and adjustments made, the new Arduino IDE version can be quickly adapted.
If you are interested I can send you a link to download.

Excerpts from the program description:

For programming the “ESP32 Dev Kit C V4“ Modules, these settings are usually sufficient.
The chosen partition scheme divides the flash memory available on the module into 1.2MB for a sketch and another 1.5MB for the SPIFFS file system.
The Arduino IDE offers a limited number of partition tables to choose from.
If none of the selectable partition tables fits the planned task, a new table must be created or an existing one must be adapted.
For example, if it is necessary to save files for a website with 2MB in the SPIFF area, then the flash memory must be divided differently.
When using the new boards from Espressif (e.g. ESP32S3 Devkit 1), which are equipped with up to 32MB of flash memory, the partitioning of the flash memory is an important issue.

On the Internet you can find various solutions for creating and integrating your own partition tables. In Arduino versions 1.8.x it was possible to integrate plugins into the IDE.
This is currently not possible in versions 2.x.x.
Most instructions for generating your own partition tables are explained using examples.
The descriptions are helpful, but there was no “simple” version among them.
On the Internethttps://arduino.github.io/arduino-cli/0.27/platform-specification/ You can find detailed instructions for the Arduino IDE. The “Platform specification” position describes the structure of the platform – configuration files.

(1) platform.txt contains definitions for the CPU architecture used (compiler, build
Process parameters, tools used for upload, etc.)

(2) boards.txt contains definitions for the boards (board name, parameters for creation and
Uploading sketches etc.)

(3) boards.local.txt Introduced in Arduino IDE 1.6.6. This file can be used to in
properties specified in the configuration file [boards.txt].
write or define new properties without making changes in the
Configuration file [boards.txt] is required.

(4) programmers.txt contains definitions for external programming tools
(usually used for burning bootloaders or sketches on an empty CPU/board is used).

The board parameters are contained in the configuration file “boards.txt”. This also includes the partition tables.
The configuration files [platform.txt], [boards.txt] and [programmers.txt] are provided when installing the ESP32 builder version of Espressif.

Based on the analysis of the configuration file “boards.txt”, a program was developed that makes it easier to generate your own partition tables and eliminates addressing errors.
The name of the program is “ESP32 Board & Partition”. The program only creates or changes the configuration file [boards.local.txt]

The program offers the following features:

(1) Creating a new partition table that can be exported as a *.csv file for free use.
(2) Creating a new partition table that can be mapped to an ESP32 board and integrated directly into the Arduino IDE.
(3) Adjust the selection list of ESP32 boards for the Arduino IDE.
(4) Create your own, new ESP32 board including allocation of partition tables that can be integrated directly into the Arduino IDE.

The program creates and modifies the configuration file [boards.local.txt].
The configuration files provided when installing the ESP32 builder version of Espressif arenot changed.
The program can be used to create partition projects and save created partition tables or new boards.
Saved partition projects can restore the user state after an ESP32 Builder update.
To use the functions (2)...(4) the installation of an Arduino IDE version V2.x is required.

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: Partitioning ESP32

Postby lbernstone » Sun May 05, 2024 4:56 pm

A program is nice, but partitioning is really not that complicated, and is documented.

Who is online

Users browsing this forum: No registered users and 37 guests