top | item 9951458

JerryScript – A JavaScript Engine for Internet of Things

151 points| talles | 10 years ago |samsung.github.io | reply

70 comments

order
[+] daurnimator|10 years ago|reply
Similar projects:

  - http://duktape.org/
  - http://mujs.com/
  - https://github.com/gfwilliams/tiny-js
  - http://pdqi.com/cgi-bin/cgiwrap/pdqi/jsi.cgi/doc/tip/jsi/www/index.wiki
Fun alternative: Compile JS to Lua and run that instead (e.g. as done by https://tessel.io/)

  - https://github.com/PaulBernier/castl
  - https://github.com/tessel/colony-lua
[+] robmccoll|10 years ago|reply
How does this compare to duktape (http://duktape.org)? I really like duktape's API and documentation (stack-based interface similar to Lua and the doc perfectly describes how each function call affects the stack state).
[+] mwcampbell|10 years ago|reply
The API isn't stack-based. It's more like the Python C API, complete with reference counting (but note that actual memory reclamation is done through mark-and-sweep GC), except that instead of everything being a pointer to an object, numbers and booleans are represented directly, so a union is used to represent values.
[+] tomphoolery|10 years ago|reply
Coming soon: GeorgeScript, a little language that compiles into JerryScript.
[+] the-dude|10 years ago|reply
Everybody knows: you have got to keep your worlds apart!

You have slipped up.

[+] sklogic|10 years ago|reply
I'm struggling to understand - what's the point of using JavaScript for anything embedded?
[+] nilliams|10 years ago|reply
Because 'scripting' hardware (coding in a fairly high-level language) is a lot of fun and coding the same sorts of things in C is pretty painful & requires up-front knowledge of a lot of stuff you don't really need to know til later (memory management, types etc).

Sure there's Lua et al but JS is just a more relevant language nowadays.

[+] dragonwriter|10 years ago|reply
> I'm struggling to understand - what's the point of using JavaScript for anything embedded?

The point, I would suspect, is lots of people already know JavaScript, so it lowers the barrier to entry to embedded programming.

[+] kzhahou|10 years ago|reply
Internet Of Things is a rather meaningless term. It was fuzzy at first, and remains so a few years on.

Here, just say "resource-constrained devices" or something with ANY amount of meaning.

[+] tomphoolery|10 years ago|reply
The authors of this engine are Samsung, who are currently leading the world in promoting the "Internet of Things" buzzword.
[+] orf|10 years ago|reply
AKA how to not to make a landing page. "For more info check the Github" -> "View the wiki for more info" -> repeat.
[+] Animats|10 years ago|reply
Nice. JavaScript allocates a lot of memory dynamically, and sometimes implicitly, though. In very tiny RAM environments, that's going to be a problem.
[+] weland|10 years ago|reply
It would probably be OK if all programs have a simple, predictable sequence of malloc and free that they call in a loop, with similar-ish sizes each time.

It's extremely unpleasant to program something with just a few KB of RAM and not know exactly what memory goes where. However, a lot of IoT-related gadgets just gather a buffer of data from an ADC or something, average it and send it over some wireless protocol every 1 minute. The allocation pattern is predictable enough that you don't run into strange cornercases.

I see no reason why anyone would want to use this commercially, but for the enthusiast market (and maybe even for some rapid prototyping) this looks interesting enough.

[+] arez|10 years ago|reply
had the same thought, why do I have to do everything with JS, sometimes I think it's only to satisfy "Atwoods Law" again and again :) would do it in Go lang, not as raw as C but good and up to date enough for this purpose.
[+] bitmapbrother|10 years ago|reply
JerryScript - A scripting language about nothing.
[+] tmrmn|10 years ago|reply
a few days ago Cesanta brought their v7 JS engine to the esp8266 and now samsung is showing JerryScript. Pretty interesting times for embedded JS
[+] hmottestad|10 years ago|reply
For anyone interested in IoT, look at the esp8266.

It is a tiny chip with included wifi. It was 2 digital IO ports, and also a serial connection if you want to connect it to an arduino.

And at the moment it costs 2.6 USD on ebay!!!

And someone made a plugin so you can program it from the Arduino IDE: https://github.com/esp8266/Arduino

[+] vegancap|10 years ago|reply
This is something Tessel does well, I believe they do all kinds of transpilation to Lua. This could be really useful for them.
[+] tracker1|10 years ago|reply
IIRC, I believe the Tessel guys are abandoning the transpiler approach in favor of slightly more powerful hardware for the next generation that can just run node directly... We're really at a point where for the types of projects people want to run for under $100 of hardware, it's fast enough to do a lot more.

Power is a bit of a concern, and it all depends on the environment... being able to get every web monkey coding in more environments is a big win for enthusiasts and commercial applications for limited scope projects... Hell, without a screen or antenna powered on all the time, you can get a lot of processing done on even a smart phone from two generations ago.

[+] BFatts|10 years ago|reply
http://www.espruino.com/

This has been around for a lot longer than Samsung's (as far as I know) and has a lot of great support. If you're looking for a small, embedded JS processor built specifically for this kind of thing, I'd recommend Espruino.

[+] volaski|10 years ago|reply
Am i the only one who doesn't get the reference? Where does the name Jerry come from?
[+] sanxiyn|10 years ago|reply
It comes from "Tom and Jerry". Source: I was there when the name was decided.
[+] cfontes|10 years ago|reply
Very interresting.

But I just hate this "Internet of Things" name... There must be a better suited name for it.

[+] Raed667|10 years ago|reply
If it doesn't work with an Ardunino Uno, then it is not relevant.
[+] Raed667|10 years ago|reply
Ok maybe an STM32F1 as well