Latest Espruino build for Esp8266

Posted on
Page
of 8
  • If I want to use graphics, then I would need to stay with an older build?

  • More people may use graphics than crypto? Maybe we need a vote :)

    Of course I think you could use @JumJum's firmare builder?

  • Perhaps the bigger question is how many are using 512k roms vs 4mb.

    The restriction applies to 512k, and as this is the lowest common denominator and there is a common build, it applies to all esp8266

  • The layout difference between 512KB and greater flash chips is only one 4KB sector, so just ditching 512KB support doesn't instantaneously fix the issue. Someone still has to go through and work out an alternate flash layout and then make all the code and documentation changes. I still see new folks start with esp-01 modules, FWIW.

  • I still see new folks start with esp-01 modules, FWIW.

    Yeah, I'd say that with Telnet support the ESP01 modules are still pretty relevant.

    There must still be some easyish ways to get the code size down? There are ifdefs in the Math lib for cutting down on code size (with small but slow implementations of trig functions). And has anyone run find_big_rom.sh in the .lst file? That's my first stop on ARM.

  • I thought the espruino math libs were no longer used and these were now linked to standard libs? I do recall when this happened there was a lot of space freed up in the total firmware sizes.

  • It went through 2 phases:

    • Switching from the included maths libraries to GCC's libs
    • Finding out GCC's libs were HUGE and adding my own (small) implementations of the biggest ones if SAVE_ON_FLASH is defined

    So I think ESP8266 is currently using GCC's libs, but hasn't replaced the big ones with small ones.

  • See line 883ff in makefile, ESP8266 does not use GCC's lib
    Some time ago we found out, lmirom from RTOS-librarys works with SDK1.4 and saves some memory.
    On a long term this is a hack, may be SDK2.0 now has its own lmirom ?
    @tve, is there a place to get SDK2.0, same way I got SDK1.4 from your server ?

  • @JumJum
    If you look at the Travis.yml file you will get the link to @tve 's tvx file that has the 2.0 sdk.

  • Or - download it from the source

    https://espressif.com/en/support/downloa­d/sdks-demos

    and choose "ESP8266 NONOS SDK V2.0.0 patch 20160809" and "ESP8266 NONOS SDK V2.0.0 20160810"

  • Thanks for hints,
    downloaded sdk 2.0 as shown in travis.yml
    After compiling there are some warnings like this one:

    libs/network/esp8266/ota.c:93:3: warning: format '%lX' expects argument of type 'long unsigned int', but argument 3 has type 'uint32_t' [-Wformat=]

    Is there anything, I can get rid of those ?

  • Hi there
    sorry for the delay ( work :/ .. )

    answer from Greg Wang - Espressif Systems Customers service

    Hi,
    Yes, you can use flash more than 32Mbit. But the firmware is up to 32Mbit, no more. You can read and write the rest area as norma data storage.
    Currently we can support to 128Mbit max this way.

    ( confirmation of / additional info on answer by Pete Scargill - as @user67316 - who were kind enough to share it on page 6 of this topic )

    But only 1 meg for programs and possibly another meg for the OTA copy - the rest of the space could only be used for data - using for example the file system in the Arduino environment...

    During my latest tests, I had troubles flashing a NodeMCU ( ESP-12 ) board with the "latest" releases of both esptool.py & Espruino, even using dio & slower bauds didn't seems to do the trick :|
    -> I'll check again using the latest build provided here & post the results ( for: ESP-01, ESP-01 32M ( flash upgr. ), ESP-01 128M ( flash upgr. ), ESP-12 ( NodeMCU ) )

    On the crypto vs graphics topic, I'd say both are relevant ( though I'd 1st have fun with graphics than the other .. even after watching some Bruce Schneier talk ;p ) - so, additional param when building ?

    @JumJum actually don't know if this 'd help, but try using '%zu' or casting as '(unsigned long)theUint32tVar' ?

  • A have problem do not working .. on this hardware


    1 Attachment

    • 20160928_173010_resized.jpg
  • I think we need a bit more info @Aleksandrs. Can you upload firmware or does even that give you errors?

  • Yes sorry, this is NodeMcu V3 4M ESP8266, i Flash

    All WORK iN XUBUNTU.

    First STEP1.

    ./esptool.py --port /dev/ttyUSB0 erase_flash
    esptool.py v1.2-dev
    Connecting...
    Running Cesanta flasher stub...
    Erasing flash (this may take a while)...
    Erase took 9.2 seconds

    NEXT..

    ./esptool.py --port /dev/ttyUSB0 --baud 9600 write_flash --flash_freq 80m --flash_mode qio --flash_size 32m 0x0000 boot_v1.6.bin 0x1000 espruino_esp8266_user1.bin 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
    esptool.py v1.2-dev
    Connecting...
    Running Cesanta flasher stub...
    Flash params set to 0x004f
    Writing 4096 @ 0x0... 4096 (100 %)
    Wrote 4096 bytes at 0x0 in 4.3 seconds (7.6 kbit/s)...
    Writing 471040 @ 0x1000... 471040 (100 %)
    Wrote 471040 bytes at 0x1000 in 489.9 seconds (7.7 kbit/s)...
    Writing 4096 @ 0x3fc000... 4096 (100 %)
    Wrote 4096 bytes at 0x3fc000 in 4.3 seconds (7.6 kbit/s)...
    Writing 4096 @ 0x3fe000... 4096 (100 %)
    Wrote 4096 bytes at 0x3fe000 in 4.3 seconds (7.6 kbit/s)...
    Leaving...

    and photo Web IDE do not work


    1 Attachment

    • Screenshot_2016-09-28_19-44-07.png
  • Have you set baudrate in the IDE to 115200? You can find that under the radar-button and communications tab.

  • Hello, many thanks bitrate now is 115200 and all working ...

  • Hi! Help me please. I have nodemcu v3 board with 1.86 firmware.
    This string - var wifi = require("Wifi") works without errors. But this - var fs = require("fs") causing the error: WARNING: Module "fs" not found. What to do?

  • See this thread. It's not part of the ESP8266 build, but can be added if you can build it yourself.

    http://forum.espruino.com/conversations/­292368/

  • Hi All, I have 3 NodeMCU's V3 and flashed like explained above. Mine works in the IDE (Espruino Web IDE) but only if I publish. But as soon as I reset or power the board down. It looses all the code.... and yes I have the setting set to save to flash in the IDE. I tried multiple speeds (9600) included. (Code runs fine until reset or power down). Do I have to flash this with shorting points? What do I do? Thus far I have tried this on 2 of the 3 boards and both do the same thing.
    Please can someone help me?

  • Sounds like you need to use save() to persist your code to flash. It's not the default behaviour, what you load to the board over the IDE exists until powered off or reset.

  • Thanks Ollie I actually erase_flash again and did a clean install and now it works. But will try the save() method. Thanks again!

  • My code is :

    var ws = require('ws');
    var Wifi = require("Wifi");
    Wifi.connect("123", {password: "456"}, function (ap) {
        console.log("connected:", ap);
    });
    Wifi.on('connected', function (details) {
        var x = new Date();
        console.log("Connected......", x.toString());
        Wifi.getAPDetails(function (detail) {
            console.log("AP Details : ", detail);
        });
        Wifi.getAPIP(function (detail) {
            console.log("APIP Details : ", detail);
        });
        Wifi.getDetails(function (detail) {
            console.log("Details : ", detail);
        });
        Wifi.getDHCPHostname(function (detail) {
            console.log("DHCP HostnameDetails : ", detail);
        });
        Wifi.getHostname(function (detail) {
            console.log("Hostname Name : ", detail);
        });
        Wifi.getIP(function (detail) {
            console.log("IP : ", detail);
            //server();
            socketServer();
        });
        Wifi.getStatus(function (detail) {
            console.log("Status : ", detail);
        });
    });
    /*Wifi.on('probe_recv', function(details) {
     console.log("probe Details : ",details);
     });*/
    Wifi.scan(function (detail) {
        console.log("scan Detail : ", detail);
    });
    Wifi.setHostname("123-esp");
    Wifi.on('sta_joined', function (details) {
        console.log("sta_joined : ", details);
    });
    Wifi.on('sta_left', function (details) {
        console.log("sta_left : ", details);
    });
    Wifi.startAP('123-esp', {authMode: 'wpa2', password: '456', channel: 13}, function (a, b, c, d) {
        console.log("startAP::", a, b, c, d);
    });
    /*Wifi.stopAP(function(a,b,c,d){
     console.log("stopAP ::",a,b,c,d);
     });*/
    Wifi.save();
    function server() {
        var page = "<html>\n<head><meta name=\"viewport\" content=\"width=device-width,initial-sca­le=1\"></head>\n<body style=\"width:100%;height:100%;overflow:­hidden;\">\n<svg style=\"width:100%;height:100%;\"\n   viewbox=\"0 0 500 500\" id=\"svg\">\n    <path\n       style=\"fill:#80e5ff;fill-opacity:1;fill­-rule:nonzero;stroke:none\"\n       d=\"M 250 0 C 111.92882 3.7895613e-14 0 111.92882 0 250 C -1.249508e-14 341.05067 48.689713 420.72528 121.4375 464.4375 L 154.625 409.40625 C 100.50052 376.95218 64.28125 317.69934 64.28125 250 C 64.28125 147.43284 147.43284 64.28125 250 64.28125 C 352.56716 64.28125 435.71875 147.43284 435.71875 250 C 435.71875 317.53896 399.66155 376.65256 345.75 409.15625 L 378.71875 464.34375 C 451.37991 420.61135 500 340.98541 500 250 C 500 111.92882 388.07118 -1.8947806e-14 250 0 z \" id=\"ring\"/>\n    <rect\n       style=\"fill:#ffffff;fill-opacity:1;fill­-rule:nonzero;stroke:none\"\n       id=\"needle\"\n       width=\"16\"\n       height=\"80\"\n       x=\"242\"/>\n    <text\n       xml:space=\"preserve\"\n       style=\"font-size:122.59261322px;font-st­yle:normal;font-variant:normal;font-weig­ht:normal;font-stretch:normal;text-align­:center;line-height:125%;letter-spacing:­0px;word-spacing:0px;text-anchor:middle;­fill:#000000;fill-opacity:1;stroke:none;­font-family:Helvetica;-inkscape-font-spe­cification:Helvetica\"\n       x=\"250.01915\"\n       y=\"845.31812\"\n       id=\"text\"><tspan\n         id=\"label\"\n         x=\"250.01915\"\n         y=\"292.95594\">0</tspan></text>\n    <path\n       style=\"fill:#d5f6ff;fill-opacity:1;fill­-rule:nonzero;stroke:none\"\n       id=\"up\"\n       d=\"m 294.75099,133.39225 -90.93056,0 45.46528,-78.748173 z\"\n       transform=\"matrix(0.61903879,0,0,0.6190­3879,95.682477,91.16682)\"\n       />\n    <path\n       transform=\"matrix(0.61903879,0,0,-0.619­03879,95.682477,408.80767)\"\n       d=\"m 294.75099,133.39225 -90.93056,0 45.46528,-78.748173 z\"\n       id=\"dn\"\n       style=\"fill:#d5f6ff;fill-opacity:1;fill­-rule:nonzero;stroke:none\" />\n</svg>\n\n<script>\n// Convert touch to mouse event for mobile devices\nfunction touchHandler(event) {\n  var touches = event.changedTouches,\n       first = touches[0], type = \"\";\n  switch(event.type) {\n    case \"touchstart\": type=\"mousedown\"; break;\n    case \"touchmove\":  type=\"mousemove\"; break;        \n    case \"touchend\":   type=\"mouseup\"; break;\n    default: return;\n  }\n  var simulatedEvent = document.createEvent(\"MouseEvent\");\n  simulatedEvent.initMouseEvent(type, true, true, window, 1, \n                            first.screenX, first.screenY, \n                            first.clientX, first.clientY, false, \n                            false, false, false, 0/*left*/, null);\n  first.target.dispatchEvent(simulatedEven­t);\n  event.preventDefault();\n}\ndocument.add­EventListener(\"touchstart\", touchHandler, true);\ndocument.addEventListener(\"touc­hmove\", touchHandler, true);\ndocument.addEventListener(\"touc­hend\", touchHandler, true);\ndocument.addEventListener(\"touc­hcancel\", touchHandler, true); \n\n// rotate needle to correct position\nvar pos = 50;\nfunction setPos(p) {\n  if (p<0) p=0;\n  if (p>100) p=100;\n  pos = p;\n  document.getElementById(\"label\").textC­ontent = pos;    \n  var a = (pos-50)*2.8;\n  document.getElementById(\"needle\").setA­ttribute(\"transform\",\"rotate(\"+a+\" 250 250)\");    \n}\nsetPos(pos);\n\n// handle events\nvar dragging = false;\nfunction dragStart() {\n  dragging = true;\n  document.getElementById(\"ring\").style.­fill = \"#ff0000\";\n}\ndocument.addEventListen­er(\"mousemove\", function(e) {\n  if (dragging) {\n    e.preventDefault();\n    var svg = document.getElementById(\"svg\");\n    var ang = Math.atan2(e.clientX-(svg.clientWidth/2)­,(svg.clientHeight/2)-e.clientY)*180/Mat­h.PI;\n    setPos(Math.round((ang/2.8)+50));\n  }\n});\ndocument.addEventListener(\"mous­eup\", function(e) {\n  dragging = false;\n  document.getElementById(\"ring\").style.­fill = \"#80e5ff\";\n  document.getElementById(\"up\").style.fi­ll = \"#d5f6ff\";\n  document.getElementById(\"dn\").style.fi­ll = \"#d5f6ff\";\n  // POST data to Espruino\n  var req=new XMLHttpRequest();\n  req.open(\"POST\",\"?pos=\"+pos, true);\n  req.send();\n});\ndocument.getElementByI­d(\"ring\").onmousedown = dragStart;\ndocument.getElementById(\"ne­edle\").onmousedown = dragStart;\ndocument.getElementById(\"up­\").onmousedown = function(e) { e.preventDefault(); this.style.fill = \"#ff0000\"; };\ndocument.getElementById(\"dn\").onmo­usedown = function(e) { e.preventDefault(); this.style.fill = \"#00ff00\"; };\ndocument.getElementById(\"up\").onmo­useup = function(e) { setPos(pos+10); };\ndocument.getElementById(\"dn\").onmo­useup = function(e) { setPos(pos-10); };\n</script>\n</body>\n</html>";
        function pageHandler(req, res) {
            if (req.method == "POST") {
    // If it's a POST, save the data
                var info = url.parse(req.url, true);
                console.log("POST ", info);
                if (info.query && "pos" in info.query)
                    res.writeHead(200);
                res.end("Ok.");
            } else {
    // otherwise write the page out
                console.log("GET " + req.url);
                if (req.url == "/") {
                    res.writeHead(200);
                    res.end(page);
                } else {
                    res.writeHead(404);
                    res.end("404: Not found");
                }
            }
        }
        require("http").createServer(pageHandler­).listen(80);
    }
    
    function socketServer() {
        var page = '<html><body><script>var ws;setTimeout(function(){';
        page += 'ws = new WebSocket("ws://" + location.host + "/my_websocket", "protocolOne");';
        page += 'ws.onmessage = function (event) { console.log("MSG:"+event.data); };';
        page += 'setTimeout(function() { ws.send("Hello to Espruino!"); }, 1000);';
        page += '},1000);</script></body></html>';
    
        function onPageRequest(req, res) {
            res.writeHead(200, {'Content-Type': 'text/html'});
            res.end(page);
        }
    
        var server = ws.createServer(onPageRequest);
        server.listen(8000);
        server.on("websocket", function (ws) {
            ws.on('message', function (msg) {
                print("[WS] " + JSON.stringify(msg));
            });
            ws.send("Hello from Espruino!");
        });
    }
    

    i getting error :
    NPM: Checking NPM at http://registry.npmjs.org/Wifi
    NPM: Checking NPM at http://registry.npmjs.org/http
    loadModule(ws.min)
    ERROR: Not Found
    NPM: Latest version 0.0.0
    NPM: URL https://registry.npmjs.org/http/-/http-0­.0.0.tgz
    [object Object]
    loadModule(http)

    • ws.min requires ["crypto","net","http"]
      Queueing crypto
      NPM: Checking NPM at http://registry.npmjs.org/crypto
      Queueing net
      NPM: Checking NPM at http://registry.npmjs.org/net
      Already loading http
      ERROR: Not Found
      NPM: Latest version 0.0.3
      NPM: couldn't find latest tarball
      [object Object]
      loadModule(crypto)
      NPM: Latest version 1.0.2
      NPM: couldn't find latest tarball
      [object Object]
      ERROR: Not Found
      loadModule(net)
      ERROR: Not Found
      WARNING: [notify_warn] Module http not found
      ERROR: Not Found
      ERROR: Not Found
      ERROR: Not Found
      WARNING: [notify_warn] Module crypto not found
      ERROR: Not Found
      WARNING: [notify_warn] Module net not found


    please help me for this

  • Looks like you turned onNPM (Beta) in settings - turn it off and it might work - or at the least it'll produce a lot less warnings

  • Thanks @Gordon, my issue is solved. i just turn off NPM (Beta) from settings.

About

Latest Espruino build for Esp8266

Posted by Avatar for tve @tve

Actions