Tessel's blog covers its microcontroller boards that run JavaScript, including hardware overviews and development workflow for Tessel 2.
HN commenters bring up Tessel as an example of JavaScript on embedded hardware, though one notes it is a MIPS SoC rather than a true microcontroller.
> If you would start out with a JavaScript JIT (like V8) what things would you have to add (i.e. things that are not required to JIT JavaScript) besides the obvious modifications in the parser?
This is such a tempting thought -- that JavaScript and Lua are similar enough languages that an engine for one could be retargeted to the other with some parser changes and a few new features.
In practice it doesn't work out that way. Here is the story of Tessel, who originally set out to do it the other way around (implement JavaScript on LuaJIT) but reversed course after two years: https://tessel.io/blog/112888410737/moving-faster-with-iojs
"We believed that over time we could cover all of the corner cases of JavaScript with our own runtime, but perhaps we should have taken a cue from the “Wat talk” that it was going to be an uphill battle. While the semantics between JavaScript and Lua are very similar, they are also just slightly different in many ways (For example, the comparisons between null vs undefined vs falsy), and capturing all of those idiosyncrasies has proved frustrating for both the users and developers of the Runtime. [...] I still do believe it’s possible to make a nearly compatible runtime, but it’s going to take much more work than we expected and that resource investment would be an unwise business decision."
No, but you can use JavaScript on ARM mbed OS, running on $5 ARM-based microcontrollers.
https://os.mbed.com/javascript-on-mbed/
On Samsung's SmartThings embedded devices
https://smartthings.developer.samsung.com/docs/index.html
SigFox customized IoT solutions
https://build.sigfox.com/
Or on the other side from ARM mbed's offering, a beefy ARM 580 MHz with 96 MB (RAM + Flash), using JavaScript alongside Rust.
https://tessel.io/
Now if your only definition of embedded are constrained micro-controllers that aren't even able to cope with standard ISO C89 without having additional proprietary compiler extensions, then naturally everything else are just miniature desktop computers.
Meanwhile some forward looking companies keep on delivering innovative products.
The reason behind these slides: At our college, we planned in an embedded system course that our students can use the Tessel platform[1] to do quick prototyping on various project ideas, but most of them only took a lecture on OOP in C++ and had no experience on other programming languages. To help them get ready on hacking on these boards and modules with JavaScript in the first few weeks, I decided I should make a notes on some "special features" in JS in contrast to languages like C++/Java, e.g., first-class anonymous functions, closures, class-free OOP, ... And here is the result.
[1]: https://tessel.io/
I'd guess Javascript is quite popular[0] because it's literally on every modern computer and has incredible reach[1]. It's also a bit of a kitchen-sink language so students can grow into a style and paradigm that suits them. Plus there's nothing to install to get started... just open a browser.
[0] http://www.tiobe.com/tiobe-index/javascript/
[1] https://tessel.io/ https://www.sitepoint.com/creating-webgl-game-unity-5-javascript/ https://www.youtube.com/watch?v=5sETJs2_jwo
I know this won't assuage your concerns about officialness, though it's still worth mentioning that Rust does have community-maintained HALs (https://github.com/japaric/embedded-hal ) and tools to generate APIs from official vendor-provided SVDs (https://docs.rs/svd2rust/0.12.0/svd2rust/ ).
There's also a few boards out there that do support Rust natively: Hail (https://www.tockos.org/blog/2017/introducing-hail/ ) and Tessel (https://www.tessel.io/ ).
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