What's the deal with iot.js and JerryScript
[复制链接]
Node.js will soon be running on tiny low power chips.
iot.js is a Node.js compatible runtime being written by Samsung. The project is still in active development, is open source and Apache Licensed. It hasn't yet had a stable release but has been in development for over a year. It is built on a new JavaScript VM called JerryScript (named after Jerry Mouse) that they are also working on. Node.js is built on V8, and iot.js is built on JerryScript. The major goal of iot.js is to run Node code on low power devices. JerryScript doesn't have a logo yet, so I made one: The current hardware requirements for iot.js are around 350KB ROM and 100KB RAM. This is a huge difference compared with V8, the VM that Node.js is built on, which is notoriously memory hungry and doesn't run on devices with less than 64MB of RAM (the lowest power device I've seen running it is the Arduino Yun). As you can and the , iot.js is a Node.js compatible JS + C runtime that binds to JerryScript. The first two officially supported devices are the STM32F4-Discovery and the Raspberry Pi 2: The exciting thing about this stuff is that it makes low power hardware more accessible to coders like me who know JS and can install modules from NPM but don't want to deal with C and compiled language tooling and debugging headaches. I've done a number of projects with the Arduino which can't run Node but has great battery life, and the Raspberry Pi which can run Node but has poor battery life and requires Linux sysadmin skills to operate effectively. The Raspberry Pi (or any Linux machine) is totally overkill for a lot of the projects I'm interested in doing (e.g. a computer that lives on my bicycle, or on that sits in my garden measuring soil moisture levels). Low power node.js seems like the sweet spot for me - I can leverage the Node + NPM ecosystem to deploy stuff to hardware that can potentially run for weeks on a single charge. In the future they will work on support for other devices (according to ), including the Intel Edison and Samsungs recently announced Artik 1. Perhaps the closest thing to iot.js is Espruino, who both develop a custom JavaScript runtime as well as manufacture development boards like the Espruino Pico. The major difference between iot.js and Espruino is that Espruino is not Node.js compatible. The Espruino boards use a family of chips (STM32F4) that iot.js supports, so it should be possible to run iot.js on Espruino hardware in the future. In addition to JerryScript and Espruino there is also Duktape which is "an embeddable Javascript engine, with a focus on portability and compact footprint". There is a project called that combines Duktape and LibUV, which in the future could form the basis of a Node.js compatible runtime build on top of Duktape. It would be interesting to get the authors of JerryScript, Espruino and Duklove to sit down and talk to each other. Another similar device is the ESP8266, which is a low power microcontroller with an integrated WiFi networking stack. They are really cheap - you can get ESP8266 development boards for around $8 from Amazon or the raw chips in bulk for around $2 a piece. However, with only 64KB of RAM and ROM it is not quite beefy enough to run iot.js. The closest thing you can get is Lua through a project called or the project. I think a low power Node.js runtime is long overdue and am looking forward to the first stable iot.js release.
|