10k limit on esp8266

Posted on
of 2
/ 2
  • That definitely helped with ram usage:

    ={ "free": 833, "usage": 767, "total": 1600, "history": 7,
      "gc": 571, "gctime": 2.573 }

    I was able to load the unminimized code (it previously failed to load where different levels of minimization would load; so i've been using it to test. I still get a message:

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     1v96.5 (c) 2018 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    Flash map 4MB:1024/1024, manuf 0xc8 chip 0x4016
    Loading 14495 bytes from flash...
    Execution Interrupted during event processing.
    New interpreter error: LOW_MEMORY,MEMORY

    But the code is loaded and stored.

  • So I was starting to have some problems uploading code. Code looked like it went over; but it wasn't changing. I ran the following code:

    >s = require("Storage")
    =function () { [native code] }

    And then re-loaded my code over usb and no more memory errors. I am wondering if it is not cleaning itself out properly between loads with the newest version of the IDE (pulled from Git today)

  • In case you still struggle with MainCodeMenu.js code, no surprise to me: upload invokes at the end setup(). This means that before the upload can complete, things get executed... setup() is also called in E.on("init",...);.

    Even though I cannot validate the following change, give it a try: put setup() at the end of the code into a setTimeout(setup,1000);.

    What I generally suggest and do is just using function onInit() { setup(); } at the end of the code. While I'm still developing it is cumbersome to every time enter setup() in the console after code upload, I add an extra line containing setTimeout(onInit,1000); and remove it after I'm done with developing. I then upload the code with this last line removed and save it. That way I have a plain vanilla code on the chip and on power on it will do what I'm expecting: run the complete setup();. Level 0 code gets right away interpreted/executed while in upload... see the (often) referenced conversation about simple explanation how to save code that espruino run on start?.

  • @allObjects when you upload code via the 'Save on send' method it's all executed after upload, so I don't think that's such a big deal.

    Uploading with 'save on send', function code can be kept in flash, but variables can't. So for anything big it's best to write a function that just returns the data - then it'll be loaded into RAM only when needed. (or you could use Storage).

    @CMSpooner the issue you hit is probably because you were also experimenting with using Storage as well, or perhaps the 2 different types of 'Save on Send'? Espruino can get in a position where there are multiple bits of information in storage, but there's not enough RAM available to read all the stored data in and compact it - so it can't do anything without potentially losing things. In that case you'd have to manually erase like you did.

  • That makes a lot of sense! I pulled from github and wanted to make sure I had the most recent version of the IDE and couldn't remember which save on send I had. Thanks for the great support. I can't wait to have the kids at STEM camp playing with these!

  • @Gordon, thanks for the update.

  • Rather than remove - what about changing the default to be on if greater the v90, so that people still have the option of turning off?

    Perhaps it should be relabeled or a sub note saying that this means modules go to flash?

  • Yes, could be an idea - however I can't think of any reasons you'd ever want to turn it off?

    But yes, more info would be helpful. The modules only actually go to flash if you've enabled the 'Save on Send' as well.

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

10k limit on esp8266

Posted by Avatar for kameas @kameas