Practical
Embedded Java

aJile 4.X Usage


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


...



This page documents how to use the new upgrade. JemBuilder and Charade options and configurations have changed since aJile 3.16.09. The CLDC 1.1 footprint is larger (that seems inevitable). You MUST have the latest Systronix configurations for aJile 4.X to work properly: Get them here.


Use aJile 4.3.03 (2008 April 07)
This is a JAR with all the source, Ant files, etc. This example will build if you have tools installed, and a virtual P drive per the java tools instructions here
20070713 fixed some build file issues

Compile a simple program using Eclipse
- or -
your favorite IDE or command line

  1. Create an Eclipse project, or open the one in the JAR.
  2. Select the project and right click, then select Properties and choose the Java Build Path
    • Source should include the /src subfolder
    • Projects required in the build path: none
    • Libraries: Systronix Utils, and the aJile runtime classes.jar and RTS.jar (no RTS.jar? go back to the aJile upgrade instructions) . For each of these use Eclipse variables, such as JAVA_LIB, and aJILE_HOME, respectively, and "extend" them with a reference to the respective jar files. It will look similar to this screen shot . This should also include the CLDC_HOME variable (screenshot) which gets extended (screenshot) to reach the CLDC classes.jar file (screenshot)
  3. Send the output files to a \classes subfolder
  4. If you have an old project with 3.16.09 output, purge it to avoid confusing the tools and yourself.
  5. Build the project. You should now have a .class file in the \classes folder
Use JemBuilder to Link your program

Open the provided JemBuilder .ajp project. JemBuilder (get the version with F1 or Help->About) has changed a lot, so familiarize yourself with at least these settings:

JemBuilder 5.0 Top Navbar Settings
Project -> Properties

You need an "Embedded Runtime" (screenshot) plus a "Target Configuration" (screenshot). The Target is selected from a list (JStampPlusRamConfiguration in this example) but you must create the Embedded Runtime definition (just once). Copy the values shown in the screenshot. You can create your own Runtime definition by editting the fields or using the wizard in Tools->New Runtime

Note that the Embedded Runtime is rather involved and requires new installation files from 3.16.09 - e.g, the Sun ME CLDC 1.1 Reference Implementation.

Project -> Drivers
We want com1 and com2 (screenshot)
Tools -> Libraries
Create a library reference for Systronix Utils (screenshot)

JemBuilder 5.0 Left Pane Settings
Project -> Output Files

I like to put output in folders specific to a given target and build such as
P:\hardware\boards\JStamp\SerialEcho\rambuild
(screenshot)

Project -> Pin Setup 2
Port D - check the first two boxes to allocate Port D[0145] to UART usage. Here you see that Uart0 and Uart1 correspond to Java com1 and com2 (screenshot).
Project -> Memory
Code Segment Location
RAM should be selected and the only option since we are doing a RAM build. It seems that when selecting a Flash configuration, the Flash Code Segment Location is not automatically selected. Watch out for this and check it on each JemBuilder project you create!
JVM0 -> Main
com.systronix.example.SerialEcho
JVM0 -> Classes
Add Systronix Utils from Available Libraries to the Libraries. In the current release these arrows are backwards so press the "remove" arrow to add it and vice-versa.
JVM0->Memory->Standard
Leave the default Garbage Collection at Mark and Sweep. Other algorithms are not fully implemented yet.
JVM0 -> Drivers
com1 and com2 are selected in our example, with neither getting System.out (boxes not checked)

Now run JemBuilder and you should get a clean build. Of course I always have a couple of errors to fix, usually path typos or missing libraries.

Look in the ...SerialEcho\rambuild folder and you should see files like JVM0.map, and build_program.bin which is the executable binary file (formerly named build.bin in 3.16.09)

Download and run with Charade
  1. Set your target jumpers for RAM execution, connect a JTAG adapter from the PC to your target, and power up the target
  2. You should see a green JTAG adapter power LED
  3. Use the start-> programs -> aJile -> Charade for Systronix shortcut you made during installation
  4. To invoke Charade, use the shortcut in the C:\aJile\Systronix folder, which you can copy to your desktop or task bar. This starts Charade in the C:\aJile\Systronix folder and uses the Systronix configurations, and Systronix versions of Charade.wcf and Charade.cfg. This includes things like a Charade "verify" button, and a Charade Device menu listing of all Systronix platforms. If you right-click on the shortcut and select "proprties" you should see a dialog box like this one.
  5. Choose the Charade taskbar Device -> JStamp
  6. on the Charade taskbar, select File->Execute and browse to the load.sod file within the rambuild output folder you created with JemBuilder
  7. OR - copy the file path to the binary output folder from the JemBuilder output screen, such as "P:\hardware\boards\JStamp\SerialEcho\rambuild", then in the charade console command line enter "cd" (Change Dir, just like the old DOS commands, in fact this IS using a DOS command) followed by the path, so "cd P:\hardware\boards\JStamp\SerialEcho\rambuild". then poress enter. Now you can just press the Charade load button to load build_program.bin. This is my preferred approach.
  8. The file should start loading
  9. At least this once, do a verify. Click on the verify button, or use the command line " verify build_program.bin". You cannot use the old "build.bin" file name from 3.16.09. Your charade.wcf file must have the new file name. Go back to the 4.X upgrade instructions if you need to. If the verify fails you either have the wrong device selection, the wrong memory JemBuilder and hardware jumper settings (flash vs RAM execution), or you are not verifying against the same file you loaded.
  10. Now connect a serial port to com1 of the target and a PC. Open a comm program such as Hyperterminal at 115200 baud, 8/N/1, no flow control.
  11. Click RUN in Charade and the console should show:
    -> sw tx on
    Textio mode (tx): on
    -> run
    vm.0 charadeIO active
    [TEXTIO.0]->Serial Port Example bab 1.2 2007 July 11

    and the terminal window should echo what you type. So if we type "ASDF" on the PC, the terminal should show ASDF and Charade's console:
    [TEXTIO.0]->0x41 A
    [TEXTIO.0]->0x53 S
    [TEXTIO.0]->0x44 D
    [TEXTIO.0]->0x46 F
Problems? Yeah, me too. Here is some debugging help.
Important Notes:
  1. You MUST have the latest Systronix configurations for this example to work.
  2. JStik use is similar, just select JStik RAM in JemBuilder and Charade. The JemBuilder Runtime setup is the same.
  3. Flash use is similar - just select a JemBuilder Flash configuration and create a flashbuild output folder. Be sure to select the "Flash - used for deployment..." Code Segment Location option in the left pane Project->Memory page. It seems odd/wrong to me that this isn't automatically selected by a Flash configuration. Set your target jumper for flash boot, and use Charade to execute that flashbuild\load.sod file.

 
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