• Sorry for the delay, I was away last week.

    I've just looked into this and you're right, it's an issue with the page size on Espruino WiFi, but it was just a bug in the StorageFile implementation (trying to use a StorageFile size that'd fit in a page, even when the page was too big). I've just fixed this (it'll now work in 'cutting edge' builds) but it does expose some issues with the WiFi's storage compaction (when storage gets full) due to some changes since 2v06 - I'll try and get those sorted in the next few days.

    So I'd hope that in 2v07 (when released) this'll work great.

    As you say there's 512k of flash though. The issue is that the page sizes on the STM32F4 chip used are 16,16,16,16,64,128,128,128 - I just checked and there's around 50k of flash left at the end after Espruino, but it's in a 128k page, so you could never erase it because you'd end up erasing Espruino.

    You could however use a custom build for Espruino WiFi that cut out some features you weren't using and got the firmware size down enough that you could use the last page, but that's a bit extreme.

    So right now, with the current 2v06 firmware, you could use the standard 'Storage.write' as in the example at: http://www.espruino.com/Reference#l_StorĀ­age_write

    Eg:

    var storage = require("Storage");
    var storageOffset = 0;
    // create file
    storage.write("log","",0,16384);
    function log(msg) {
      storage.write("log",msg,storageOffset);
      storageOffset += msg.length;
      // check for end of log...
    }
    
    log("Hello");
    log("World");
    

    As long as you're not storing too much program code in flash then Espruino 2v06 should be able to compact everything properly when the log files are all erased and you'll be fine.

    But this should all be fixed properly in 2v07.

About

Avatar for Gordon @Gordon started