JerryScript is a lightweight JavaScript engine optimized for microcontrollers and embedded devices. It has a small memory footprint of only 3KB and implements ECMAScript 5.1. JerryScript has been ported to run on the Internet of Things (IoT) operating system RIOT, allowing JavaScript code to easily be run on microcontrollers. A demo of JerryScript running a Tetris game on an STM32F4 board using an LED matrix was shown. Future work includes further optimizations and adding debugging support to JerryScript.
Right Money Management App For Your Financial Goals
Â
JerryScript on RIOT
1. 1Samsung Open Source Group
JerryScript on RIOT
An ultra-lightweight JavaScript engine for the Internet of Things
Tilmann Scheller
Principal Compiler Engineer
t.scheller@samsung.com
Samsung Open Source Group
Samsung Research UK
RIOT Summit 2016
Berlin, Germany, July 15 – 16, 2016
2. 2Samsung Open Source Group
Overview
â—Ź Introduction
â—Ź JerryScript
â—Ź Memory consumption/Performance
â—Ź JerryScript on RIOT
â—Ź Demo
â—Ź Future work
â—Ź Summary
4. 4Samsung Open Source Group
What is JerryScript?
â—Ź A really lightweight JavaScript engine
â—Ź Has a base footprint of ~3KB of RAM
â—Ź Optimized for microcontrollers
â—Ź Developed from scratch by Samsung
â—Ź Actively developed on GitHub
â—Ź JerryScript is an open source project released under the
Apache License 2.0
5. 5Samsung Open Source Group
Why JavaScript on microcontrollers?
â—Ź There's a huge pool of JavaScript developers
â—Ź Opens up the possibility for web developers to easily write
software for embedded devices
â—Ź Performance overhead of JavaScript less of an issue for
control tasks
â—Ź Increased productivity, shorter time to market
â—Ź Ability to load code dynamically over the network
â—Ź Security: Executing JavaScript code is safer than executing
arbitrary native code
7. 7Samsung Open Source Group
JerryScript History
â—Ź Development started in June 2014
â—Ź Released as open source in June 2015
â—Ź JerryScript passed 100% of the test262 conformance test
suite in August 2015
â—Ź Rewritten compact byte code implementation landed in
January 2016
â—Ź Current focus on performance optimization
8. 8Samsung Open Source Group
JerryScript
â—Ź Heavily optimized for a low memory footprint
â—Ź Interpreter-only
â—Ź Compact object representation
â—Ź Compressed pointers
â—Ź No AST, directly creating byte code
â—Ź Compact byte code heavily optimized for low memory
consumption
9. 9Samsung Open Source Group
JerryScript Portability
â—Ź Extremely portable
â—Ź Self-contained
â—Ź Small C library
â—Ź Can run bare-metal
â—Ź Supports the STM32F4, ESP8266, Arduino 101, FRDM-
K64F boards
â—Ź OS support: NuttX, Zephyr, mbed, RIOT
â—Ź Runs on Linux/macOS as well
10. 10Samsung Open Source Group
Target hardware
â—Ź STM32F4 developer board
â—Ź Cortex-M4F clocked at 168 MHz
â—Ź 192KB of RAM
â—Ź 1MB of flash memory
11. 11Samsung Open Source Group
JerryScript
â—Ź Written in C99
â—Ź About 82KLOC
â—Ź Code size 156KB when compiled with GCC in LTO mode
for ARM Thumb-2
â—Ź Implements the entire ECMAScript 5.1 standard, passes
100% of the test262 conformance test suite
â—Ź C API for embedding JerryScript
â—Ź Byte code snapshot feature
16. 16Samsung Open Source Group
JerryScript on RIOT
â—Ź Ported JerryScript over to RIOT
â—Ź Without any prior knowledge of RIOT the port took only a
couple of days to complete
â—Ź Running RIOT on the STM32F4 board
â—Ź Ran into issue #4488 which causes crashes when writing
to the serial console
â—Ź RIOT now officially supported as a target OS in upstream
JerryScript
18. 18Samsung Open Source Group
Tetris Demo
â—Ź Implementation of the
classic Tetris game
â—Ź An LED matrix is used as
a display
â—Ź Written in JavaScript STM32F4 board
(192KB RAM, 1MB Flash)
Tetris
JerryScript
RIOT
LED Matrix
I2C
Switches via GPIO
21. 21Samsung Open Source Group
Future work
â—Ź Further performance and memory optimizations
â—Ź 1.0 release of JerryScript in the coming weeks
â—Ź Debugging support
â—Ź Memory profiling
â—Ź Support for more boards
23. 23Samsung Open Source Group
Summary
â—Ź Significantly lowers barrier of entry for JavaScript
development targeting heavily constrained embedded
devices
â—Ź Speeds up development
â—Ź Active community
â—Ź More information on http://samsung.github.io/jerryscript
â—Ź Looking for bug reports and feedback