Eclipse tackles Java API for IoT
Getting to the 20 billion IoT devices by 2020 that analysts predict is going to require a lot of developers to work really fast. One way to help speed that development is to abstract the application side from the hardware side so that many different end products can come from just a handful of hardware platforms. The Eclipse Foundation has opened a project that promises to do just that: Eclipse Edje.
The Eclipse Edje Open Source IoT Project, announced at EclipseCon last week, will define a set of application programming interfaces (APIs) for resource-constrained devices that provide the basic services essential to IoT applications. It aims to deliver a standard library that forms a hardware abstraction layer (HAL) for key microcontroller functions such as GPIO, PWMs, LCDs, UARTs, and the like. The project will initially utilize code contributions from MicroEJ but welcomes and encourages new contributors to work through the Eclipse Foundation.
The advantages to this approach are legion. For one, it allows application software developers to work without needing hardware in hand or even fully defined. As long as the hardware will provide the basic resources that the APIs call for, the software won't really care. So not only can apps developers work without hardware ready, the apps they create will run on any hardware supporting the API.
True, this does mean that the HAL will have to be ported to the project hardware once it really is ready, but that shouldn't be as great a task as creating the app. Further, the Edje project aims to (eventually) provide reference implementations for available hardware and software platforms. If the development team is using one of these existing platforms, then the porting is already done. At worst, there is a working template that the team can follow in porting to its unique platform.
Currently, the Edje project is targeting 32-bit ARM processor implementations. This means that processors from companies like Microchip, NXP, Renesas, and STMicroelectronics will be readily usable in an Edje implementation. Some of the initial reference hardware mentioned in the MicroEJ presentation of the project include the STM32F746G DISCO board and the Raspberry Pi 2. These examples – a 200 MHz, 16M Flash machine to a 900 MHz, 1 GB machine – reflect the range of applicability for the HAL – in part. The project aims to support 32-bit devices with as little as 32 kB of RAM and 128 kB of Flash running at 16 MHz, such as Cortex-M0 products.
The Edje APIs are for the Java language. The implementation of Java Edge will use is the intersection Java J2SE, Java J2SE Embedded, MicroEJ, and Android. It includes java.land, java.util, java.io, and the like. They provide three basic services as a minimum: controller communication interfaces, peripheral management, and digital and analog IO. The controller interfaces currently include UART, SPI, CAN, and I2C. Peripheral management provides a list of the peripherals on the platform (MCU on-chip, devices on-board, and external devices) and notifies when they are unplugged or plugged in. The IO services take their look and feel from Arduino and provide the ability to manage individual controller pins. The API identifies pins by their port and an ID and can handle MCU-specific, board-specific, or industry-standard (like Ardiuno) identities.
Java has been tried before as the foundation of an IoT platform. Projects such as Eclipse's KURA, the OpenJDK project, and even Android have used relatively large, powerful hardware systems. But none has proven scalable to the microcontroller arena. Edje aims to overcome their limitations and bring Java programmability to even small IoT designs. Whether or not this specific project achieves its goals or gains wide acceptance, it is a harbinger for what IoT development must ultimately become. As I noted in my blog Platforms are the future of embedded development, the traditional approach of creating custom hardware with targeted, hand-crafted software is becoming sidelined. Approaches like the Edje project will continue to arise and serve as the foundation for a growing majority of IoT designs.