javascript* meets zephyr™ os · javascript* app business logic by the app developer javascript...

21
JavaScript* Meets Zephyr™ OS Sakari Poussa @spoussa Intel Zephyr is a trademark of the Linux Foundation. *Other names and brands may be claimed as the property of others.

Upload: others

Post on 21-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

JavaScript* Meets Zephyr™ OSSakari Poussa@spoussaIntel

Zephyr is a trademark of the Linux Foundation. *Other names and brands may be claimed as the property of others.

Page 2: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

OutlineWhy JavaScript*

Architecture

Arduino 101* Port

Building

Security and Memory Consumption

APIs and Roadmap

Browser IDE

Open Source Project

Demo

*Other names and brands may be claimed as the property of others.

Page 3: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

JavaScript™ Runtimes

*Other names and brands may be claimed as the property of others.

Page 4: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

JavaScript* Runtime for Zephyr OSEnable JavaScript application development on Zephyr OSAddress large JavaScript developer communityFast development cycle - No flashing, just copy .js filesGood tooling including browser based IDE and debuggingBased on open source JerryScript JS engine and API layerWell known JavaScript APIs (Node.js* like)Application portability between MCU and MPU platformsSupport now for Arduino101 and FRDM-K64F, all Zephyr OS supported boards in the future

WHAT

*Other names and brands may be claimed as the property of others.

Page 5: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

JavaScript* on Zephyr OS - BenefitsBig JavaScript developer communityWell known cross-OS APIsSingle skill set for device, client, gateway and cloud application developmentCode sharingDevelopment and simulation on host systems (PC)Fast development cycleBrowser based IDEEasy integration to cloud systems

WHY

*Other names and brands may be claimed as the property of others.

Page 6: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

Development FlowWHY

Edit

CopyRun

Edit

Compile

Reboot

Flash

Reboot

Run

MuchFaster

Development

Native JavaScript*

*Other names and brands may be claimed as the property of others.

Page 7: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

JavaScript* Runtime for Zephyr OSNode.js* is too big for MCU devicesWe need something like Node.js but smallerPoC: JavaScript Runtime for Zephyr OS based on JerryScript

Arduino 101 (256K ROM / 80 K RAM)Timers, BLE, PWM, AIO, GPIO, and OCF APIs

TargetSame APIs on Linux* and Zephyr OSSame JavaScript application runs (unmodified) on Linux and Zephyr OS, or even in the browser

HOW

*Other names and brands may be claimed as the property of others.

Page 8: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

ArchitectureJavaScript* App

Business logic by the app developer

JavaScript API LayerAPI bindings - NEWOpen source (Apache 2.0) - NOW

JS EngineMicro JS engine - JerryScriptOpen source (Apache 2.0)

IntegrationSeparate repo in GitHubMake pulls in all the dependencies

HOW

MCU

Zephyr

JerryScript

JavaScript API Layer

JavaScript App Application

JavaScript Runtime

JavaScript APIs

*Other names and brands may be claimed as the property of others.

Page 9: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

Build$ git clone [email protected]/01org/zephyr.js

$ cd zephyr.js

$ make

HOW

MCU

Zephyr OS

JerryScript

JavaScript API Layer

JavaScript* App

Building…

zephyr.bin$ make flash

*Other names and brands may be claimed as the property of others.

Page 10: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

Arduino 101* Port

Arduino 101*

X86 Core ARC Core

Zephyr OS / Drivers Zephyr OS / Drivers

ZJS Support ImageJavaScript Runtime

JavaScript* Application

IPC

*Other names and brands may be claimed as the property of others.

Page 11: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

SecurityBuild time

JavaScript* source is converted into C string and embedded into zephyr.bin imageJavaScript eval() function is disabledSpecial developer mode can be enabled via make command (make DEV=ashell)

RuntimeOnly the embedded JavaScript application is executedWeb pages or foreign scripts are NOT executed

Developer ModeJavaScript application is executed from Zephyr OS filesystemJavaScript application replaceable via USB or BLE using browser IDE or CLI tool

WHAT

*Other names and brands may be claimed as the property of others.

Page 12: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

Memory ConsumptionRuntime

The JS engine boot up memory is around 5 KB RAM

ApplicationDepends on the application and what it doesFor reference, JavaScript* application running on Zephyr OS/Arduino 101*

80K RAM/384 ROMBLE physical web advertisingBLE GATT service with two characteristics (temperature and LED)PWM and AIO for controlling temperature sensor and RGB LEDI2C for LCD200 lines of JavaScript code

WHAT

*Other names and brands may be claimed as the property of others.

Page 13: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

BLE

AIO

I2C

2.ConnecttoURL1.AdvertiseURL

4.ConnecttoBLEService 3.LoadApp

Web App

Android*Phone

ZephyrOS-hostedJavaScript*ApponArduino101*board

WebAppHostingCloud

5.Read&ControlDevice

Zephyr Project Booth Demo Details

*Other names and brands may be claimed as the property of others.

Page 14: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

Browser IDEOnly in DEV modeCopy-n-Run3rd Party IDEsCLI ToolsWeb USB - NEW

Zephyr OS

JS Runtime

Web USB

JavaScript* App

Host PCUSB/BLE

*Other names and brands may be claimed as the property of others.

Page 15: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

Demo Time

Page 16: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

JavaScript APIsAPI Zephyr OS Node.jsEvents Now Core APIBuffer Now Core APIBLE Now Bleno NPMGPIO, I2C, AIO, etc. Now Johnny-Five likeOCF Now IoTivity-node NPMCoAP Planned CoAP NPMMQTT Planned MQTT NPMW3C Sensors Planned TBDHTTP Planned Core API

Page 17: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

RoadmapWHEN

1H/16 2H/16 1H/17

Ø PoCØ Few APIsØ Arduino 101* support

Ø Subset of Node.js APIsØ OCF Ø BLEØ PIN and BUS AccessØ Copy-and-RunØ Browser IDEØ FRDM-K64F support

Ø More Node.js* APIsØ Power and BatteryØ CoAP, MQTTØ NFCØ Security and CryptoØ W3C SensorsØ Remote debugging

Page 18: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

Open Source Projecthttps://github.com/01org/zephyr.jsWe want people to participate and contributeAlpha quality statusSample CodeAPI documentationREADME

Page 19: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

SummaryJavaScript Application development on ZephyrOpen Source Project - Please JoinThis the first step - Let’s make many more together

Page 20: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

Questions ?

Page 21: JavaScript* Meets Zephyr™ OS · JavaScript* App Business logic by the app developer JavaScript API Layer API bindings - NEW Open source (Apache 2.0) - NOW JS Engine Micro JS engine

Thank You !

Please Visit Zephyr Project Booth for Demo