Extending storage module #6775
Replies: 1 comment
-
Posted at 2024-04-15 by @gfwilliams Is this mainly for ESP32 usage? I can't imagine many other devices where this makes too much sense? Using external flash would be neat but you'd have to be able to supply external read/write functions too. But I guess possibly it could be done, although right now none of the functions take an instance parameter so doing Posted at 2024-04-15 by @MaBecker
YES, other devices do not have the posibility of flash segmentation. Only ESPs have extra flash areas.
Yes, that is the other option we have ;-) Posted at 2024-04-15 by @fanoush
So how many there are? The second area currently supported is configured like this Then when creating file one of them is "filename" and the other is using C: driver letter like "c:filename" (forgot which one is default). When reading file both areas are searched for the file name so it is some kind of overlay. The idea was to not really have two separate 'disks' but one merged from both areas. The code is in common layer Posted at 2024-04-15 by @MaBecker Many thanks fanoush, very interesting feature! I missed the espruino command line tool that can upload files to storage via myfile.js containing a save to storage command with the wanted content. So all fine. Posted at 2024-04-23 by user158016 So can we use spiffs or any other way to load files to storage? Can this be done, or what needs to happen for it? Posted at 2024-04-23 by @fanoush
The Storage https://www.espruino.com/Reference#Storage already has its own simplified filesystem so no spiffs is needed/possible there. The main feature of Storage is that each file takes continuous area of flash and files are directly mappable to some memory address. The disadvantage is that you cannot append to such file or overwrite existing data, you need to create it with some size and either fill it with data completely at creation time or write only to areas not written yet = bytes with all bits set (0xff = 255). So it is something between low level flash access and simplified filesystem. Then there is a hybrid on top of it https://www.espruino.com/Reference#StorageFile which can append but cannot write/contain 0xff=255 bytes. But while it is limited as described it can work just fine for serving text files with webserver. Posted at 2024-04-23 by @MaBecker No spiff, because it is not necessary, the method you can use is described in #5 Posted at 2024-04-23 by user158016 Can you please give an example on how to do this? That would be great. Posted at 2024-04-23 by @MaBecker see this conversation Howto write modules to storage? Posted at 2024-04-23 by @gfwilliams and you can just load the file as a string with |
Beta Was this translation helpful? Give feedback.
-
Posted at 2024-04-13 by @MaBecker
Would it be possible to extend the storage module to
use
require("storage", options)
to use storage for external flash storage or specific flash area?prep storage content offline like possible for spiff?
upload offline content to a specific flash are?
Any further ideas how storage could be extended?
Beta Was this translation helpful? Give feedback.
All reactions