ESP-12E [ERASED] error

Posted on
  • Hi,

    I've been flashing ESP's for ages with Espruino and this is the first time I've seen this.

    I've got a really simple bit of code:

    function main() {
     var BTN = 12;
      var rgb = new Uint8ClampedArray(3*3);
      var pos = 0;
      function getPattern() {
        for (var i=0;i<rgb.length;) {
          rgb[i++] = (1 + Math.sin((i+pos)*0.1324)) * 127;
          rgb[i++] = (1 + Math.sin((i+pos)*0.1654)) * 127;
          rgb[i++] = (1 + Math.sin((i+pos)*0.1)) * 127;
        return rgb;
      setInterval(function() {
        require("neopixel").write(14, getPattern());
      }, 100);
    pinMode(12, 'input_pullup');
      setWatch(function(e) {
        console.log('bttn pressed');
      }, 12, { repeat: true, debounce:100, edge: 'falling' });
    E.on('init', main);

    Just to flash some LED's and listen to a button press, and if I type save in the console to store the code, I just get an endless loop of errors reading this:

    in function called from system
    Uncaught SyntaxError: Got [ERASED] expected EOF
    at line 1 col 1

    I'm sure I'm flashing the correct firmware (the V2.08 4mb ESP8266 version)

    Any ideas?



  • Thr 2021.03.25

    While not tested, it appears to be a Javascript rules violation, L6 function defined within a separate defined function.

    EDIT Thr 2021.04.01
    While unsuccessful at finding a specification reference, my comment above is true while in strict mode, and it is strongly suggested Not to create an inner function declaration.Ā­/Web/JavaScript/Reference/Functions

    see heading 'Block-level functions in non-strict code' 'In a word: Don't.'

  • @Ruprect99 I've had this before a few times and it generally seems to point to some flash corruption?

    I find that typing "reset(1) -> save()" (could also be "reset(0)") seems to force some kind of clean up algorithm (flash compacting?). That might resolve it.

    But the sure way to deal with it is just to reflash the firmware. Make sure to use the "erase_flash" option in esptool before doing so though, just to ensure you reformat the entire flash address space.

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

ESP-12E [ERASED] error

Posted by Avatar for Ruprect99 @Ruprect99