• This function returns a memory-mapped String that points to the actual memory area in read-only memory, so it won't use up RAM...If you evaluate this string with eval, any functions contained in the String will keep their code stored in flash memory.
    https://github.com/espruino/Espruino/blo­b/master/src/jswrap_storage.c#L92

    It seems that require("Storage").read actually accessing the data directly from flash in bangle with RAM less.
    But,i saw the post https://forum.espruino.com/comments/1500­9857/

    Gordon
    Sadly no, it has to load into RAM (at least at the moment) since the flash is external. It does it in the idle loop though so can make use of a bunch of execution stack and save using as much program memory.

    So, I confused about require("Storage").read RAM less or RAM more

    Another confusing thing is the returned data between require("Storage").read with A string of data and require("Flash").read with A Uint8Array of data, whitch from extranal flash both.

    thx!

  • So, I confused about require("Storage").read RAM less or RAM more

    It's as the docs say - it doesn't use RAM, it just returns a memory-mapped String pointing to flash.

    I believe that comment was about Tensorflow. Tensorflow is unable to work directly from the flash memory so in Tensorflow's case you have to load from Flash into RAM.

    returned data between require("Storage").read with A string of data and require("Flash").read with A Uint8Array of data

    require("Flash").read actually loads straight into RAM, but require("Storage").read doesn't.

    Realistically there's not really much of a case where you should be using require("Flash") now, unless you're doing something very low level

  • thank you!!!

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

Storage.read vs Flash.read ? bangle Storage based the extranal flash

Posted by Avatar for tyronehell @tyronehell

Actions