Espruino on ESP8266

Posted on
of 6
/ 6
Last Next
  • Interesting :) No, I had no idea. I guess it was just a matter of time though!

  • Yes I’ve been watching it for sometime and tried it out, looking very promising but its sad that he seems working alone and the progress is slow.

    Guys, It would be great if you can help him & contribute in the project, especially on merging his code to your project, you did one hell great job with Espruino and we would love to see it working on more boards.

    Can't wait to see it fully functional after seeing it doing the basic operations on my ESP8266

  • Has anyone tried out what he's got? It sounds from the description like it's pretty decent already, and that he would merge in his changes when he was ready.

    Unfortunately I barely have enough time to work on and support Espruino myself, let alone to help port it to new boards :(

  • I couldn't get it compiled and running, so I tried flashing the already built file onto my ESP8266. It seemed to run okay but I don't think wifi worked for me. Didn't really try anything after that due to lack of time, not lack of interest.

  • Anyone been able to locate specs on flash & memory size on these? JS on an even-cheaper hardware platform is VERY interesting.

  • I did find specs a while back, but I'm not totally sure now. The ESP8266 itself needs a flash chip, and the chip on most of the modules you'll buy is 512kB - quite a bit of which is needed for the main firmware.

  • I'm pretty skilled on the ESP8266 and would be keen to get Espruino running on the ESP8266. The ESP8266 community can be found here ...

    If there is interest in getting this going on ESP8266, count me in 110% ...

  • It would be really awesome if this could be done - I'm sure it would be rather limited what you could pull off within the constraints of the 8266, but it would be so nice for small internet connected things.

  • I'm not yet sure what the specs are on Espruino. The ESP8266 has 80MHz or 160MHz processor and 64k of RAM of which 40K is typically free while running as a network device. The flash starts at 512KBytes and can go up to 16Mbytes max. I think the first things that would have to happen is for the folks who care to get involved "get together" (on the Internet). At a minimum, we would need someone who speaks ESP8266 well (I can volunteer for that) and someone who fully understand the code base of Espruino. Without at least those two participants, we have nothing to start with.

  • Speed is fine.

    40k of ram... Espruino itself eats what, 10-12k?

    That'd leave 28k of ram, maybe 24 if we're conservative, for 15oo-1700 jsvars. You can do a fair amount with that, though that's what the limiting factor would be.

    We should see if we can rope in that dude whose github that is linked at the top...

    I'm afraid I don't have much to contribute to either side here.

  • I've emailed the owner of the Github project to see if he can join in the story again. Looking at the owners other contributions, he too seems to be very knowledgable on the ESP8266 technology. Since we may be staffed with ESP8266 resources, I think the missing ingredient is probably going to be someone who claims competency on the Espruino internal architecture.

    Do we have any architecture and design docs on the Espruino? Anything that talks about its core architecture and what pre-reqs it may have with respect to its operating environments?


  • As far as RAM, Espruino needs probably 1kB for static stuff (depending on what's included), then maybe 3kB for stack and the rest is variable storage. On the bigger boards I leave more for stack as it helps with recursion though.

    I'm happy to help out where possible. There's some info on and as well as several posts on the forum from people asking about porting (a few are quite recent). I'm also doing a talk in October at Fullstack on the internals - which should be recorded, so I'll link to that when it's up.

    However from what I can see on that GitHub, most of the hard work has already been done? It's probably just a bit of bugfixing/tweaking required?

    Maybe WiFi isn't included in it yet, which would be the big one? However actually adding support requires very little knowledge of Espruino - you're just implementing this interface

  • When I tried it, the basics were working. Sending code through the console, I/O, PWM. Wi-Fi wasn't working for me, but the commit notes looked like the author had it going.

  • Thanks Gordon, I'm sure we'll need your support for this. The good news is that I feel very comfortable in the WiFi areas on the ESP. I'll start studying the internals docs and reading the code. Ive emailed the author of the ESP project but haven't heard back yet.

    Let us assume that his sandbox project "got it working" ... what I hope we can do it identify the differences in his fork from your master and try and merge the two together. I'm hoping that we can have one source of truth on the Esprunio code base and that would be your master. Depending on the nature of the changes that might have been made, would you (in principle) be willing to accept pull requests against your code to bring together common changes?


  • would you (in principle) be willing to accept pull requests against your code to bring together common changes?

    Yes, absolutely. From my point of view I'd like to try and get ESP8266-related code out of the src directory as much as possible (eg. no #ifdef ESP8266). Hopefully that can be done in a way that makes porting to new devices easier, not harder.

    I haven't looked properly, but the owner of the branch may well have tried not to do that anyway - he mentions wanting to commit the code back in the Readme.

  • I made my first pass at seeing what aplikatika has built. Looking at his git project, I see he is building on a Mac where I have windows. Ok ... not an issue. I built an Eclipse environment with the C Development Tools and the ESP (Xtensa) tool chain. The good news is that every last source file compiled cleanly!! YEAH!! ... However, when it came to linking the parts together, we failed with a "xtensa-lx106-elf/bin/ld.exe: build/myApp.out section '.irom0.text' will not fit in region `irom0_0_seg'" error. The ESP8266 has about 40k RAM and 512K of Flash. Two thoughts immediately strike me:

    1. How big is the compiled Espruino program? Will it fit in 512K of Flash?
    2. In ESP8266 programming, when one compiles a C source file, for each function one can specify which "section" it will be loaded from. Loading it from RAM causes the code to be loaded into RAM and run there ... while loading it from Flash causes the CPU to read the code slower from Flash. However, since Flash is much larger than RAM, we normally flag the code as running from Flash and take the performance hit. We normally flag this on a function by function basis. Since the Espruino code doesn't have these ESP8266 per-function attributes, I think everything is being flagged as to be loaded from RAM and that of course won't fit.

    Since aplikatika has solved this with his Mac makefile but that isn't working in my Windows makefile ... I am thinking there is something in that area.

  • Just a heads up for when you get it running, I had a couple of serial issues with the ESP8266. I needed to turn off flow control and manually add line feeds in minicom, it didn't work with the IDE.

  • I have windows

    I'd seriously suggest you use a VM and build under Linux (you could probably still do this while using eclipse on Windows if you wanted). The Espruino build has to run some Python scripts to create things like hard-coded symbol tables, so I imagine you'll be making life a lot harder for yourself.

    How big is the compiled Espruino program? Will it fit in 512K of Flash?

    It depends what's included... it should compile down to about 100kB of ARM thumb with -Os if there's no networking or USB in there - but I have no idea how compact the xtensa instruction set is.

    However unless you build with RELEASE=1 make it'll include a bunch of assertions which really bulk the binary size up (although not that much!).

    I think everything is being flagged as to be loaded from RAM and that of course won't fit

    I imagine he's probably just tweaked the linker script so this doesn't happen?

    If you tried compiling under Linux with a VM it might 'just work'.

  • Great news. I got it 100% cleanly built AND linked on Windows. Since the original project was built on a Mac and I don't have one of those, I had tried to take the code and build it on Windows. I have an ESP8266 tool chain and used my own Makefile templates to build ... the code compiled cleanly by the linker failed with the error reported previously.

    I decided to start again ... this time I still used my ESP8266 tool chain but this time used the Makefile that was provided with the project and this time not only did the code compile cleanly but the linker completed resulting in a firmware image that I can now upload.

    And then it was bed time ... so I haven't tested the pay-off yet :-)

    A question for the community ... do we want to continue to use this one forum thread for this project discussion ... that is fine by me, but the thread may get VERY big. Just checking if there is a better desire?


  • Great! In terms of building, using the existing Makefile is going to be vital if we're going to pull the code back into the main GitHub repo. While the current build system could definitely do with rewriting, I think that's a separate project. Trying to do that as well is just going to diverge the two branches even more :)

    Do you have any suggestions, instead of this thread/forum? When it gets to the point of bug reporting it could be done on GitHub.

  • Oooh!!! After a LOT of heartache ... we have "first light". The attached screen shot is from the serial output of an ESP8266!!! I haven't tested running any JavaScript ... but the parts are starting to come together. I got an email from Blaz today ... he is out until October.

    1 Attachment

    • 2015-08-19_23-49-25.png
  • Looking good - it'd be interesting to see if you can type any JS in the serial window. There's no > prompt there, which makes me think that for some reason it might not be responding?

  • I found an answer for our chats on the development of the ESP8266 for Espruino ... Gitter ... see:

    However, since the Gitter chat room is associated with the Github project, it needs to be created by Blaz. The chat history is also persistent.

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

Espruino on ESP8266

Posted by Avatar for JumJum @JumJum