9 ms·
JerryScript – A JavaScript Engine for Internet of Things
- personjerry 11y agoI like the name :)
- inglor 11y agoWait, so Samsung wrote their own new JavaScript engine for embedded devices? This is actually very cool. It looks very constrained in what it supports so far though. Update: They're at ECMAScript 5.1 https://github.com/Samsung/jerryscript/issues/205 https://github.com/Samsung/jerryscript/issues/205 but not all tests are running https://github.com/Samsung/jerryscript/issues/158 https://github.com/Samsung/jerryscript/issues/158 Ok, it doesn't yet JSON.stringify https://github.com/Samsung/jerryscript/issues/432 https://github.com/Samsung/jerryscript/issues/432 so not sure if ready yet.
- tmrmn 11y agoa few days ago Cesanta brought their v7 JS engine to the esp8266 and now samsung is showing JerryScript. Pretty interesting times for embedded JS
- Animats 11y agoNice. JavaScript allocates a lot of memory dynamically, and sometimes implicitly, though. In very tiny RAM environments, that's going to be a problem.
- arez 11y agohad 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.
- Animats 11y agoJerryScript needs 64 KB RAM, 200KB ROM. So what can it run on? Ardunino Uno (ATmega CPU): 2KB RAM, 32KB ROM - Too small. Arduino DUE (ARM CPU): 96KB RAM, 512KB ROM - Yes. Raspberry Pi (ARM CPU): 256MB RAM, 1GB+ ROM - Yes, but why? On the Raspberry Pi, of course, you can run Go programs. Or anything else that runs on Linux. It won't fit on the smaller machines. There's no need to run a Javascript this tiny on the Pi. So the target for JerryScript is machines in the Due range. Rust has been crammed into the Arduino Due, which may become a good approach for embedded work. Go probably won't fit; too much runtime. They're all in the $25-$45 price range. The Due, surprisingly, is the most expensive.
- dottrap 11y agoRaspbian, the default OS for Raspberry Pi, actually includes JavaScriptCore as a standard, pre-installed component.
- gbl08ma 11y agoThe ESP8266 may be a good candidate. tmrmr already said in these comments that some other company had ported another JS engine to the thing. And the world isn't just Arduinos, Raspberry Pis and other nicely-packaged "hacking" solutions.
- MikusR 11y agoProbably this https://www.artik.io/hardware/artik-1 https://www.artik.io/hardware/artik-1
- rhinoceraptor 11y agoYep, I've been running Node.js on a Raspberry Pi with Arch Linux ARM embedded project for a couple months now. It works great, other than the startup time for Node being pretty rough.
- bsder 11y ago> Ardunino Uno (ATmega CPU): 2KB RAM, 32KB ROM - Too small. To be fair, that system really doesn't run anything dynamic well. However, your point stands. Requiring 64K of RAM puts this above most ARM Cortex M0 chips. Picobit (https://github.com/stamourv/picobit https://github.com/stamourv/picobit) sits comfortably in 16K ROM/4K RAM. There's no good reason why Javascript vouldn't do the same.
- weland 11y agoIt 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.
- mwcampbell 11y agoIt seems to me that consistent allocation patterns would help more if JerryScript used reference counting for memory management, perhaps with mark-and-sweep GC as a backup to handle cycles. As it stands now, each object has a reference count to keep it alive while it's being used by C code via the API, but actual deallocation is done via mark-and-sweep GC.
- robmccoll 11y agoHow does this compare to duktape (http://duktape.org 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 11y agoThe 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.
- deleted 11y ago[deleted]
- forgotmypassw 11y agoNot enough buzzwords.
- volaski 11y agoAm i the only one who doesn't get the reference? Where does the name Jerry come from?
- jbottigliero 11y agoMy first thought was "jerry-rigged". Rather than starting the almost inevitable conversation here ("jerry" vs. "jury"), I'll point out the following SE answer[1]... [1] http://english.stackexchange.com/questions/132868/jury-rigged-or-jerry-rigged http://english.stackexchange.com/questions/132868/jury-rigge...
- sanxiyn 11y agoIt comes from "Tom and Jerry". Source: I was there when the name was decided.
- kzhahou 11y agoInternet 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 11y agoThe authors of this engine are Samsung, who are currently leading the world in promoting the "Internet of Things" buzzword.
- vegancap 11y agoThis is something Tessel does well, I believe they do all kinds of transpilation to Lua. This could be really useful for them.
- tracker1 11y agoIIRC, 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.
- tomphoolery 11y agoComing soon: GeorgeScript, a little language that compiles into JerryScript.
- the-dude 11y agoEverybody knows: you have got to keep your worlds apart! You have slipped up.
- Raed667 11y agoIf it doesn't work with an Ardunino Uno, then it is not relevant.
- Raed667 11y agoOk maybe an STM32F1 as well
- orf 11y agoAKA how to not to make a landing page. "For more info check the Github" -> "View the wiki for more info" -> repeat.
- cfstras 11y agoIsn't this basically the same as the Espruino [1]? Has anyone compared the two in terms of performance and handling? [1]: https://github.com/espruino/Espruino https://github.com/espruino/Espruino
- sklogic 11y agoI'm struggling to understand - what's the point of using JavaScript for anything embedded?
- dragonwriter 11y ago> 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.
- sklogic 11y agoLanguage is the least important barrier to entry to any field. Domain knowledge is much more important.
- dragonwriter 11y agoDomain knowledge of the type relevant to programmers in many fields is gained through experience programming in that field, not non-programming experience in that field. Unfamiliar programming language is an impediment, for many, to that learning process. If the tradeoff for that is a much clearer mapping to the domain than a more familiar alternative, the unfamiliar language may be, pedagogically, a net win, but -- especially for self-study -- people are more likely to learn enough to look deeply into the domain (including through unfamiliar languages) if the initial entry path is easy from where they currently are.
- AdieuToLogic 11y agoThe problem in this particular case is that the concerns of embedded systems are orthogonal to what anyone who knows _only_ JavaScript has ever dealt with. Those worlds are simply too far apart. Your case is entirely valid when, say, a person is hired to work in a retail system and who had previously worked in some form of a decision support system.
- nostrademons 11y ago
- bitmapbrother 11y agoJerryScript - A scripting language about nothing.
- daurnimator 11y agoSimilar 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://tessel.io/) - https://github.com/PaulBernier/castl - https://github.com/tessel/colony-lua
- rawdisk 11y agoOne more: https://cesanta.com/smartjs.shtml https://cesanta.com/smartjs.shtml Opinion: Lua is a better choice for IoT but alas the programming "market" has (again) chosen the worse alternative.
- bsder 11y agoLua has a significant strike against it in being 1-based when everything embedded you'd want to put Lua on is 0-based. In addition, the point of having Javascript is so that I can get my junior software folks (proxy for any inexperienced programmer) to write things for my embedded hardware instead of having to haul out my senior staff engineers who have 20 years of experience writing C for embedded devices. Look at Arduino vs. Raspberry Pi/BeagleBone. Arduino has way more developers because it was orders of magnitude easier to program. Ecosystem is important.
- deleted 11y ago[deleted]
- acoard 11y ago>Lua has a significant strike against it in being 1-based when everything embedded you'd want to put Lua on is 0-based. Why is being 0-based more important on embedded compared to other contexts?
- bsder 11y agoDon't forget Picobit which is Scheme: https://github.com/stamourv/picobit https://github.com/stamourv/picobit
- cfontes 11y agoVery interresting. But I just hate this "Internet of Things" name... There must be a better suited name for it.
- hmottestad 11y agoFor 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 https://github.com/esp8266/Arduino
- BFatts 11y agohttp://www.espruino.com/ 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.