Good afternoon,
I am working on a project using an Esp32s3 chip.
I have defined a "partitions.csv" file with the following partitions :
nvs, data, nvs, 0x9000, 0x4000,
otadata, data, ota, 0xd000, 0x2000,
phy_init, data, phy, 0xf000, 0x1000,
Form, data, , 0x10000, 0x1000,
FormMirror, data, , 0x11000, 0x1000,
storage, data, fat, , 1M,
ota_0, app, ota_0, , 2M,
ota_1, app, ota_1, , 2M,
I have removed the factory partition, so my application is automatically downloaded into ota_0 partition while flashing.
In my program, I would like to define a structure for example :
struct MyStruct
{
uint8_t Var1;
uint8_t Var2;
uint8_t Var3;
}
And I would like to do a : const struct MyStruct structure1; so that the structure 1 is not placed into the ota_0 partition but in
the Form partition (Memory section).
Do you know how to do it please ?
Using other microcontrollers (Renesas), I know that I can do that using memory sections.
Unfortunately, I don't know how to do it with Espressif chips.
Could you please explain me how to do it ?
Best regards,
Thomas TRUILHE
ESP-IDF : Esp32S3 - How to place constants into partitions
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
-
- Posts: 9739
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP-IDF : Esp32S3 - How to place constants into partitions
ESP-IDF doesn't have a native solution for exactly what you want. You could do this generally using the esp_partition_mmap function and casting the resulting pointer to a MyStruct. Note that if you also want to be able to write to these variables, we'd suggest using the nvs api instead.
-
- Posts: 229
- Joined: Thu Jul 14, 2022 5:15 am
Re: ESP-IDF : Esp32S3 - How to place constants into partitions
Yes, I have found the NVS library and I think I will use it.
However, I would like to know if there is the possibility to define memory sections
in a linker script and to put constants in it directly in my program.
I did it on Renesas microcontrollers using the pragma attribute section keyword.
It enabled me to put constants in the FlashMem without using NVS library.
Moreover, in order to update my constants in FlashMem I called flash_write function.
Do you think it is possible on Espressif MCUs ?
I have found article about Linker scripts but without any clear examples.
So, I have not understood exactly how to deal with it.
Best regards,
However, I would like to know if there is the possibility to define memory sections
in a linker script and to put constants in it directly in my program.
I did it on Renesas microcontrollers using the pragma attribute section keyword.
It enabled me to put constants in the FlashMem without using NVS library.
Moreover, in order to update my constants in FlashMem I called flash_write function.
Do you think it is possible on Espressif MCUs ?
I have found article about Linker scripts but without any clear examples.
So, I have not understood exactly how to deal with it.
Best regards,
-
- Posts: 9739
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP-IDF : Esp32S3 - How to place constants into partitions
Not easily, sorry; implementing that in ESP-IDF would likely require quite a bit of ungodly hacking of the build / link system
Who is online
Users browsing this forum: Majestic-12 [Bot] and 97 guests