SNAP
SIMM board with the Cjip Java processor. (Photo from Imsys Tech.)
We earlier mentioned the Imsys Tech Cjip Javaprocessor
and the company's SNAP
(Simple Network Application Platform) card, which follows the TINI
specifications (see TINI in Java
Boards section). It is in a SIMM (Single Inline Memory Module)
form and plugs into carrier cards that provide various optional
hardware such as ethernet and serial line connectors to provide
communications. See, for example, the photo below of SNAP in one
such carrier card.
SNAP
SIMM board (vertical green colored board) inserted into a Systronix
TILT
socket board. The thee connects on the right edge of the TILT
are for power, serial line, and ethernet from bottom to top.
(Photo from Th. Lindblad)
SNAP Software
The procedures to create and run programs on the SNAP are not fundamentally
different from that for the PC desktop but they do vary in some
practical details. First of all, you must deal with a number of
limitations in the API:.
- Reduced core language classes - only those classes in
the following packages are available: java.lang,
java.io,
java.util,
and javax.microedition.io.
- Missing Core language classes - some classes in the J2SE
versions of these packages that you are fond of using may not
be available. For example java.lang.StringTokenizer
is missing.
- Missing methods - some classes will have some methods
absent. For example, random()
is removed from java.lang.Math.
To compensate somewhat for these limitiations, there are some additional
packages with classes that assist in developing programs for the
device:
- com.dalsemi.onewire.*
and com.dalsemi.system
packages are available and are fully compatible with the TINI
standard.
- se.imsys.com,
se.imsys.net,
se.imsys.ppp,
se.imsys.system,
and se.imsys.util
packages provide lots of useful classes such as HttpServer
for building custom servers.
- org.xm.sax
and uk.co.wilson
packages provide some tools for XML handling
The Imsys Technologies site provides documentation
such as the Java
API Specifications.
Compiling SNAP
Programs
Source code developed with these classes can be compiled for the
SNAP with the J2SE compiler but you must direct it to use these
packages. For example, if you install the SNAP software into the
c:\SNAP
directory, then you compile HelloWorld.java
as follows:
c:\> javac -target
1.1 -bootclasspath c:\SNAP\classes HelloWorld.java
The target
option tells the compiler to produce bytecode compatible with a
Java version 1.1. With the J2SE 5.0 compiler, you must also add
the option "-source
1.3" to indicate that the code does not contain assertions
and other features added to the language after version 1.3. The
bootclasspath
option indicates that the core language classes should be taken
from the SNAP set of packages rather than the standard J2SE packages.
In the standard J2SE scenario, the class files are loaded by the
JVM, which checks that the bytecode conforms to all the standard
specifications and doesn't do anything illegal. The CLDC, on the
other hand, is intended for platforms with limited resources so
it requires that some of this bytecode checking be carried out prior
to loading the processor.
The class files are run through a preverification program
that checks the code and creates new class files with annotations
that the processor recognizes and uses to accelerate its own code
checking.
So before the class files are moved to the SNAP, the following
preverification step is required:
c:\SNAP\bin\preverify
-classpath c:\SNAP\classes;. -nofinalize -d out HelloWorld
The -nofinalize
flag is necessary because CLDC platforms don't allow for invoking
the finalize()
method inherited from Object.
The -d flag
sends the verified class file to the out\
subdirectory.
Installing and
Running SNAP Programs
You can use ftp to place HelloWorld.class
on the SNAP. To run the program you can telnet into the Unix style
command shell on the SNAP and run the program with
> java -r HelloWorld
&
which responds with the output
Hello World!
Here the -r
flag tells the system to restart the Java processor in case it is
still running an old version of a class file. While not necessary
for this simple program, the &
flag causes the shell to return to the telnet prompt immediately
after it starts the program.. For a long running program like a
server, this allows you to log off while the program continues to
run.
The Imsys
Developer, an Integrated Development Environment (IDE), is now
available from Imsys Technologies as an optional purchase for programming
SNAP systems. It includes an editor, debugger, and "handles
a simultaneous mix of Java, C and assembler code."
In the next section we show
the code for a Web server that runs on the SNAP.
References and Web Resources
Latest update: Dec. 15, 2004
|