Avatar for Polypod


Member since Jul 2017 • Last active Nov 2017
  • 5 conversations

Most recent activity

  • in ESP8266
    Avatar for Polypod

    Thanks again allObjects for all your tries, I appreciate.

    I think it is not working because you didn't upload the FlashString.js module to the board yet. I can see it is not there in your log. The buttons to upload to flash are not supposed to show yet until he finds this module on the board, but for some reason they show up on yours, just a glitch. So when you use them, he complain about the absence of this module. (Uncaught Error: Module "FlashString" not found)

    If it is not an ESP8266, you may also need to change the default address/size in FlashString.js to match your flash setup (line 28-31 and remove the 2 extra pages use line 48).

    The sequence of action is :
    1- have your module and FlashString.js in modules directory (what you did) - picture 1
    2- upload FlashString.js to the board memory (it must show off as module in global[0xFF].modules and not with 3blocks of memory only). It seems you did not do this step. - picture 2, it takes 146block of memory
    3- now you can see your flash pages (pict 3) and upload your module to flash (pict4)

    Here is the log :
    step1 :

     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v93.162 Copyright 2016 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    Flash map 4MB:512/512, manuf 0xef chip 0x4016

    step2 :

    ={ "free": 1517, "usage": 183, "total": 1700, "history": 176 }
        "name": "Flash",
        "size": 3 },
        "name": "FlashString",
        "size": 146 }

    step3 :

    >File uploaded to flash : Add.js

    In case it was not clear, to communicate with the flash, the plugin uses the FlashString.js module he find ON the board memory, not the one on the hard drive. Therefore, you need to upload it there first by placing it in the module folder of the hard drive and use the button. The plugin just minify and transfer the file to FlashString.js on board, that take care of the rest.

    Yes, the plugin was made using tve module that is esp8266 oriented as you mention. That's why I posted in this section of the forum. But the plugin can work with any flash module that works the same way with save/load/(json)list, I was planning to extend it with another tab using FlashStore.js (I mentioned in first post), but this is still Esp8266. Anyone made a similar module yet for other platforms flash ? For me, it is worth have a unified plugin for flash, SD and so on, but, I have no SD, and truth is, I never got to understand completely the Project plugin code I made my plugin from, hence the little bugs here and there.

    Honestly, I am quite surprised by the difficulty you meet to make it run. I realize it is one thing to use it on my setup, and another to make it run in other people's setup. I would sure appreciate to see it run somewhere else, but if that doesn't help you forget it. If it is not an ESP8266, the benefit is quite limited, I understand if you give up :) I can fix the bugs that you already found, if that really helps. Some days, I don't understand how people can program on esp8266 without using this plugin, memory is so small and javascript is so gluttonous. Other days, I realize I am the crazy one for wanting to use 44kb of modules, plus the rest 3mb for storing files and logs, and have free memory.

  • in ESP8266
    Avatar for Polypod

    You are almost there. I never noticed that it ignores files ending with .min.js, it must be the way the project plugin was made. I'll have a look at that as well. If you try plain .js files, you have a 2 step left, to place the FlashString.js file in the modules directory, and to upload it to the board with the button with two arrows.

  • in ESP8266
    Avatar for Polypod

    Thanks very much allObjects for trying, obviously I forgot to mention about the options, but you found it, yes you have to set a folder.
    There is a bug that prevents the popup from opening when binary folder is empty, so put any file inside, until I fix it. The puzzle button is the one you want, the folder button is an old version that may not work.

    Once you have the window from puzzle button to open, it will still say "no flashstring found", that mean you need to transfer to the board with the button top right from flash or module tab.
    Here's a snapshot of the application newly installed:

  • in ESP8266
    Avatar for Polypod

    Hi all,
    I made this small WebIDE plug-in to use the plenty of flash pages of the ESP8266 and upload then execute easily modules there, and have more memory free for other use. I use it every day, as my programs always need more memory and getting bigger than the default space of 10kb. You can minify and transfer modules into pages, in one click, and then link them to be executed from flash, in another. As extra you can also load/unload modules direct to memory, etc. It mainly allows to use tve FlashString.js, without the hassle of manual commands and minification (mentioned in http://forum.espruino.com/conversations/­290975/). Be careful, the execution from flash and use of E.memoryArea is restricted to the first mb, so you can use it only on the 44kb(11 pages) under 1mb. I use Wilberforce FlashStore module for the 3mb left (http://forum.espruino.com/conversations/­283045/).

    My code is based on the Project plug-in, here is it (messily programmed I am afraid but works well).

    It uses a modified version of tve FlashString.js . Here is this version : https://github.com/popok75/Espruinuity/b­lob/master/EspCode/project/modules/Flash­String.js
    also you may want the stand-alone loader : https://github.com/popok75/Espruinuity/b­lob/master/EspCode/project/modules/Flash­StringLoader.js
    You want FlashString.js to be in modules directory when you start, so that you can transfer it to memory and start using your flash.

    For installation, you can get my version of WebIDE from the github (fetched 2 month ago) or you just need the source of WebIDE, add the source of espruino-tools in the right directory, flashview.js in plugin directory, and insert the following statements at the right place (not sure they are all needed) : https://github.com/popok75/Espruinuity/s­earch?utf8=%E2%9C%93&q=flashview&type=

    Here is how I load them in the final program :

    function loadFlashModules(mods,loader) { // load module and show mem usage
        var sm=0;
        for(var i=0;i<mods.length;i++){var mod=mods[i];
        if(Modules.getCached().indexOf(mod)>-1) Modules.removeCached(mod);
        var m=require(loader).load(mod+".js");
        if(!m)  {print("Module not found in flash : "+mod);return false;}
        else {
            var s;
            sm+=(process.memory().usage-s);print("Mo­dule in flash loaded: "+mod+" : "+(process.memory().usage-s)+" block mem usage");}
        print("All Modules : "+sm+" block mem usage");
        return true;
    function init(){

    I hope you'll try it and tell me what you think.

  • in ESP8266
    Avatar for Polypod

    @jinantha, did you try to switch qio to dio in espruino-tools command line ?
    you can also try replugging after the erase
    It is mentioned here recently, it helped me : http://forum.espruino.com/comments/13902­968/

  • in ESP8266
    Avatar for Polypod

    Happy to hear that. How to find such a free area ? What address should I look for ? All I know is that RAM starts at 0x20000000. Should I start to write there until something bad happens ?

    The Uint8Array header seem to be 3 blocks long, even for short arrays. But apart from that, its store bytes 1:1 like you said. Thanks a lot, I will use that.

    >var b=new Uint8Array(16);E.getSizeOf(b);
    >var b=new Uint8Array(400);E.getSizeOf(b); // 28 = 3+400/16
    >var b=new Uint8Array(1024);E.getSizeOf(b); // 67 = 3+1024/16
    >var b=new Uint8Array(10000);E.getSizeOf(b); // 628 = 3+100000/16
  • in ESP8266
    Avatar for Polypod

    Is it possible to read/write data directly in RAM at byte level with peek/poke ? I think of possibly storing more data in less memory than the limit of ~10bytes per byte with strings or typed arrays. It would be nice to be able to do a 1byte/byte data storage in ram like we do in flash.

    In this thread (http://forum.espruino.com/conversations/­288002/), they use peek to write at stackEndAddress in memory with ARM. But except the end of the stack with arm, is there a way in other boards, e.g. ESP8266, to allocate an area of RAM and get it's address for poking freely and safely ?


  • in ESP8266
    Avatar for Polypod

    The reversed text is the text printed on the chip, here's a photo comparing to normal text :