11. <3 JS over C++
• Way faster to develop, debugging and testing are easier
• Harder to break (no off-by-one errors, pointers, seg faults,
memory management)
• Portable to other platforms
• Event system is a natural fit
• Functional language is more expressive
12. Downsides
Running a VM has additional cost
Abstraction may leak
Embedded developers will yell at you
13.
14.
15. Application processor Microcontroller
Raspberry Pi 3 C.H.I.P. micro:bitNUCLEO-F401RE
Full operating system
Hundreds of MB of RAM
Relatively expensive and bulky
Processor, RAM, Storage
Kilobytes of RAM and flash
Slow and needs bare-metal
16. One year on AA battery 0.137 mA
220 mARaspberry Pi 3 (idle)
0.020 mAMicrocontroller w/ BLE
Eddystone, 1s interval, lowest power mode
18. JerryScript
• JavaScript VM
• Originally developed by Samsung
• Managed by JavaScript Foundation
• University of Szeged, Intel, ARM, Samsung, and more
• Runs in 64K of RAM; 200K of ROM
• But... like V8, it's just a VM. Need bindings!
19. Architecture - JS on a microcontroller
JS Application
JS <> C++ bindings
JavaScriptVM
Operating System
(RTOS and drivers)
Startup, peripherals, etc.
JerryScript ARM mbed OS 5
mbed.js
23. New drivers
Written in C++
Exposed through JS API
http://github.com/janjongboom/mbed-js-wrapper-generator
24. Architecture - JS on a microcontroller
JS Application
JS <> C++ bindings
JavaScriptVM
Operating System
(RTOS and drivers)
Startup, peripherals, etc.
JerryScript ARM mbed OS 5
mbed.js
25. Architecture - JS on a microcontroller
JS Application
JS <> C++ bindings
JavaScriptVM
Operating System
(RTOS and drivers)
Startup, peripherals, etc.
JerryScript ARM mbed OS 5
mbed.js
Your drivers
Using APIs
from mbed.js
27. Future...
Code sharing between ecosystems
Adopt a generic module system (like NAPI)
Create standard JS APIs for I2C, SPI, etc.
JerryScript is open source, so come and help!
28. And to us, C++ was the ultimate in Roman
decadence. I mean, it was equivalent to going
and vomiting so you could eat more.
- Steve Yegge
http://steve-yegge.blogspot.co.uk/2008/05/