Best way to store large objects on flash?

greggm
Posts: 9
Joined: Sun May 21, 2017 10:44 am

Re: Best way to store large objects on flash?

Postby greggm » Mon May 22, 2017 10:07 pm

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.
Last edited by greggm on Mon May 22, 2017 10:15 pm, edited 1 time in total.

greggm
Posts: 9
Joined: Sun May 21, 2017 10:44 am

Re: Best way to store large objects on flash?

Postby greggm » Mon May 22, 2017 10:13 pm

one more question:
- what do you mean by "difficult to update the file reliably" ? What challenges would i face using mmap here?

Gregg

Harri.Renney
Posts: 3
Joined: Fri Sep 15, 2017 11:12 am

Re: Best way to store large objects on flash?

Postby Harri.Renney » Wed Apr 25, 2018 10:44 pm

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":

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!

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Best way to store large objects on flash?

Postby burkulesomesh43 » Thu Dec 13, 2018 7:32 am

BuddyCasino wrote:
Sun May 21, 2017 1:29 pm
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?
--
Somesh Burkule

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

Re: Best way to store large objects on flash?

Postby ESP_Sprite » Sat Dec 15, 2018 3:46 am

ESP32 normally doesn't have EEPROM, so it gets stored in flash, in this case as part of the application.

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Best way to store large objects on flash?

Postby burkulesomesh43 » Sat Dec 15, 2018 4:52 am

ESP_Sprite wrote:
Sat Dec 15, 2018 3:46 am
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.
--
Somesh Burkule

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

Re: Best way to store large objects on flash?

Postby ESP_Sprite » Sat Dec 15, 2018 9:54 am

Yes there is. The entirety of rodata should be <=4MiB, so if you only want to store 350K, you're good.

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Best way to store large objects on flash?

Postby burkulesomesh43 » Sat Dec 15, 2018 10:24 am

ESP_Sprite wrote:
Sat Dec 15, 2018 9:54 am
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. :)
--
Somesh Burkule

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: Best way to store large objects on flash?

Postby burkulesomesh43 » Sat Dec 15, 2018 10:34 am

ESP_Sprite wrote:
Sat Dec 15, 2018 9:54 am
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?
--
Somesh Burkule

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

Re: Best way to store large objects on flash?

Postby ESP_Sprite » Sat Dec 15, 2018 12:05 pm

Yes, they effectively count as 'code size'.

Who is online

Users browsing this forum: Gaston1980, Majestic-12 [Bot] and 262 guests