Mention Java to embedded developers and most will think of the desktop, the enterprise and embedded applications running on platforms like Android. Few will talk about Java applications running on embedded platforms as native code. C and C++ are the tend to be the languages of choice for native code applications in this realm.
Still, embedded Java is not a new idea. It has been practical and in fact the language of choice for many embedded applications especially where safety is involved. It can even handle real time chores although the version I looked at was for x86 platforms (see Hands On Real Time Java - Atego PERC). You can even check out how to do digital audio with Java (see Yes, You Can Do Digital Audio With Real-Time Java).
One challenge of getting Java up and running on a platform. Of course, to do that you need to get the right configuration for Java on the development platform.
IS2T put together just such an environment in conjunction with STMicroelectronics to highlight ST's STM32 microcontroller and IS2T's MicroEJ development suite. The STM3220G-JAVA (Fig. 1) combines the two.
The board sports ST's STM32F207IGH6 (Fig. 2) that is part of the STM32 F2 family based on Arm's Cortex-M3. The Cortex-M3 is not quite up stature of the Arm Cortex-A8 found in Raspberry Pi (see Will the Raspberry Take A Slice Out Of Apple's Pie) or in Gumstix's Overo AirStorm (see TurtleCore Tacks Cortex-A8 On To iRobot Create). The Cortex-A8 can run Linux, even Ubuntu.
Still, the Cortex-M3 is ideal for a range of embedded applications and sips power compared to the Cortex-A8. The STM F2 runs at 120 MHz. It has a meg of flash. A bit small for Linux but more than enough for a wide range of embedded applications including ones based on Java. It also has 132 Kbytes of RAM and a range of peripheral interfaces. These include CAN, Ethernet, I2C, IrDA, LIN, MMC, SPI, UART/USART, and USB OTG.
The board addes a 3.2-in, 240x320 TFT color LCD with touch screen support. The software includes support for MicroUI and the Micro Widget Toolkit. It also has an LIS302DL MEMS accelerometer. Peripheral interfaces are connected to a potentiometer, a joystick with 4-direction control and a selector wakeup, tamper and user buttons. The reset button is not placed well as it is inline with the other buttons and joystick.
There are USB and serial ports. The Ethernet port includes an integrated TCP/IP stack. There is even a SmartCard interface in addition to the SD card interface.
The board comes with a demo app to show off the capability of the system (Fig. 3). The main interface provided access to half a dozen applications. They highlight the GUI widgets as well as the performance of the system and its peripherals. For example, there is a game that uses the accelerometer to simulate rolling a ball around a maze.
Installing the tools was the next step once I found the board working correctly. The MicroEJ is based on the Eclispe IDE. The IDE is open source but the compiler and other tools are not. The limitations are based on the the latter.
Installation was uneventful and the USB connection to the board as simple as expected. It utilizes ST's STLink debug interface. The board can also be used without Java using this interface and even the IDE. It just takes more configuration.
The initial screen (Fig. 4) with the IDE gets one started quickly. It would be nice if all the docs were available before installation but this works well enough. The basic Hello World style app is not as impressive as the demo app but enough to get any programmer working.
I have had plenty of experience with Eclipse, Java and embedded development so this was not new but I did not find any issues that would cause a new embedded developer problems. The MicroEJ IDE (Fig. 5) is the typical Eclipse interface so no major surprises.
Still, Java developers that typically utilize desktop or enterprise platforms will notice a bit of a difference because MicroEJ has an ahead-of-time (AOT) compiler like C and C++ in addition to a just-in-time (JIT) compiler. The latter is for dynamic loading of classes. The AOT compiler is what most embedded applications will use and the JIT is only needed if dynamic loading is required. Compiler efficiency is very good making Java a suitable alternative to C and C++. The AOT approach essentially eliminates the JIT start up that is typically hidden on high performance platforms because of computational horsepower but very apparent on smaller platforms like the Cortex-M3. Likewise, it makes handling of interrupts and near real time chores easier.
Exploring the GUI and hardware classes takes a bit of time but is typically of learning any platform. The tools address the range of interfaces but they are not required by all applications. This means a Java application could be used on anything from a headless robotic controller to a dedicated network media player. The limitations of the Cortex-M3 are known but migration to higher end Cortex platforms should be a trivial exercise for Java apps. Likewise, choosing a micro with less memory within the STM family is possible once application requirements are set although it might be a tight fit on the smallest of the STM platforms.
While I like the hardware and software there are caveats. Out of the box the software will run for 3 months and apps run for only an hour. I find the latter the most annoying but it may provide sufficient time to evaluate the tools.
Overall, the package demonstrates the viability and desirability of using Java on a Cortex-M3. IS2T makes some nice software and ST Microelectronics has the hardware to match it.