• Is it planed to have clear() to erase saved program code ?

  • No... reset() then save() has almost the same effect.

    What's list()? Or did you mean load()?

  • ups, yes I mean load()

    can you please change the title ?

  • No problem :)

  • reset() then save() has almost the same effect... as a clear() would have.

    Would it be possible to actually make it this way? ...because after a first save() on a flashed Espruino reset() always leaves residues. Only a re-flash gets you back to the realy clean slate... state. The startup is different with the residues.

    What ere these few hundred bytes that still are saved anyway after a reset ()?

  • AFAIK, some bytes are still occupied holding the (command) history for the Web IDE.

    Source: http://forum.espruino.com/comments/12713­514/

    Also, try adding: global["\xFF"].history=[];
    It's a hack but it removes the command history - something that could have been using memory that would have stopped you saving.

  • After reset();save(); the only command history left will be that of you typing save(). While there may seem to be a few hundred bytes used most of that is just an artefact of compressing ~80kB of zeros.

    I think you'll find that reset();save() reports almost exactly the same number of bytes used as if you just flashed a fresh Espruino image and typed save()

  • On ESP8266 there are some lines of code after reset() coming from jshReset(), so reset();save(); is not a appropriate option.

    The reason behind this is, that saved code caused trouble on ESP8266 when updating to a new release in the past. Sure "erase_flash" is an option, but works only over serial connection AFAIK.

    But require("Flash").erasePage(addr); will do.

    So this is my clear();

    var clear = function() {
    No code in flash!

    I purposely did not name addr. If this is helpful for you, than lookup it up at the Espruino ESP8266 board documentation page section "SAVING CODE TO FLASH"

  • Thanks - if you want to do it when you flash a new firmware, you could just add a line to flash blank.bin to the correct place to overwrite your saved code.

    If we had a 1Mb image file that could just be written to the device (like you can with the 512k one) it'd solve a lot of this trouble

  • On the ESP8266 side you normarly use wiflash :-)

    This is a ota implementation - the easiest way to flash the ESPs with new firmware.

  • A 1MB file would damage a lot of sections with special ESP setting, what causes a bricked ESP that has to be flash with the original AT firmware to unbrick.

  • Are you sure about that? The 512k combined image works perfectly

  • Not sure, I only know for sure that there is a size limit of 479232 bytes for a single image file for ESPs.

  • just changed the tile because with 1v94 reset(true) is the one that can be used to erase save pages.

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

save(); dump(); load(); what about clear() -> use reset(true)

Posted by Avatar for MaBe @MaBe