ESP32S3 edits the partition table in the main program

vuthai
Posts: 7
Joined: Tue Nov 28, 2023 5:00 am

ESP32S3 edits the partition table in the main program

Postby vuthai » Wed Apr 03, 2024 3:50 am

Hello, I need to update the partition table to expand the program size via OTA, I tested deleting address 0x8000 spi_flash_erase_sector(8) but it failed, the chip crashed and rebooted so I can't change it partition table.
The way I do it is to check the running program located at OTA0 (0x10000), then change the partition table to expand the size of OTA0 and OTA1 (flash is empty, old OTA size is 1.44MB, need to increase to 1.8 MB).

MicroController
Posts: 1733
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: ESP32S3 edits the partition table in the main program

Postby MicroController » Wed Apr 03, 2024 9:39 pm

OTA updating the partition table is discouraged/unsupported.
If you still want to do it, set menuconfig -> "Component config" -> "SPI Flash driver" -> "Writing to dangerous flash regions" to "Allowed" first.

vuthai
Posts: 7
Joined: Tue Nov 28, 2023 5:00 am

Re: ESP32S3 edits the partition table in the main program

Postby vuthai » Sat Apr 06, 2024 12:37 am

MicroController wrote:
Wed Apr 03, 2024 9:39 pm
OTA updating the partition table is discouraged/unsupported.
If you still want to do it, set menuconfig -> "Component config" -> "SPI Flash driver" -> "Writing to dangerous flash regions" to "Allowed" first.
Thank you for your response, I'm using ardunio, is there any other way like a separate library or programming the registers directly?

RandomInternetGuy
Posts: 52
Joined: Fri Aug 11, 2023 4:56 am

Re: ESP32S3 edits the partition table in the main program

Postby RandomInternetGuy » Thu Apr 18, 2024 9:23 am

You may find joy in writing the alternative partition table (supported) instead of the primary one.

See https://esp32.com/viewtopic.php?f=19&t=35166 for inspiration and enough hints for working code that you should be able to stick the landing. It worked for me.

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

Re: ESP32S3 edits the partition table in the main program

Postby HaJoVe » Thu May 02, 2024 12:57 pm

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.

Who is online

Users browsing this forum: kammutierspule and 123 guests