Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Eclipse Edje: A Java API for Microcontrollers

1,311 views

Published on

The Eclipse Edje project, initiated by MicroEJ, defines a standard high-level Java API for accessing hardware features delivered by 32-bit microcontrollers for using serial links, general purpose inputs/outputs, or digital/analog converters. MCUs are small, low-cost, low-power processors designed to run software in resource-constrained environments: low memory (typically KB), flash (typically MB) and frequency (typically MHz). MCUs are provided by silicon vendors along with evaluation kits and are typically the ideal vectors for large scale deployments of low-power and cost-effective IoT, embedded or wearable devices. Edje aims at unifying and easing the programming of apps for MCUs with the largely adopted Java language.

Published in: Software
  • New gender study 74% of men are more attracted to women who do this one thing, read more ■■■ http://ishbv.com/hissecret/pdf
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • NEW STUDY SHOWS 74% OF MEN ARE MORE ATTRACTED TO WOMEN WHO DO THIS, LEARN MORE ♥♥♥ https://bit.ly/315kzPF
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • What Every Man Is Obsessed Over, But Will Never Tell You. Click Here ■■■ https://tinyurl.com/y6enhezd
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • New study shows 74% of men are more attracted to women who do this, learn more ●●● https://tinyurl.com/y6enhezd
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Eclipse Edje: A Java API for Microcontrollers

  1. 1. © IS2T S.A. 2016. All rights reserved. EDJE PROJECT The Software Foundation for IoT Devices https://projects.eclipse.org/projects/iot.edje
  2. 2. Edje focuses on the following aspects EDJE API FOCUS Controller Communication Interfaces Serial Port CAN Digital and Analog I/O GPIO Peripheral Management LCD USB Devices Analog Input
  3. 3. Laurent Lagosanto Senior Architect at MicroEJ® 18 years of “Java in the Small” activities laurent.lagosanto@microej.com ABOUT THE PRESENTER The information contained herein is not warranted to be error-free. MicroEJ® and all relative logos are trademarks or registered trademarks of IS2T S.A. in France and other Countries. 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 site 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. Other trademarks are proprietary of their respective owners.
  4. 4. Independent Software Vendor, global player in the embedded IoT industry • http://www.microej.com/about • Software tool & runtime licenses • Professional services, training & consulting KEY FINANCIALS • $5M Series B funding end 2011 – $20M R&D total investment Offices in France, Germany, USA Expertise in embedded, virtualization, software engineering & process Partnerships with key IoT, silicon, embedded SW and HW (EMS) vendors ABOUT MICROEJ
  5. 5. PARTNERS & CONSORTIA – STRONG BUSINESS PARTNERS SERVICES HARDWARE SOFTWARE CLOUD ALLIANCES
  6. 6. OPERATING SYSTEMS FOR ENABLING THE IOT RTOS Linux Volume 75% IoT = “sub-gig” things: • Processor < GHz • Memory < GB 25% SW Foundation MPU (>$10 ASP)MCU ($1-6 ASP)
  7. 7. APPLICATION STORE FOR APPLICATION DEPLOYMENT SDK: OS & TOOLS FOR DEVICE SOFTWARE DEVELOPMENT STUDIO FOR APPLICATION DEVELOPMENT MICROEJ FLAGSHIP PRODUCT LINE
  8. 8. EDJE AND IOT INTRODUCTION
  9. 9. IOT TOPOLOGY & INTERACTIONS IOT DEVICES GATEWAY SERVER
  10. 10. IOT TOPOLOGY : DEVICES & GATEWAYS 8/16/32-bit MCU Mono-Core Frequency: < 200 MHz Flash: < 1 MB RAM: < 512 KB 32/64-bit MPU Multi-Core Frequency: in GHz Flash: in GB RAM: in GB MCU MPU IOT DEVICES GATEWAY
  11. 11. IOT HARDWARE EXAMPLES STM32F4 DISCOVERY Processor: 32-bits Cortex-M4 (STM32F407VGT6) Frequency: 168 MHz RAM: 192 KB Flash: 1 MB RASPBERRY PI 2 Processor: 32-bits quad-core Cortex-A7 (BCM2836) Frequency: 900 MHz RAM: 1 GB Flash: SD Card (GBs)
  12. 12. THE EDJE PROJECT Sensors/Actuators Local Network Internet A library at the edge of the IoT for sensor hubs and devices
  13. 13. Performance matters Almost no boot time, instantly-on Power efficiency, last for months, years Size matters Cost-effectiveness is key : footprint Size of the package Versatility matters Plethora of protocols (to hardware, and to cloud services) Shorten time to market by reducing development time IOT : WHAT MATTERS FOR EDGE DEVICES ?
  14. 14. AN EXEMPLE OF FOOTPRINT REDUCTION James Bauer James Bauer Reply Call me later Alex Jackson Hi there! I’ll be late, sorry. RTOS (Linux) + Java platform RTOS (Any/None) + Java platform Power 410 mAh – batteries recharge every day Batteries recharge every two or three weeks Processor Qualcomm Snapdragon 400 MSM8226, ARM based Quadcore 1.2 GHz ARM Cortex-M4 based MCU, 100 MHz RAM (data) 256 MB Less than 0.5 MB FLASH (Code + Resources) 2,000 MB 2 MB Boot Time 35,000 ms 50 ms 63% Bill of Materials savings 87% power consumption savings
  15. 15. ROM (KB) Standard mode ROM (KB) Tiny mode** RAM (KB) Application Total: 36.1 36.1 Total: 27.2 27.2 See below (52.0) Resources Images uncompressed Fonts Strings Total: 836.9 803.0 16.7 17.2 Total: 836.9 803.0 16.7 17.2 MicroEJ Platform EDC MicroUI, MWT, Motion Total: 198.0 24.1 172.9 Total: 143.0 19.2 123.8 52.0 (application heap, stacks) MicroEJ Sandbox MicroEJ software core (VM) MicroEJ RAM optimizer (GC) Total: 29.1 15.2 13.9 Total: 29.1 15.2 13.9 BSP RTOS Driver & Low Level API UI drivers Total: 108.4 13.4 54.5 40.5 Total: 108.4 13.4 54.5 40.5 1.5 522 (2x frame buffers WQVGA) + 1 Total without Resources Total with Resources 371 KB 1.2 MB 307 KB 1.1 MB 606.5 KB 606.5 KB TYPICAL REAL APPLICATION FOOTPRINT (KB) WASHING MACHINE ON ARM CORTEX-M4 / GCC **Tiny mode available when MicroEJ application code is below 256KB of flash
  16. 16. A Hardware Abstraction Java API for the embedded systems • Peripheral management • Controller Communication Interfaces (Serial connection, CAN, SPI, I²C) • Digital and Analog I/O (GPIO, ADC, DAC) Scope • Target resource-constrained devices (MCU & low-cost MPUs) • Provide ready-to-use software packages for target hardware • Define a modular and easy to port framework Project Status • Eclipse IoT project • Proposal approved, entered Incubation phase • Initial code drop end of July EDJE PROJECT
  17. 17. EDJE DEVICE CONFIGURATION
  18. 18. JavaSE List of minimum Java API The minimum execution environment provided by an Edje-compatible device Intersection between Java SE, Java SE Embedded, MicroEJ and Android EDJE DEVICE CONFIGURATION (EDC) JavaSE Embedded Android MicroEJ OS EDC
  19. 19. List of minimum Java API The minimum execution environment provided by an Edje-compatible device Intersection between Java SE, Java SE Embedded, MicroEJ and Android EDJE DEVICE CONFIGURATION (EDC) Edje Device Configuration Edje API Edje Application Library Execution Environment Application Framework Other APIs Other APIs Other APIs
  20. 20. Only core packages are included: java.lang (string, numbers, threads…) java.lang.annotation (may not be runtime) java.lang.ref (weak refs) java.lang.reflect (only the annotation part) java.io (no files) java.security (permissions) java.util (subset of collections) EDJE DEVICE CONFIGURATION (EDC)
  21. 21. These features are NOT included: • Network APIs • Storage APIs • Communication APIs • Graphics & User Interface Some may be added as Edje libraries, some don’t. Some may require native implementations, some don’t and can be downloaded. EDJE DEVICE CONFIGURATION (EDC)
  22. 22. EDJE API
  23. 23. Edje focuses on the following aspects EDJE API FOCUS Controller Communication Interfaces Serial Port CAN Digital and Analog I/O GPIO Peripheral Management LCD USB Devices Analog Input
  24. 24. Lists the peripherals of a platform • MCU peripherals (UART, timer, USB controller, …) • Board peripherals (screen, GPIO ports, button, LED, sensors, …) • External peripherals (USB devices, bluetooth devices, …) Peripheral plug/unplug notification system (event listeners) Two use cases: • Static peripherals: • Attached to the board or the MCU, they never appear nor disappear • applications can adapt to the target configuration • Dynamic peripherals • they can be unplugged from the device • applications can react to these events (e.g. an application can register a Z-wave plug “peripheral driver” because a USB serial port just appeared) EDJE API: PERIPHERAL MANAGEMENT
  25. 25. package org.eclipse.edje; interface Peripheral { HardwareDescriptor<? extends Peripheral> getDescriptor(); String getName(); Peripheral getParent(); Peripheral[] getChildren(); } interface HardwareDescriptor<P extends Peripheral> { String getName(); String getProperty(String propertyName); String[] getPropertyNames(); String[] getPropertyValues(); } EDJE API: PERIPHERAL MANAGEMENT
  26. 26. package org.eclipse.edje; class PeripheralManager { Iterator<Peripheral> list() Iterator<P> list(Class<P> peripheralType) P find(Class<P> peripheralType, String peripheralName) void addRegistrationListener(RegistrationListener<P> li, Class<P> type) void removeRegistrationListener(RegistrationListener<P> li) void register(Class<C> peripheralType, P peripheral) void unregister(P peripheral) } EDJE API: PERIPHERAL MANAGEMENT
  27. 27. EDJE API: PERIPHERAL MANAGEMENT SAMPLES // static use case: Iterator<Peripheral> peripherals = PeripheralManager.list(); while(peripherals.hasNext()) { Peripheral p = peripherals.next(); System.out.println("Edje periph : " + p.getName()); } // dynamic use case: PeripheralManager.addRegistrationListener(new RegistrationListener<MyDevice>() { public void peripheralRegistered(RegistrationEvent<MyDevice> event) { event.getPeripheral().myDeviceMethod(…); } public void peripheralUnregistered(RegistrationEvent<MyDevice> event){ } }, MyDevice.class);
  28. 28. Some peripherals can establish a connection to external devices • Serial Connection (UART) • Serial Peripheral Interface (SPI) • Inter-Integrated Circuit (I²C) • Controller Area Network (CAN) Such peripherals implement the Connectable interface: interface Connectable { Connection openConnection(String args) throws IOException; } EDJE API: COMMUNICATION INTERFACES List<CommPort> serialPorts = PeripheralManager.list(CommPort.class); for(CommPort serialPort : serialPorts){ // a connection is auto-closeable: try {Connection cnx = serialPort.openConnection("baudrate=115200;bitsperchar=8") { … } }
  29. 29. interface CommPort extends Peripheral, Connectable { } interface CommConnection extends StreamConnection { int getBaudrate(); int setBaudrate(int baudrate); } interface BitsInput { int getLength(); int readBits(boolean signExtends) int readBits(int[] data, boolean signExtends) … } interface BitsOutput { … } EDJE API : COMM PORTS
  30. 30. Manage I/O pins connected to the MCU, configuring them with different mode/options: Digital In/Out: General Purpose Input/Output (GPIO) • (input configurable in floating, pull-up or pull-down modes) LED, Buzzer, Button Analog In: Analog to Digital Converter (ADC) • Potentiometer, Temperature Sensor, Light Sensor Analog Out: Digital to Analog Converter (DAC) • Speaker, Light Dimmer Pulse Width Modulation: (PWM) • Motor EDJE API : DIGITAL AND ANALOG I/O
  31. 31. • A pin is identified by the port name and an ID • Port name can be • MCU specific EDJE API : DIGITAL AND ANALOG I/O PortAPortB
  32. 32. • A pin is identified by the port name and an ID • Port name can be • Board specific EDJE API : DIGITAL AND ANALOG I/O J1 J2 J3 J4
  33. 33. • A pin is identified by the port name and an ID • Port name can be • Standard / application dependent EDJE API : DIGITAL AND ANALOG I/O Digital Arduino Analog Arduino
  34. 34. interface GPIOPort extends Peripheral { enum Mode { DIGITAL_INPUT, DIGITAL_INPUT_PULLUP, DIGITAL_INPUT_PULLDOWN, DIGITAL_OUTPUT, ANALOG_INPUT, ANALOG_OUTPUT } void setMode(int pin, Mode mode); boolean getDigitalValue(int pin); void setDigitalValue(int pin, boolean value); int getAnalogValue(int pin); void setAnalogValue(int pin, int value); int getAnalogMinValue(int pin); int getAnalogMaxValue(int pin); } EDJE API : DIGITAL AND ANALOG I/O
  35. 35. STM32F746G-DISCO Cortex-M7 200 MHz RAM: 8 MB Flash: 16 MB EDJE API : DIGITAL AND ANALOG I/O SAMPLES Eth Audio USB-micro USB-micro USB-mini (STLink) SD Digital Arduino Analog Arduino
  36. 36. STM32F746G-DISCO Cortex-M7 200 MHz RAM: 8 MB Flash: 16 MB YWROBOT (Easy Module Shield v1) EDJE API : DIGITAL AND ANALOG I/O SAMPLES Eth Audio USB-micro USB-micro USB-mini (STLink) SD Digital Arduino Analog Arduino
  37. 37. EDJE API : DIGITAL AND ANALOG I/O SAMPLES
  38. 38. // Let’s blink a led GPIOPort gpio = PeripheralManager.find(GPIOPort.class, "ARDUINO_DIGITAL"); gpio.setMode(12, Mode.DIGITAL_OUTPUT); boolean toggle = true; while(true) { gpio.setDigitalValue(12, toggle); // that’s D12 toggle = !toggle; sleep(500); } EDJE API: DIGITAL AND ANALOG I/O SAMPLES
  39. 39. // Let’s read a potentiometer GPIOPort gpio = PeripheralManager.find(GPIOPort.class, "ARDUINO_ANALOG"); gpio.setMode(0, Mode.ANALOG_INPUT); int value = 0; while(true) { int value = gpio.getAnalogValue(0); // that’s A0 System.out.println("potentiometer value = " + value); sleep(500); } EDJE API: DIGITAL AND ANALOG I/O SAMPLES
  40. 40. If you combine the two, guess what you can get… DEMO
  41. 41. DEMO
  42. 42. PROJECT STATUS
  43. 43. Initial code drop (July 21st) • Submitted after Legal review • In develop branch, not master • Draft API Scope: • Peripheral Management • Connection API • No actual peripheral APIs (no GPIO, no CommPort, …) WHAT IS AVAILABLE
  44. 44. Updated / New API • Core API changes (generics, permissions) • CommPort API • GPIO API More tests Samples Reference implementation on MicroEJ OS AVAILABLE FOR ECLIPSECON EUROPE 2016
  45. 45. Features • Peripheral Management • UART, USB CDC, GPIO, DAC, ADC Hardware • STM32F746G-DISCO • Cortex-M7 @ 200 MHz • RAM: 8 MB • Flash: 16 MB Platform • MicroEJ OS • FreeRTOS • STM32Cube REFERENCE IMPLEMENTATION: ON MICROEJ
  46. 46. Features • Peripheral Management • UART, USB CDC, GPIO, DAC, ADC PC Simulation • Java® SE • Hardware In the Loop Simulation (HIL) REFERENCE IMPLEMENTATION: ON MICROEJ Execution Flow Ethernet or Serial
  47. 47. http://developer.microej.com/getting-started.html • MicroEJ Studio Installer • Firmware for STM32F746-DISCO, NXP K65, Renesas Synergy DK-S7 • Sample code • Hello world • Widgets • Network • Smartwatch • Store: communitystore.microej.com MICROEJ OS
  48. 48. More API PWM SPI I2C CAN Watchdog More Reference Implementations Edje / MicroEJ / Other boards WHAT’S NEXT
  49. 49. CALL TO ACTION
  50. 50. Features • Peripheral Management • UART, USB CDC, GPIO, DAC, ADC Hardware • Raspberry-Pi 2 • Quad-Cortex-A7 @ 900 MHz • RAM: 1 GB RAM Platform • Kura • OpenJDK • Linux OTHER REFERENCE IMPLEMENTATION: JAVA SE ?
  51. 51. THANK YOU FOR YOUR ATTENTION! https://projects.eclipse.org/projects/iot.edje

×