Page 2 of 3
Re: Best way to store large objects on flash?
Posted: Mon May 22, 2017 10:07 pm
by greggm
Thanks for the very usefull comparison.
Partition api seems to be the best fit so far since it seems to be low memory cost and should cover my case with saving a few large objects (images) of same size, especially using mmap seems compelling.
2 more questions, though:
- are there any compelling
examples using the
partition_read/write and partition_mmap functions other than the test file at
https://github.com/espressif/esp-idf/bl ... artition.c
If not... would i use the methods exacly as it is done in the test?
- is any of the flash write methods capable of saving non primitve typed data, e.g.
data stored in a struct. In my case i would like to use rgbVal from the ws2812 library - my workaround was to serialize data into an array of uint8[3] and do the conversion where required.
Re: Best way to store large objects on flash?
Posted: Mon May 22, 2017 10:13 pm
by greggm
one more question:
- what do you mean by "difficult to update the file reliably" ? What challenges would i face using mmap here?
Gregg
Re: Best way to store large objects on flash?
Posted: Wed Apr 25, 2018 10:44 pm
by Harri.Renney
If you only need a single immutable file, theres also the option of letting the build embed it.
Example for a file called "what_time.raw":
Code: Select all
/* embedded file */
extern uint8_t file_start[] asm("_binary_what_time_raw_start");
extern uint8_t file_end[] asm("_binary_what_time_raw_end");
component.mk:
Code: Select all
COMPONENT_EMBED_FILES := what_time.raw
Thanks for this point. Very helpful for another area I am working in!
Re: Best way to store large objects on flash?
Posted: Thu Dec 13, 2018 7:32 am
by burkulesomesh43
If you only need a single immutable file, theres also the option of letting the build embed it.
Example for a file called "what_time.raw":
Code: Select all
/* embedded file */
extern uint8_t file_start[] asm("_binary_what_time_raw_start");
extern uint8_t file_end[] asm("_binary_what_time_raw_end");
component.mk:
Code: Select all
COMPONENT_EMBED_FILES := what_time.raw
if we use files it like this then where it will be stored.
in flash,EEPROM or it comsumes code size?
Re: Best way to store large objects on flash?
Posted: Sat Dec 15, 2018 3:46 am
by Sprite
ESP32 normally doesn't have EEPROM, so it gets stored in flash, in this case as part of the application.
Re: Best way to store large objects on flash?
Posted: Sat Dec 15, 2018 4:52 am
by burkulesomesh43
ESP32 normally doesn't have EEPROM, so it gets stored in flash, in this case as part of the application.
I read it on forum that this embedded files stored in rodata of flash.
so is there limit in flash rodata to store files, beacause I want to store 350kb of files in flash.
Re: Best way to store large objects on flash?
Posted: Sat Dec 15, 2018 9:54 am
by Sprite
Yes there is. The entirety of rodata should be <=4MiB, so if you only want to store 350K, you're good.
Re: Best way to store large objects on flash?
Posted: Sat Dec 15, 2018 10:24 am
by burkulesomesh43
Yes there is. The entirety of rodata should be <=4MiB, so if you only want to store 350K, you're good.
Ok. thank you very much.

Re: Best way to store large objects on flash?
Posted: Sat Dec 15, 2018 10:34 am
by burkulesomesh43
Yes there is. The entirety of rodata should be <=4MiB, so if you only want to store 350K, you're good.
Heyy ,
I have used component embed files. but my code size is increased.
How's that?
Re: Best way to store large objects on flash?
Posted: Sat Dec 15, 2018 12:05 pm
by Sprite
Yes, they effectively count as 'code size'.