"No code in Flash"

Posted on
  • I came across a few times with the same error: "No code in Flash" when I toggle power of ESP-12. This time root of the problem is the code size. If I remove some part of application code, it loads and executes well, and it starts on power toggle. If I re-add that part of (unimportant) code, my application works OK, but it doesn't start when power is toggled. If load() function is executed, it prints "No code in Flash":

     _____                 _ 
    |   __|___ ___ ___ _ _|_|___ ___ 
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v86.171 Copyright 2016 G.Williams
    
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
    
    >load()
    =undefined
    No code in flash!
    

    Since ESP-12 has 4MB of flash memory, it shouldn't related with memory or application size, right?

  • I wonder what is meant by 512/512 in the message area on line 11? I also believe that the latest Espruino is 1v87 ... something might have improved in a later release?

  • can you post what save() prints? there is a marker at the end of the save area IIRC and perhaps the calculation is incorrect and it overwrites it.

  • Successful save prints:

    >save()
    =undefined
    Erasing Flash.....
    Writing...................
    ERROR: Too big to save to flash (16984 vs 12284 bytes)
    Deleting command history and trying again...
    Erasing Flash.....
    Writing..............
    Compressed 27200 bytes to 11492
    Checking...
    Running onInit()...
    

    Unsuccessful save prints:

    >save()
    =undefined
    Erasing Flash.....
    Writing....................
    ERROR: Too big to save to flash (18205 vs 12284 bytes)
    Deleting command history and trying again...
    Erasing Flash.....
    Writing...............
    ERROR: Too Running onInit()...
    
    
  • Hmm, looks like it might be crashing after failing the second time.

    On ESP8266 there are only a few pages reserved for saved code in the first 512kB flash though (I guess to make it work the same with all ESP8266 boards). It looks like there's too much code to fit into what's available (3 x 4k pages?). It might be possible to shift stuff around but it looks like memory is tight at the moment as-is.

  • Yup, looks like there is a bug when the save size is too big. You are correct about the 3x 4KB pages.

  • Will it survive? :)

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

"No code in Flash"

Posted by Avatar for ceremcem @ceremcem

Actions