Java on VxWorks using Micro Runtime

4th May 2017
Posted By : Anna Flockett
Java on VxWorks using Micro Runtime

VxWorks Micro Runtime (MRT) is a Java engine that runs Java byte code on VxWorks real-time operating system (RTOS). For applications that run on multiple platforms, the same application code that runs on VxWorks can also run on Linux, Android, iOS, and Windows.

Guest blog by Ka Kay Achacoso.

VxWorks Micro Runtime is developed by Intel’s Software and Services Group (SSG) in collaboration with the Internet of Things Group (IOTG) and Wind River. The Java engine is highly optimised for Intel hardware. It is designed especially for Internet of Things (IoT) devices. The Intel Management Engine is powered by the same Micro Runtime engine. By running Micro Runtime on VxWorks on Intel hardware, applications can take advantage of both the real time properties of VxWorks and the performance optimisations of the Java engine.

Java 3rd party libraries
A big advantage of Java is the abundance of 3rd party libraries available to the Java community. Developers can easily pick up technology implementations, some of these having run through several iterations of developer community vetting. As a test run, two common IoT end-device technology libraries were picked up.

The first technology, MQTT, works on a publish-subscribe model. An MQTT broker runs on a server. An MQTT subscriber subscribes to the broker for messages of a certain topic.  An MQTT publisher publishes messages of a specific topic to the broker. This way, an MQTT publisher can transfer data to MQTT subscribers.

The Eclipse Paho Java Client is an MQTT client library. Using this library, a VxWorks Micro Runtime application can publish messages or subscribe to messages when connected to an MQTT server, such as Mosquitto running on Linux.

Here is the Eclipse Paho Java MQTT publisher in action on VxWorks Micro Runtime. Using just the sample application provided with the library, the MQTT client publishes a message to the broker, and a separate subscriber receives the message.

> Connected to broker.
Message published to broker.

Running this Java application on a mini-ITX board with an Intel Core i7 processor, the Micro Runtime Java engine is supported on all Intel modern Quark, Atom, Core, and Xeon  processors, as well as the NXP i.MX6 processors.

The execution on the VxWorks MQTT publisher is boring. The more interesting part is what the MQTT subscriber can do with the published messages. With a few modifications on the Java client to publish more interesting data, we can use any freely available MQTT subscribers to view data. 

Figure 1 is a screenshot of the TeleMecha iPhone app that maps out the data from VxWorks.

The exact same Java class byte code files run on Oracle Java SE with no modifications. Here it should be pointed out that VxWorks Micro Runtime does not use jar files and class files directly. Instead, a file in JEFF format derived from the jar files and class files serves as input to the VxWorks Micro Runtime engine. The JEFF format is an ISO standard. It is a popular byte code format for embedded Java because of its compact size.  You can get information about the JEFF file format here.

As a Java application, it first ran the MQTT publisher on the Windows host development laptop, and spent a few tight iterations tweaking the application. Once the application code stabilised, the Java class files used on the Oracle Java Virtual Machine (JVM) were built into a jeff file and ran with no further tweaks on VxWorks.  The process of moving the application from a Windows platform to a VxWorks platform worked smoothly.

The second IoT technology tested was the RESTful web services for access to many services in the cloud.  Resty is a simple HTTP REST client for calling REST APIs. 

Using the Resty client library, there is the ablilty to use VxWorks Micro Runtime to get current stock prices from Markit On Demand.

The response in JSON format was parsed to provide stock price information. It was just as easy setting up the application to run on Oracle Java SE as it was to run on VxWorks Micro Runtime, and they yielded the same results.

Company:  Intel Corp
Symbol:  INTC
Price: $36.07
Time:  Fri Mar 31 00:00:00 UTC-04:00 2017

Java Native Interface
Running Micro Runtime on VxWorks has the advantage of enabling a Java application to make use of real time properties of VxWorks.  One subsystem can run as C application, and Java Native Interface (JNI) can be used to switch from a C context to a Java context.

The following vibration sensor application illustrates use of JNI in VxWorks Micro Runtime. A set of sensitive accelerometers and strain gauges are mounted to a bridge for structural testing. A VxWorks real time application written in C calculates the tremor magnitudes and frequencies from the sensor readings. 

An Micro Runtime Java application uses JNI to access these calculations. Using readily available 3rd party libraries, the Java application publishes the tremor calculations to an MQTT broker, and the data can be visualised, or can be analysed further to make predictions.

The Micro Runtime application uses the Resty client library to access OpenWeatherMap web API to retrieve the prevailing wind speed and direction and compensate for some of the wind movement.

The result is a graph on my TeleMecha MQTT app showing vibration spikes corresponding to a car crossing the bridge.  In this particular physical setup, only a single accelerometer was used and placed for a few minutes on a local bridge.

On VxWorks, the query for wind speed at the same location showed some slight winds.

Time:  4/7/17 2:35PM
Location:  Alameda
Temperature: 16.08°C
Wind speed: 6.2m/sec

The Micro Run time application shown here takes advantage of JNI to access real time functionality, 3rd party IoT libraries for efficient code reuse, and deployment of the same application on multiple platforms for fast development.

Debugging on VxWorks Micro runtime
The VxWorks integrated development environment is Wind River Workbench, an Eclipse-based tool for developing, debugging, and testing VxWorks applications.  To debug the Java application, Workbench connects to the Java engine executing on VxWorks.  Once connected, breakpoints can be set, step through Java code, read variable values, and evaluate expressions.

With the use of VxWorks Micro Runtime java engine and Wind River Workbench development environment , this application was fairly simple to put together.  The benefits of using the Java programming language was evident in the short development timeline.

You can find VxWorks Micro Runtime product information here.

Courtesy of Wind River.


You must be logged in to comment

Write a comment

No comments




Sign up to view our publications

Sign up

Sign up to view our downloads

Sign up

IFSEC 2019
18th June 2019
United Kingdom EXCEL, London
Sensor+Test 2019
25th June 2019
Germany Nürnberg Messe
The Digital Healthcare Show 2019
26th June 2019
United Kingdom EXCEL, London
unbound london 2019
17th July 2019
United Kingdom Old Truman Brewery, London
DSEI 2019
10th September 2019
United Kingdom EXCEL, London