GuruPlug.pngEmbedded systems are becoming ever more powerful and affordable. Check out the GuruPlug, which is scheduled for release in a couple of weeks and has amazing specs:

  • Linux 2.6
  • 1.2 GHz ARM processor with 512 MB DRAM
  • 512 MB Flash, Ethernet, WiFi, 2 x USB, Bluetooth, GPIO
  • Low power consumption and small footprint
  • Java and OSGi available from distributor
  • Retail price: US $99 (standard version)

I haven’t played with one of these yet but at this price this is an awesome embedded platform for all sorts of interesting uses. I know I will get myself one!

The GuruPlug is but one in an amazing range of interesting devices: Be it the BUG, the ACME Systems FOX G20 board, the PC Engines ALIX 3D2 (a very compact and cheap PC-class SBC), the Nokia N900, the Marvell plug computer (as exemplified by the GuruPlug/SheevaPlug above), the Sun SPOT, and many more.

But it’s clear that with embedded devices being increasingly powerful and complex the old-school embedded development paradigm is becoming more and more outdated … a simple executable, a C compiler, and some cobbled-together libraries just don’t cut it anymore to build feature-rich embedded solutions on time.

Embedded Java is a perfect match:

  • Platform independence
  • A productive language
  • Multithreading and memory management built-in
  • Full-featured networking support
  • Comprehensive libraries for access to many platform features
  • Rich development tools

It’s all there to make embedded development so much more productive.

So, how do you get embedded Java onto your embedded devices? Pretty much all of these run Linux, so putting Java on them is actually pretty straightforward (sans the Sun SPOT, which runs Java out of the box already).

First, the question is about the processor architecture.

If you have an X86-based platform, such as the ALIX or a similar PC-class single board computer (SBC) it’s very easy since PC-compatibility is usually a given. So you can either run the standard Sun/Oracle Java SE for Linux distribution, or OpenJDK, or if you are developing an embedded solution, you should look at Java SE for Embedded (more on Java SE for Embedded below).

ARM-based platforms, however, often offer significant cost, size, and power consumption benefits over traditional X86-based solutions. The really cost efficient, low-power platforms such as most mobile devices, handheld systems such as the N900, or embedded systems such as the plug computer, all utilize ARM SOC (system-on-a-chip) designs.

Java on ARM requires a little more planning than Java on X86. The reason is that you typically need to factor in your design priorities: Is cost and footprint of overriding concern and therefore you forgo a JIT (just-in-time) compiler to save memory? Or does your embedded solution require highest Java performance and thus require the additional 8 to 64 MB memory budget needed (depending on the system) for a JIT compiler? And finally, is a JIT compiler supported for your architecture?

Depending on that decision, you have a number of options: Cacao, JamVM, phoneME, OpenJDK, Java SE for Embedded, and others. Let’s have a look at some of these:

  • Cacao, JavaVM, and phoneME have a long history in the embedded space. phoneME is a proven, robust solution with very effective optimization technologies, including a mature JIT compiler. But the other stacks offer benefits as well. See here for a series of blog entries comparing the different Java runtimes.
  • OpenJDK hasn’t been designed for embedded use per se, but there are various efforts under way to add JIT compilation for non-X86 platforms such as ARM, PPC, MIPS, and others: See the Zero/Shark project.
  • Java SE for Embedded is now available with full ARM support, including a JIT compiler – in fact, it supports 28 different ISA/OS combinations. Java SE for Embedded is fully Java SE-compliant, purpose built (for example, available in headless configurations) and is free for development purposes. Once you go to deployment Sun/Oracle offers affordable licensing. Check out the FAQ for details.
  • Jalimo is not a Java stack in itself, but a project which aims to bring Java to Linux-based devices, and which offers a robust build environment and packages leveraging different existing Java runtimes.

So, as you can see, there are plenty of options.

And once you have Java running on your target device you then have all the joys of development with Java: Advanced tools (NetBeans and many others), developing and testing on the host (no more complicated cross-compilation), and easy of deployment to the target (just run the class files on the target via memory card, Bluetooh, ftp/ssh, NFS, SMB, or other methods that works best for your situation).

I’m sure I have missed interesting projects and details – the area of embedded Java is wide and active, but I thought it would be useful to write-up some of the info that I’ve been collecting. Please feel free to post comments, corrections, or additional info!

Cheers,

– Terrence