• When I read kickstarter page. It says that espruino doesn't employ any Operating System but uses specialized firmware for interpreting, processing, and scheduling as the memory is so low that O.S can't sit inside.

    https://www.kickstarter.com/projects/gfw­/espruino-pico-javascript-on-a-usb-stick­

    Boards used by espruino come under stm32 family and below is the link to program them by assembly language.

    http://www.st.com/web/en/resource/techni­cal/document/programming_manual/CD002281­63.pdf

    My argument is that why not espruino webide (by espruino) convert the js code to instruction set and then flash the M.C.U, in that way we can save more memory and put more code inside.

  • Hi,

    Websites like mbed already do that kind of thing (for C) - and yes, it's faster and you can get more inside.

    But...

    • You often need extra hardware - for instance mbed uses a second microcontroller on the same board. To be fair it's not always the case (eg. Maple/Olimexino)
    • You'll always need the Web IDE (or similar). With Espruino you don't. Any serial terminal on any device is enough to program it.
    • Debugging is really painful - with Espruino, you get a command-line interface directly to the interpreter where you can view variables, execute code and functions, and even change code while your software is running. You even get a stack trace when something goes wrong - that's all stuff that isn't really possible for compiled code.
    • You can't execute arbitrary code, and with Espruino you can. For instance you could use Espruino as an IO board for your PC, and you can easily send JavaScript commands over the USB Serial port like digitalWrite(LED1,1). Also, very useful parts of JavaScript like eval and Function(...) don't work if you're just pre-compiling JavaScript code (for instance Tessel has that problem).

    I'm sure there's plenty more too - basically if you don't need any of that then compiled code is better.

    With Espruino you can actually dynamically add Assembler code functions right now, and it's a relatively small step to compile C code and use that instead.

    I have been seriously considering compiling JavaScript functions to ARM assembler in the Web IDE and using the same method to link them in - and when I get time I'll be looking into it more closely. While you won't get the same stack traces, it would increase execution speed dramatically.

  • I think many MCU's are very similar. Platform 1 has this amount of memory, that MHz, some digital pins, some analog pins, usarts, i2c's, spi's, etc. and you program it in C/C++. Platform 2 has more or less of each and you program it in C/C++. Espruino has some of all those things too, EXCEPT you get to program it in JavaScript (yes!) and you get to do it interactively (yes!) and that allows options that are not so easy for other platforms. So Expruino offers a niche which might or might not appeal to someone. But I really like having more options :)

  • If you want to compile code and flash it to the MCU, there are many many existing options for this. While you get more performance, and more storage, you'd also lose all the things about Espruino that make it unique.

    Being able to run arbitrary JS from text over serial, or in http request/response really opens up a lot of possibilities.

    Plus, the interactive debugging is huge. I find that the development process on Espruino is much faster than Arduino, largely because you can run test code interactively. When something doesn't work as expected, you can go in and look at and change variables, run code, and even modify functions interactively.

    On arduino (or other compile + flash platforms), unless you're prepared to do hardware debugging over jtag or something, all you can do is add logging, flash it, and hope you put the logging in the right place to give you need to know.

  • I just thought espruino was built only to bring js developers to embedded world but after viewing all your responses. I change my view. It is interesting to have interactive debugging in embedded systems rather than flashing it every time or using jtag.

    Thank you all! for clearing away misconceptions on espruino.

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

Why to send js code to MCU when you can send instruction or hex file to M.C.U like arduino.

Posted by Avatar for user50191 @user50191

Actions