Prototyping With Java On Cortex-M3/M4


Running Java on a PC or any hefty processor is easy. Running Java on a more compact platform like ARM's Cortex-M3/M4 can be more of a challenge. IS2T does it on an STMicroelectronics STM32 F4 series microcontroller. STM32Java is designed to run on these platforms (see Java Meets The Cortex-M3 With New Development Kit) and I had a chance to try out the STM3240G-JAVA evaluation system (Fig. 1) that includes STMicroelectronics developement board equipped with IS2T's Java toolsuite.

I have been following Java on micros for ages even using variants like Parallax's Javalin Stamp based on an 8-bit processor (see 8-Bit Java). And the Systronix TStik (see Java Module Delivers Flexibility And Power). These let you work with Java but were unlikely to be the platform for embedded products.

I have also worked with embedded Java platforms designed to target micros. Even Oracle is pushing Java into the lower end embedded space (see New Java ME Targets IoT Embedded Devices). IS2T's technology fits in this space. It can be used by hobbyists but it targets embedded developers looking to take advantage of Java for embedded applications.

The STM3240G-JAVA evaluation kit includes a board with a 168 MHz STM32F407IGH6. This Cortex-M4 has DSP and single precision floating point support. It has a 1 Mbyte of flash and 192 Kbytes of SRAM and 4 Kbytes of backup SRAM. It supports off chip memory and there is a microSD socket on-board. Peripherals include three 12-bit, 2.4 Msample/s ADCs with up to 24 input channels and a pair of 23-bit DACs. It has a true random number generator (RNG), two PWM timers and a dozen 16-bit timers. The camera interface operates at speeds up to 54 Mbytes/s in 8- or 14-bit mode.

The display is a 3.2-in 240 by 320 pixel TFT display with touch screen support. It works with the MicroUI and Micro Widget Toolkit. Additional peripherals include Ethernet, an RS-233 serial port, four status LEDs, buttons and a 4-direction joystick. Debugging is provide via an on-board ST-Link/V2 with a USB interface. The interactive simulator (Fig. 2) mirrors the display, LEDs and buttons.

The STM3240G-JAVA evaluation kit’s MicroEJ development tool suite is based on the open source Eclipse IDE (Fig. 3). The tools have a 3 month limitation that should be sufficient to determine whether purchasing the full version makes sense. There is also a 1 hour run time limit. I think this will be more of an issue for testing compared to overall timeout.

IS2T is delivering two things. The first is the preconfigured IDE. Installation of the software was trivial and it installed the STMicroelectronics ST-Link/V2 software too. I actually installed this on a virtual machine running Windows 7 under Fedora Linux KVM. This meant I had to map the USB debug interface and serial port to the virtual machine.

The serial port is used for system feedback. The ST-Link/V2 interface can be used to program the flash. I also need to get a USB-serial port bridge because I didn’t have a free serial port on the system. It would have been handy for this to be handled by the ST-Link/V2 connection but evidently that is not how things work.

The Getting Started manual does a good job although the serial port configuration is not as clear as I like. I also had a minor issue with runtime/debug configuration. This is done by duplicating the default entry and then editing a couple of fields. The manual spells this out but it can be tedious if working with a number of different applications. This is actually an Eclipse issue that any vendor has to deal with.

The usual Hello World program was covered first and I tried it on the simulator first and then on the hardware. The results were as expected. Of course, the latter overwrote the demo application that was preprogrammed. This had a graphical interface to run half a dozen applets that highlighted the capabilities of the system and the MicroEJ Embedded UI.

The demo application was the next sample in the documentation. The only difference between it and the first application was the time required to download it to the board because it was a larger program.

What I really appreciated was the integration IS2T has done. I was able to debug immediately without worry about tweaking a lot of options, or, worse, debugging the debug connection. It allowed me to concentrate on learning the idiosyncrasies of the runtime support and libraries that I would be using if I were creating an application from scratch.

Migrating an existing Java application should be fairly easy but I did not have a chance to do this for any major piece of code. Most will program strictly in Java since it does provide access to the peripherals. Developing or migrating a C library is likely to be a bigger job and one I did not attempt although it is possible.

On the plus side, the same Eclipse IDE can handle C development as well as Java and projects can include both. The system generates standard ELF files like the C tools so the ELF linker can create an image with an application's C, Java and runtime components.

Another thing I did not address is moving from the kit to a custom board which is the end game for most developers. IS2T has support for this and it has minimized the set of C APIs need to port the system to a new chip. I suspect that getting the debug interface working on a new platform will be more challenging.

I am now trying to work on some applications that were not provided with the kit but I don’t expect any surprises. I already tried out the debug facilities. I expect learning the MicroEJ Embedded UI will take most of the time but I need to check out the Ethernet support as well. There is also a font designer that I will probably not exercise since I am not worried about developing a product at this point.

IS2T has put together a nice package. It is on par with and C/C++-based development tool. The Cortex-M4 and also the Cortex-M3 version have enough headroom with the Java Virtual Machine and runtime support to handle substantial applications. Multitasking is part of the package already. There are a number of threads for the MicroEJ Embedded UI.

IS2T has a range of Java solutions in addition to the kit reviewed here. There is a kit that includes a lower end, STM32 F2 series microprocessor based on a Cortex-M3. Most Cortex-M3/M4 microprocessors can be supported using the software, not just those from STMicroelectronics.

In general, STM32Java requirements are low. It uses less than 32 Kbytes of flash and 1.5 Kbytes of RAM for the base system leaving a significant amount for applications even on small Cortex-M3/M4 devices. Boot time is under 2 ms for a 120 Mhz processor. It can run standalone or work with an RTOS although check with IS2T about those details.

Other software includes MicroEJ Hard Real Time for applications that require more rigid scheduling. There is also a numerical processing extension designed to speed up linear algebra. Development licenses are available as an annual subscription or a one time, perpetual license. A runtime license is required for deployment. There are a number of tech support options as well.

Discuss this Blog Entry 4

on Jan 29, 2014

Thank you Bill for posting your experience using ARM! It would be great if you and other developers working with the ARM architecture can share similar stories in the recently launched ARM Connected Community ( - an interactive platform to connect with ARM experts, developers and ARM partners. Cheers! Brad

on Jan 30, 2014

Hi Bill, interesting post.

Looking at the figure 3 and the lines of code, it seems you must use com.is2t.* proprietary classes, correct?
Wondering then how portable your code would be between different devices.
Indeed isn't portability one (may be the first) pillar of Java?
For instance, I would expect to be able to develop a Java program on a Raspberry Pi and then run it on a STM32 evaluation board and vice-versa.


on Feb 4, 2014

should mention the cost....seems fairly expensive

on Jan 5, 2017

Cool project!

Please or Register to post comments.

Commentaries and Blogs
Guest Blogs
Jul 15, 2016

Simple Yet Effective ESD Testing Methods for Higher Reliability 7

There are multiple ways to test for electrostatic discharge, ranging from implementing a human-body or machine model to....using a balloon and a comb?...More
Apr 8, 2016

Confabbing on the Fabless Fad 5

High capital and maintenance costs, and EDA advances along with abstractions to deal with chip complexity, have been leading contributors to the fabless migration....More
Mar 2, 2016

Home or Very Small Office Electronic Circuit Prototypes, Part 4 24

Part 4 focuses on testing for a reflow oven and build of a mixed SMT/through-hole board....More

Sponsored Introduction Continue on to (or wait seconds) ×