I would like to save data to Flash only on the main board of the Presense.
The Arduino SDK has an EEPROM library, but it does not appear to be in the Presence SDK.
If possible, I would appreciate it if you could tell me how to do it with the Spresense SDK.
I found the following code in camera_main.c
/*In SD card is available, use SD card.
* Otherwise, use SPI flash.
*/
ret = stat("/mnt/sd0", & stat_buf);
if(ret<0)
{
save_dir="/mnt/spif";
}
else
{
save_dir="/mnt/sd0";
}
As a trial, I created the file below /mnt/spif, but it didn't disappear even when I turned it off/on, so I think it's probably okay.
I am in charge of SPRESENSE support for Sony.
I would like to reply to your inquiry.
As you have already checked, /mnt/spif
has been allocated Flash space.
For example, you can access the file "hoge.txt" with the pathname "/mnt/spif/hoge.txt".
You can use C-language standard functions such as fopen
, fwrite
, fread
, and fclose
.
Here are some simple examples of the program:
# include FILE*fp; fp = fopen("/mnt/spif/hoge.txt", "w"); fwrite(buf,size,n,fp);// Write fclose(fp); fp = fopen("/mnt/spif/hoge.txt", "r"); fread(buf,size,n,fp); // Read fclose(fp);
Thank you for your continued support for the Presense.
© 2024 OneMinuteCode. All rights reserved.