Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and...

29
Next generation web for connected things IoT.js Samsung Electronics| Software Center | Piotr Marcinkiewicz 2017

Transcript of Next generation web for connected thingsNode.js vs. IoT.js IoT.js OS Node.js JS • Both Node.js and...

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

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

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

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

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

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

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

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

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

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

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

JerryScript

JerryScript • JerryScript is

lightweight JavaScript

engine

• It is intended for very

constrained devices.

• It supports snapshots.

RAM

64kB ROM

200kB

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Copyright ⓒ 2017 SAMSUNG ELECTRONICS. ALL RIGHTS RESERVED

THANK YOU

https://github.com/Samsung/iotjs