Practical
Embedded Java

Chapters


A practical engineering approach to using embedded Java in real-world applications.


...



Maintaining chapters in a pulldown list was getting too awkward, so they are now being maintained and re-arranged here.

Design Basics
Bruce's Design Rules When is a design good enough? How do you know you are starting the design process or architecting a system appropriately? These rules should help.
Why Should I Use Java? Java is neither perfect nor magical. It's an object-oriented computer language built on the syntax of C. Java happens to be a very well-designed, current-technology language, with a lot to recommend it. Java also includes a suite of "helper tools" such as javadoc and jar. Assuming you understand its strengths and can apply it appropriately, it help you create better (more robust, easier to use and maintain) programs in less time than other languages.
Java Fundamentals Classes, methods, fields, objects, packages, Java primitives, etc. If you are new to Java, or coming from the C or C++ world, start here to get the big picture.
Abstract classes and interfaces Commonly used to write I/O drivers or define APIs for use by others
Why and how to document your code Code which is not well documented is neither understandable nor usable, yet such code is (lamentably) common. Stop wasting your (and others) time and start properly documenting all your code (not just Java).
Some accepted Coding Standards Make your code readable and understandable by using accepted structure and naming conventions. Standards also enable a company or team to produce code which is consistent and maintainable.

Java Tools - General
Java Tools List How to set up your Java development environment from scratch. Here's a list of what to get and how/where to get it.
Java Tools Installation Once you have the various tools files, here's how to install and configure them.
javaxcomm debugging help Send in your war stories and we'll add them to ours.
Understanding Java paths What, exactly, happens when you invoke "java.exe" on your PC? What if you have multiple JSDKs and JREs installed? How do you reference one set of development and runtime libraries such as javaxcomm?
Java Tools: Tools within the J2SE SDK The J2SE SDK is the heart of any Java development tool set. This includes java, javac, javap, javadoc, jar, and more.
Javadoc  
Java Tools: Ant How to use Ant to automate Java builds
Java Tools: Ant Tips Ant can be a bit frustrating to figure out. These tips may save you some headaches.

Java Tools - Eclipse
The Eclipse IDE Under the covers and behind the scenes with Eclipse.
Tips Read this before creating Eclipse projects.
Eclipse 3.5 (Galileo) We're not using this yet since our required plugins might not be compatible.
Upgrade to Eclipse 3.4 (Ganymede) This is the version in widespread use 2009Q2. It's the basis for Atmel AVR32 Studio.
Upgrading To Eclipse 3.3 (Europa)  
Plugins minimal info about some more-optional plugins we've tried

Java Tools - NetBeans
The NetBeans IDE Netbeans 6 is worth a look even if you are a strong fan of Eclipse, especially if you have need of its special features such as tight SunSPOT and phoneME integration.

Java Tools - JStamp/JStik/Saje (using aJile controller)
Current aJile upgrades Here's how to install aJile runtime and tool upgrades

JemBuilder Tips

JemBuilder is the linker for aJile targets such as JStamp/JStik/SaJe. It combines your class files with runtime support libraries, and creates a file which can be executed by the target hardware. There is no formal documentation or online help for JemBuilder since aJile didn't feel any is needed. Here are some tips and advice which may help you understand and use this tool.
Charade byte-code debugger (coming soon) Charade is the debugger for aJile targets such as JStamp/JStik/SaJe. It is a byte-code, not a java-source debugger. It's not the easiest thing to use. Here are some helpful tips.

Projects which don't fit anywhere else
Sony Ericsson K850i A very decent little camera (actually two cameras with three modes), music player, and superb Java support. Oh, and it's also a phone.

Help with some practical issues - serial I/O, threading, etc
Helpful Utilities package - com.systronix.util We all seem to need the same simple helper classes - programmable time delays, hexadecimal conversion, various ways to blink an I/O pin, etc. So we have created the com.systronix.util class as a place to put all these odds and ends.
I/O: Using UARTs with javaxcomm javax.comm is the standard Java package for parallel and serial I/O. All "real Java" embedded systems support javax.comm for serial I/O, and systems such as the PC support parallel I/O too. All we use is the serial portion of javax.comm.
I/O: Amulet LCD and touchscreen Here's the easiest way to create a Graphical User Interface (GUI) for embedded systems, using a 1/4 VGA monochrome LCD and touchscreen.
Threading: generic threads Generic Java threads include the class java.lang.Thread and some methods in java.lang.Object
Threading: periodic threads JStamp, JStik and SaJe support real-time, periodic threads
Help Getting Started with JStamp, JStik and SaJe from Vitus Bering Institute Vitus Bering Institute is a technical school in Denmark. The Real Time Java group there is led by Hans Sondergaard. Bruce Boyes of Systronix met them in fall 2003 at the JAOO conference.
Periodic Thread tutorial at Vitus Bering. Applies to JStamp, JStik and SaJe. Hans Sondergaard and his students have probably done more study of Periodic Thread than any of our customers. Here's a page of help from their web site.
Writing your own aJile Interrupt Service Routine The existing event handler framework has some overhead which can make response to slow. So, rather than use the general purpose framework, here's how to write your own, faster, specific-purpose interrupt handler.
2006 Feb 21 - Rebooting JStamp/JStik/SaJe (aJile-based systems) from your application: aJileReboot application note. Sometimes you'd like to change some configuration in your application, or load a new one using the bootloader, and cause a firmware reboot to start up in the new application. Here's how to do the reboot part of that. This app note does not describe how to write or use a bootloader, which is a non-trivial issue in itself.

Interfacing
All about SPI The Serial Peripheral Interface (SPI) is a high speed (as fast as 20 MBits or more, depending on the hardware). JStamp and JStik can burst SPI at about 4 and 6 MBits, respectively. TStik and TINI390 can bit-bang SPI at bursts of 500 Kbits or so.
I2C I2C is a slower peripheral bus than SPI, but it has some low-cost and interesting devices. These principles also apply to the "TWI" (Two Wire Interface) used on the Atmel AVR controllers.

Benchmarks
Embedded Java Benchmarks "Figures don't lie, but liars can figure", and the same is true of benchmarks. Still, they can be useful,, which is why we all still use them. Here are some which we have run on a variety of embedded Java systems. We also include the source code and raw results files so that you can run and analyze them yourself.

Tutorials - start here with Blink
Blink Tutorial Level One A simple Blink example with all the source code in one Java file, no need to use external libraries, etc.
Blink Tutorial Level Two A more complex Blink which uses an external library and System properties
Blink Tutorial Level Three Blink one or more pins using a Thread object for each Blink instance
Blink Tutorial Level Four Blink one or more pins using a custom event handler object
Blink Tutorial Level Five Blinks multiple pins using (real-time) PeriodicThread objects and the new Systronix RealTime thread scheduler.
Blink Tutorial - Morse code Blink the JStamp, SaJe or JStik heartbeat LED with Morse code messages. You could also drive a speaker for Morse code tones.

 
Systronix® 939 Edison St, Salt Lake City, Utah, USA 84111
Tel +1-801-534-1017, Fax +1-801-534-1019
contact us     Time Zone: MDT (UTC-6)
 

Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
Systronix is independent of Sun Microsystems, Inc.
TStik, JStik, JCX, JStamp, JSimm, JDroid, and JRealTime are trademarks of Systronix, Inc.
1-Wire, iButton and TINI are trademarks of Dallas Semiconductor
Simmstick is a trademark of Dontronics
LEGO® is a trademark of Lego A/S, Denmark