Best way to store large objects on flash?
Re: Best way to store large objects on flash?
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.
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.
Last edited by greggm on Mon May 22, 2017 10:15 pm, edited 1 time in total.
Re: Best way to store large objects on flash?
one more question:
- what do you mean by "difficult to update the file reliably" ? What challenges would i face using mmap here?
Gregg
- what do you mean by "difficult to update the file reliably" ? What challenges would i face using mmap here?
Gregg
-
- Posts: 3
- Joined: Fri Sep 15, 2017 11:12 am
Re: Best way to store large objects on flash?
Thanks for this point. Very helpful for another area I am working in!BuddyCasino wrote: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":component.mk: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");
Code: Select all
COMPONENT_EMBED_FILES := what_time.raw
-
- Posts: 132
- Joined: Tue Aug 14, 2018 6:21 am
- Location: India
Re: Best way to store large objects on flash?
if we use files it like this then where it will be stored.BuddyCasino wrote: ↑Sun May 21, 2017 1:29 pmIf 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":component.mk: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");
Code: Select all
COMPONENT_EMBED_FILES := what_time.raw
in flash,EEPROM or it comsumes code size?
--
Somesh Burkule
Somesh Burkule
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: Best way to store large objects on flash?
ESP32 normally doesn't have EEPROM, so it gets stored in flash, in this case as part of the application.
-
- Posts: 132
- Joined: Tue Aug 14, 2018 6:21 am
- Location: India
Re: Best way to store large objects on flash?
I read it on forum that this embedded files stored in rodata of flash.ESP_Sprite wrote: ↑Sat Dec 15, 2018 3:46 amESP32 normally doesn't have EEPROM, so it gets stored in flash, in this case as part of the application.
so is there limit in flash rodata to store files, beacause I want to store 350kb of files in flash.
--
Somesh Burkule
Somesh Burkule
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: Best way to store large objects on flash?
Yes there is. The entirety of rodata should be <=4MiB, so if you only want to store 350K, you're good.
-
- Posts: 132
- Joined: Tue Aug 14, 2018 6:21 am
- Location: India
Re: Best way to store large objects on flash?
Ok. thank you very much.ESP_Sprite wrote: ↑Sat Dec 15, 2018 9:54 amYes there is. The entirety of rodata should be <=4MiB, so if you only want to store 350K, you're good.
--
Somesh Burkule
Somesh Burkule
-
- Posts: 132
- Joined: Tue Aug 14, 2018 6:21 am
- Location: India
Re: Best way to store large objects on flash?
Heyy ,ESP_Sprite wrote: ↑Sat Dec 15, 2018 9:54 amYes there is. The entirety of rodata should be <=4MiB, so if you only want to store 350K, you're good.
I have used component embed files. but my code size is increased.
How's that?
--
Somesh Burkule
Somesh Burkule
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: Best way to store large objects on flash?
Yes, they effectively count as 'code size'.
Who is online
Users browsing this forum: artisdom, Sang_Huynh and 203 guests