Hello,
I have requirement to load data into the flash at fix location and then modify that particular flash data with the use of spiffs library.
Can anyone suggest me how can it be possible.?
In other way, Is it possible to load data using flash download tool into spiffs partition area and then modify particular data with spiffs read write operations..?
Thanks.
Modify data of particular location of flash memory using spiffs.?
-
- Posts: 62
- Joined: Wed Apr 19, 2017 6:35 am
Re: Modify data of particular location of flash memory using spiffs.?
It is possible, but it makes no sense. It is like using dd on Linux to modify the part of the mounted file system, the best way to make the file system unusable.
If you need to work with fixed flash memory locations, define separate flash partition and than access it directly using flash functions. That way you can also preload data using flash download tool.
If you need to work with fixed flash memory locations, define separate flash partition and than access it directly using flash functions. That way you can also preload data using flash download tool.
Re: Modify data of particular location of flash memory using spiffs.?
Hi Loboris,loboris wrote:It is possible, but it makes no sense. It is like using dd on Linux to modify the part of the mounted file system, the best way to make the file system unusable.
If you need to work with fixed flash memory locations, define separate flash partition and than access it directly using flash functions. That way you can also preload data using flash download tool.
I and Rahul are working together in one of ESP32 based project.
His concern is like there is one restriction like to delete 4 KBytes chunk to write 2 bytes of data into particular sector of SPI Flash Memory.
So that he first need to read that 4 Kbyte Sector data then modify data at offset whatever he wants to update from that particular section.
So, our requirement is like we have some couple of certificates file whose size is maximum of 1024 byte for individual certificate. So, First it will be loaded externally either like firmware binary into other location or can be loaded into SPIFFS into project.
I think you have did into your LCD based example to load different images into SPIFFS. Correct?
I have checked your updated LCD Repository but failed to execute make makefs command to generate SPIFFS image .img file.
Can you please help us on this?
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Modify data of particular location of flash memory using spiffs.?
Hi Loboris,
We have tested SPIFFS code which is provided in your TFT Library Repository and found one issue.
The issue is like we have added some files externally using mkspiffs binary. After that we have opened one file among them in "w" mode only at that time it seems like another same name file has been created or existing file is deleted and new same name file has been created.
So does it valid way to recreate same name file and delete older file if same name file has been opened with write mode?
Let me know if need any information from my side.
We have tested SPIFFS code which is provided in your TFT Library Repository and found one issue.
The issue is like we have added some files externally using mkspiffs binary. After that we have opened one file among them in "w" mode only at that time it seems like another same name file has been created or existing file is deleted and new same name file has been created.
So does it valid way to recreate same name file and delete older file if same name file has been opened with write mode?
Let me know if need any information from my side.
Regards,
Ritesh Prajapati
Ritesh Prajapati
Re: Modify data of particular location of flash memory using spiffs.?
I'm not sure if I understand what is the problem.
Look at: https://www.tutorialspoint.com/c_standa ... _fopen.htm
Look at: https://www.tutorialspoint.com/c_standa ... _fopen.htm
You can also check https://github.com/loboris/ESP32_spiffs_example, there are more examples of file read/write..."w" mode creates an empty file for writing. If a file with the same name already exists, its content is erased and the file is considered as a new empty file.
Re: Modify data of particular location of flash memory using spiffs.?
Hi,loboris wrote:I'm not sure if I understand what is the problem.
Look at: https://www.tutorialspoint.com/c_standa ... _fopen.htm
You can also check https://github.com/loboris/ESP32_spiffs_example, there are more examples of file read/write..."w" mode creates an empty file for writing. If a file with the same name already exists, its content is erased and the file is considered as a new empty file.
Sorry, I just need to confirm mode again that it's rw mode or only w mode and then will get back to you.
Regards,
Ritesh Prajapati
Ritesh Prajapati
-
- Posts: 62
- Joined: Wed Apr 19, 2017 6:35 am
Re: Modify data of particular location of flash memory using spiffs.?
Hello,
The issue was that I was using "w+" mode for modifying existing file instead of "r+"mode, so the existing file was getting truncated to zero. It is solved now.
Thanks.
The issue was that I was using "w+" mode for modifying existing file instead of "r+"mode, so the existing file was getting truncated to zero. It is solved now.
Thanks.
Who is online
Users browsing this forum: Bing [Bot] and 147 guests