next generation web for connected thingsnode.js vs. iot.js iot.js os node.js js • both node.js and...
TRANSCRIPT
![Page 1: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/1.jpg)
Next generation web for connected things
IoT.js
Samsung Electronics| Software Center | Piotr Marcinkiewicz
2017
![Page 2: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/2.jpg)
Introduction
Architecture
Node.js vs. IoT.js
APIs
You are invited
Community
Q&A
01
02
03
04
05
06
07
Agenda
![Page 3: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/3.jpg)
Introduction
RAM
200kB MCU
200MHz
JavaScript
IoT.js • Node.js and IoT.js provide
same experience
• RAM and FLASH
requirement is ~200kB
• MCU (Micro controller unit)
• No MMU nor GPOS
• MCU is cheap and ultra low
power
![Page 4: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/4.jpg)
Introduction
IoT.js • IoT.js can be compiled for
Linux PC
• It works also for ARM Linux
devices like Raspberry Pi 2/3
• The major target is MCU
• STM32F4 is supported with
Nuttx OS
• Artik053 is supported with
TizenRT OS
![Page 5: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/5.jpg)
Introduction
Artik 053 • 32-bit ARM® Cortex® R4 @ 320MHz
for applications
• 29 GPIO, 2 SPI, 4 UART, 4 ADC, JTAG,
2 I2C
• 5-12 VDC input
• 1280 kB RAM, 8MB flash
• TizenRT RTOS
https://github.com/Samsung/TizenRT
![Page 6: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/6.jpg)
Architecture
JerryScript
API
JavaScript
service
IoT.js • JavaScript service can access
hardware and network using API
• It doesn't have graphical user
interface
• JavaScript is executed in
JerryScript virtual machine at
device
• JS API is implemented using OS
API (SYSFS, Peripheral API)
![Page 7: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/7.jpg)
Architecture
JavaScript service
System API JerryScript
IoT.js
libtuv
Operating System
![Page 8: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/8.jpg)
Node.js vs. IoT.js
IoT.js
OS
Node.js
JS • Both Node.js and IoT.js provide
runtime environment for
JavaScript
• GPOS – general purpose
operating system,
• RTOS – real time operating
system,
• V8 – JavaScript engine from
Chromium
![Page 9: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/9.jpg)
Node.js vs. IoT.js
Basic
API
Peripheral
API
Addons
API
IoT.js Node.js
V8
ECMA7
Jerry
Script
ECMA5.1
libuv libtuv
RTOS
MCU
API
Architecture
Platform
Hardware
JS engine, system I/O
GPOS
CPU
![Page 10: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/10.jpg)
Node.js vs. IoT.js
IoT.js Node.js
• Easy to extend
• More features
• Better CPU
utilization
• Easy to port
• More OSes
• Both CPU and
MCU support
![Page 11: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/11.jpg)
JerryScript
JerryScript • JerryScript is
lightweight JavaScript
engine
• It is intended for very
constrained devices.
• It supports snapshots.
RAM
64kB ROM
200kB
![Page 12: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/12.jpg)
JerryScript
JerryScript
• JerryScript supports full
ECMA 5.1 and some
ECMA 6 (Typed Array,
promise)
• https://github.com/jerrys
cript-project/jerryscript
ECMA 5.1
C99
![Page 13: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/13.jpg)
APIs
JS
API
C
Module • Modules are implemented using
C and JavaScript
• C language provides direct
binding from OS API to
JavaScript
• JavaScript defines objects and
validates API calls from
application
![Page 14: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/14.jpg)
APIs
src
js modules
file.js
file.c
file.c
platform
file.js
file.c
file.c
file.c
file.c
Runtime C
implementation
Runtime JS
and modules JS
implementation
compiled into snapshot
Generic module C
implementation
Platform specific
module C
implementation
os_xxx
os_xxx
![Page 15: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/15.jpg)
APIs
Basic API
Node.js style IoT.js style
System
Core
Internet
Extended API
Hardware
Communication
![Page 16: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/16.jpg)
APIs
Basic API
Node.js style
System
Core
Internet DNS HTTP
Net HTTPS*
FS Process Stream
Module Events Console Timer
Buffer
![Page 17: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/17.jpg)
APIs
IoT.js style
Extended API
Hardware GPIO PWM
ADC
I2C SPI
BLE UART Communication
UDP
![Page 18: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/18.jpg)
APIs
GPIO
![Page 19: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/19.jpg)
Copyright ⓒ 2017 SAMSUNG ELECTRONICS. ALL RIGHTS RESERVED
You are invited
https://github.com/Samsung/iotjs
![Page 20: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/20.jpg)
Compilation and CI
Install
Check
Precommit
Build
.travis.yml tools
root folder
![Page 21: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/21.jpg)
Dependencies
jerryscript-project/jerryscript
Samsung/http-parser
Samsung/libtuv
Samsung/TizenRT
Nuttx (Bitbucket)
jerry
http-parser
libtuv
git
submodule
tizenrt
nuttx
precommit
![Page 22: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/22.jpg)
Build process
precommit.py
build.py
http-parser
libtuv
jerryscript
IoT.js
configure
environment deploy test
![Page 23: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/23.jpg)
Tools - install and check
• install: apt-get-install-*
• arm (RaspberryPi)
• nuttx
• tizenrt
• tizen
• travis
• check:
• license
• signed
• test
• tidy
![Page 24: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/24.jpg)
Tools - precommit tests
precommit.py --test flag passes 3 flags to build.py
arch os board
host-linux (tests are executed)
default (x86*) default (linux) default (undefined)
rpi2 arm default
rpi2
artik10 arm tizen artik10
artik053 arm tizenrt artik05x
nuttx arm nuttx stm32f4dis
![Page 25: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/25.jpg)
Folders
IoT.js folders:
• docs – JS API description, build guides
• src – source code of all major components
• tools – build and configuration Python
scripts
• test – JavaScript tests
• samples – JavaScript sample services (e.g.
blink a LED)
![Page 26: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/26.jpg)
Folders
IoT.js folders:
• deps – dependencies compiled with IoT.js
• cmake – cmake configuration for IoT.js
and submodules
• config – configuration for Tizen, TizenRT,
Nuttx
• include – library header
![Page 27: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/27.jpg)
Community
• 48 contributors
• 889 commits
• 266 forks
• 1420 stars
• IRC: freenode.net #iotjs
• Group: [email protected]
![Page 28: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/28.jpg)
Copyright ⓒ 2017 SAMSUNG ELECTRONICS. ALL RIGHTS RESERVED
Q&A
https://github.com/Samsung/iotjs
![Page 29: Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and IoT.js provide runtime environment for JavaScript • GPOS – general purpose](https://reader034.vdocuments.site/reader034/viewer/2022042910/5f40a92fa61074040f6ac813/html5/thumbnails/29.jpg)
Copyright ⓒ 2017 SAMSUNG ELECTRONICS. ALL RIGHTS RESERVED
THANK YOU
https://github.com/Samsung/iotjs