• When I read the reference documentation relating to file I/O, I get the distinct impression that the files are expected to be hosted on a micro SD card. Are there APIs or technologies associated with Espruino that would allow me to "save" files as data flashed to an area of flash memory?

    For example, on my ESP8266, I have 4MByte of flash storage but I seem to see that only 500K is actually employed for Espruino. That seems to me that I have 3.5MBytes of unutilized flash memory (at least on some ESP8266 boards). I am looking to have an HTTP server serve up some relatively simple static HTML page and I was thinking that if I could have them "flashed", and if there were some kind of API, then I could serve up the content of these "files" from within an Espruino environment.

    Is there some recommended API I should look at? Has anyone walked this path in the past?

  • There's http://www.espruino.com/FlashEEPROM

    That only uses a single page of flash, but could easily be extended to handle multiple pages. What it does do is allow you to use the data directly from flash, without having to load it into RAM first.

    There's also the Flash API so you can always access things directly: http://www.espruino.com/Reference#Flash

    If you're really bothered about 'named' files you could just write your own JS library to handle a simple filesystem - but FlashEEPROM does contain some fancy stuff to help reduce repeated flash erases for things that change frequently.

  • Take a look at this
    It's a very very simple kind of handling files in flash.
    Bad part of the story, its tested on first MB in flash only.
    This is because memory mapping of flash to 0x4020000 is used.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Reading and writing "files" from flash memory from Espruino

Posted by Avatar for Kolban @Kolban

Actions