+ All Categories
Home > Documents > Java application platforms for design-to-cost embedded systems · Java application platforms for...

Java application platforms for design-to-cost embedded systems · Java application platforms for...

Date post: 22-Jun-2020
Category:
Upload: others
View: 7 times
Download: 0 times
Share this document with a friend
35
Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T www.is2t.com Java™ is Sun Microsystems' trademark for a technology for developing application software and deploying it in cross-platform, networked environments. When it is used in this documentation without adding the "™" symbol, it includes implementations of the technology by companies other than Sun. Java™, all Java-based marks and all related logos are trademarks or registered trademarks of Sun Microsystems Inc, in the United States and other Countries.
Transcript
Page 1: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Java application platforms for

design-to-cost embedded systems

Régis Latawiec, COO

IS2T

www.is2t.com

Java™ is Sun Microsystems' trademark for a technology for developing application software and deploying it in cross-platform, networked environments. When it is used in this documentation without adding the "™" symbol, it includes implementations of the technology by companies other than Sun. Java™, all Java-based marks and all related logos are trademarks or registered trademarks of Sun Microsystems Inc, in the United States and other Countries.

Page 2: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Embedded Processing Market Share

Source: ARM

Page 3: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Develop software applications and leverage innovations

at low Total Cost of Ownership.

IS2T - Solutions for Embedded Innovations

Edge Devices Gateway Cloud

Portability across all hardware and software environments

microcontrollers < $5

microprocessors < $15

Page 4: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Embedded Market Maturity

• Like servers, workstations and smartphones…

• … cost constrained embedded systems now look at 3rd

party “platform” procurement

Service platforms

OS & BSP

Processors

Applications

Mature for big

embedded

systems like

Android, iOS, Linux

Mature

(buy)

Page 5: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

MicroEJ Platforms

HARD REAL

TIME

EDITION

HARDWARE

AS A SERVICE

EDITION

EMBEDDED

DEVICE

EDITION

Microcontrollers

Microprocessors

Mobiles

Keil RTX, uCOS, ThreadX, FreeRTOS…

(ARM Cortex M, Renesas RX, …)

Web

Linux, VxWorks, Integrity, PikeOS

(Cortex A, MIPS, …)

iOS, Android

Cross

Platform

Environments

MicroEJ Editions

MacOS, Linux,

Windows

Page 6: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Java Platforms Concept for Embedded systems

Different JVM architectures to fit different architecture flavors

/**

* Java

• Copyright 2009-2012 IS2T.

All rights reserved.

* For demonstration purpose only.

* IS2T PROPRIETARY. Use is

subject to license terms.

*/

package

com.is2t.appnotes.microui.mvc;

import java.io.IOException;

import ej.microui.EventGenerator;

import ej.microui.io.Display;

import ej.microui.io.FlyingImage;

import ej.microui.io.Image;

import ej.microui.io.Pointer;

/**

* Shows three views (bar, pie,

text) that represents the same

data model (a percentage value).

* It is possible to resize the

JVM

RTOS Libs

JVM

RTOS Libs

JVM

RTOS Libs

Java language

MicroEJ Virtual Machines

(JVM – mostly software processors)

Microprocessors

Java technology

Page 7: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Optimized MicroEJ® VMs

• Code quality

• Productivity

• Reliability

• Portability

• Scalability

• Maintainability

• Code density

• High speed execution

• Determinism (HRT)

• Tiny footprint

• Interface C/asm

• Low power, etc.

Java Java

Optimized

implementation

32/64-bit

CPU

32-bit

MCU/MPU

Page 8: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Embedded Java Platform Example

• STM32F2x (Cortex-M3) – 120MHz

• 16-bit col. QVGA LCD, Touch

• APIs: B-ON, MicroUI, MWT, SNI

• Boot time (reset to main(String[] args)): 2ms

Application Memory Requirements

Flash (ROM) 422KB RAM 42KB

Virtual Machine (runtime & GC) 28KB Virtual Machine 1KB

Libraries (graphics, com, float…) 132KB Native Stack 28KB

Graphical resources (images) 228KB

Application 34KB Application 13KB

Java needs

Page 9: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

GUI Examples on STM32 MCUs

Eclipse IDE

Page 10: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

EMBED JAVA TO A LEGACY C BASED

APPLICATION

MicroEJ Embedded Devices Edition

Page 11: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

What is a MicroEJ Embedded Platform?

• Dual Java Platform

» Embedded platform (EmbJPF)

» Simulated platform (SimJPF)

• Integration with legacy

» RTOS if any

» Firmware & Driver

• General purpose

» CLDC/EDC, BON, NLS

• Special packs

» UI, IoT, Num, SOA

MicroEJ® platform

Operating System

Hardware

BSP (firmware)

Application software

EDC

CLDC

Java Virtual Machine

B-ON Simple Native

Interface

C/C

++

Mid

dle

wa

re

Shielded Plug

Embedded

UI

Internet Of

Things

Numerical

Processing

NLS

ECLASSPATH

Bundle

Framework

Page 12: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

MicroEJ SDK

• Java platform design

» Integrate to your RTOS

» Interface to your C code

» Supports ARM-Keil, GNU, IAR,

GreenHills, Windriver

• Java application design

» Java project editor

» Simulate to prototype and debug

» Analyze memory usage

» Deploy

Page 13: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Easy RTOS Integration (Green Thread)

• Multi-threaded Java execution environment within a

single RTOS task

RTOS Examples

● µC/OS, ThreadX, RTX

FreeRTOS

● Linux, Integrity, VxWorks

● Your RTOS!

RTOS

Native tasks

(C/ASM)

1x native task

(Java)

GUI hardware

LCD, buttons, …

Applicative hardware

Sensors, actuators, …

Ja

va

th

rea

ds

Shielded Plug (SP)

Simple Native Interface (SNI)

SP

SNI

SP

SNI

Page 14: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Easy RTOS Integration (Green Thread)

• Same Java thread scheduling policy for all RTOS

» Portability improved

Not only at binary level, but also scheduling level

• Easy control of CPU resource usage for Java world

» Java RTOS task priority setting for Java world

» CPU resource allocation irrespective of the number of threads

• Java threads & native Tasks synchronization means

» Allows synchronous and asynchronous Java / native calls

Page 15: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Easy Java → C Interface (Calls 1/2)

• SNI (ESR 012) : Simple Native Interface

• Call Java world → C/asm

• Arguments: base types (int, float, double , char)

www.e-s-r.net

T

I

M

E

Immortals

Java heap

C heap

Java methods

C functions

Call C

Return to Java

Page 16: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Easy Java → C Interface (Calls 2/2)

• Easy mapping using naming convention

package GPIO;

public class Main {

public static native void toggle();

public static void main(String[] a) throws InterruptedException

{

while(true){

toggle();

Thread.sleep(10);

}

}

}

#include <sni.h>

#include “gpio.h”

void Java_GPIO_Main_toggle(){

GPIOE->ODR ^= GPIO_Pin_2 ;

}

Page 17: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Easy Java ↔ C Interface (Data 1/2)

• SNI (ESR 012): Simple Native Interface

• Share arrays of base types

• Zero copy buffers and compatible with DMA systems

www.e-s-r.net

T

I

M

E

Immortals

Java methods

C functions

Java heap

C heap

Page 18: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Java → C Interface

• Immortals are used to share data memory between Java

and C

#include <sni.h>

jint Java_com_corp_examples_Hello_getData(jint* array){

array[0] = 0xBEEF;

return 1 ;

}

package com.corp.examples;

public class Hello {

static int[] array = (int[])Immortals.setImmortal(new int[50]);

public static native int getData(int[] array);

public static void main(String[] args){

int nb = getData(array);

}

}

Page 19: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Shielded Plug for Safe & Easy C Integration

• Communication between two

separated worlds

(Java & native like C/asm)

• Pooling or notification event

types

• Spatial & temporal decoupling

• Ideal to add Java tasks on top

of a legacy C program

Field_1

Field_2

Field_n

User A

User B

Producer

A

Producer

B

events

Sub

scribe

rs Pu

blis

he

rs

Page 20: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Shielded Plug Java Read Example <shieldedPlug>

<database name="Forecast" id="0" immutable="true" version="1.0.0">

<block id="0" name="WIND" length="8" maxTasks="1"/>

<block id="1" name="TEMP" length="4" maxTasks="1"/>

<block id="2" name="THERMOSTAT" length="4" maxTasks="1"/>

</database>

</shieldedPlug>

public class Wind {

public int speed; //in ms [0..]

public int direction; //in degree [0..360]

}

public class WindReader implements SPReader {

private static final int SPEED = 0;

private static final int DIRECTION = 4;

public Object readObject(ShieldedPlug database, int blockID) throws

EmptyBlockException {

Wind w = new Wind();

byte[] data = new byte[database.getLength(blockID)];

database.read(blockID, data);

w.speed = ByteArray.readInt(data, SPEED);

w.direction = ByteArray.readInt(data, DIRECTION);

return w;

}

}

Page 21: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Shielded Plug C Publish Example

#include <sp.h>

struct Wind {

int32_t speed;

int32_t direction;

};

void windPublication(){

struct Wind w;

ShieldedPlug database = SP_getDatabase(Forecast_ID);

w.speed = speed();

w.direction = direction();

SP_write(database, Forecast_WIND, &w);

}

Page 22: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Extend the Simulation Platform

• Why building your simulator?

» Prototype before having hardware available

• Build your virtual device for UI

» Front Panel Designer (buttons, LCD display, LEDs, etc.)

• Build your peripheral extensions (mocks)

» Software mocks in Java or C connected to the simulation engine

» Hardware mocks over workstation communication interfaces

Simulated Platform (SimJPF) Embedded Platform (EmbJPF)

SW Mocks

S3

HW Mocks

Shared Libraries

Firmware MicroJvm®

Hardware

Page 23: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Extend the Simulation Platform

Mock Front Panel

Mock

Custom (LED)

Mock Interface

Native Interface

JVM (S3)

Application

public void runTest(Display display,

String message) {

MessageViewable viewable = new

MessageViewable(display);

viewable.init("Hello, world!);

viewable.show();

}

public static void blink() {

while (true) {

toggle();

try {

Thread.sleep(1000);

} catch (InterruptedException e) {

}

}

public static final native boolean

toggle();

public class LED {

private boolean state;

public static boolean

toggle() {

state = !state;

if (state) {

drawImage("ledOn.png");

} else {

drawImage("ledOff.png");

}

return state;

}

}

Simulated Java Platform

Page 24: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

APPLICATION PLATFORMS FOR

SMART OBJECTS (IOT)

MicroEJ - Hardware as a Service

Page 25: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

HaaS for Home Energy Management

HaaS

platform

3rd party services

Service Provider

Dynamic

Service

Deployment

Admin Platform

Remote terminal

ARM Cortex M0+

ARM Cortex M4

Page 26: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

HaaS for Wearable Electronics

ARM Cortex M4

ARM Cortex M0+

Autonomous HaaS platform

Page 27: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

IoT Market Challenges

• Energy efficiency

» No bloatware!

• Cost Effectiveness

» Small execution environments

• Rich Eco-Systems

» More software enablers for innovative business models

• Reliability

» Data integrity, service management

• Security

» Virtualization, resource management

Page 28: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

Solution Alignment

• Various topologies for gateways and edge devices

• Time-to-Market can not wait for specific system

availability

Need unified and portable execution environments

Service Platforms

Hardware Platforms

Processors

Applications

OS & BSP

Service Mgt

Objects

Services

Page 29: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

HaaS Platform Overview

Edge Objects Cloud

Application 1 Application n MicroEJ HaaS

Service1

Service n

Gateways

Page 30: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

New Capabilities

• Let marketing try new ideas

» Try new services fast

• Share your platform with your Eco-System

» Provide an open platform with safe isolation capability

• Let your customer choose a product configuration

» In the field dynamic service deployment and activation

• Keep using your legacy device base

» Use ubiquitous technology with low constraints on hardware

Page 31: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

MicroEJ® Haas Architecture – Kernel

• Standalone

(independent from Features)

• Manage Features

» Life cycle

» Resource allocation

• Native code allowed

Hardware Platform

Appli 1 Appli 2 Appli n MicroEJ VM

EDC

profile K&F

(Kernel &

Features)

Libs (Ecom, File,

etc.)

Component Framework (OSGi)

Application Domain Kernel

Feature 1

Feature

2

Feature

n

Rel

iab

le

No

t re

liab

le

Page 32: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

MicroEJ® HaaS Architecture – Features

• Rely on Kernel APIs

• Cannot directly access to other

Features (code, objects,

threads) → use Kernel as a

proxy instead

• Full virtualization

(no native code allowed)

Hardware Platform (incl. BSP)

Appli 1 Appli 2 Appli n MicroEJ VM

EDC

profile K&F

(Kernel &

Features)

Libs (Ecom, File,

etc.)

Component Framework (OSGi)

Application Domain Kernel

Feature 1

Feature

2

Feature

n

Rel

iab

le

No

t re

liab

le

Page 33: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

K&F Key Features

• Low consumption & OS agnostic

» Kernel & Features: ~20KBytes

» Run the same on any RTOS

• Ressources management

» CPU and memory allocations

» All I/O : file system, TCP/IP, UART, USB, etc.

• Stable & Secure

» Kill of a Feature (group of bundles) feasible at any time

Threads + objects + code

» No back door

Page 34: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

K&F and OSGi

• Bundle life cycle management

» Load/unload, enable/disable

• Resource management

» Bundles cannot access to larger CPU and memory resources than required

» Bundles cannot access to physical resource when not allowed to

• Isolation

» Bundles is isolated from each others and interface according to the rules defined by the Kernel

• Stable & Secure

» Unload has no impact on other Bundles

» No stale reference, no zombie threads, etc.

Page 35: Java application platforms for design-to-cost embedded systems · Java application platforms for design-to-cost embedded systems Régis Latawiec, COO IS2T Java™ is Sun Microsystems'

THANK YOU!

More information: www.is2t.com

Evaluation kits: is2t.microej.com


Recommended