Programming in Java - rosco-pc/propeller-wiki GitHub Wiki
PropJavelin is a project to implement the functionality of the Parallax Javelin Stamp on the Propeller Chip. This is the implementation of a JVM which runs on the Propeller to allow Java(TM) programming of the Propeller. Java program development is undertaken using a modified version of the Javelin Stamp IDE.
A fast-track for getting the PropJavelin running can be found here
Peter Verkaik proposed on the Propeller Forum to implement a JVM for the Propeller to enable the use of the Java(TM) programming language.
Original forum thread : here
End-user Java development would be undertaken using the Jikes(TM) compiler for the Java language and post processing by the JavelinDirect linker as used for Parallax JavelinStamp ( suitably modified ). Development could also be undertaken using the JavelinStamp IDE, to produce the required bytecode for inclusion with a Propeller JVM program or for download directly into a Propeller Chip running such a JVM program.
The bytecode generated by JavelinDirect is in a .jem bytecode file using JEM bytecode opcodes which have different values to Sun's JVM bytecode opcodes in a .class file although they are essentially the same.
Java and all Java-based marks' are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.
Jikes is a trademark or registered trademark of International Business Machines Corporation in the United States, other countries, or both.
The following development tools will be useful for anyone interested in becoming involved with the JVM develoment.
The Jikes compiler was developed by IBM and has been made open source with source code available under IBM's Public License.
The easiest way to get hold of the Jikes compiler executable for Windows is probably to download the JavelinStamp IDE from Parallax and install that. This will provide the graphical IDE for the JavelinStamp and allows the installation to be tested.
JavelinStamp IDE download page from Parallax : here
The Jikes compiler on Sourceforge : here
Original JavelinDirect Source download page from Parallax : here
The updated JavelinDirect Package download via Yahoo Groups : here
A Propeller Specific JavelinDirect ( PropDirect) hosted on the Parallax forum : here( forum thread)
JavelinDirect and PropDirect require RTL60.BPL and VCL60.BPL to be installed in \Windows\System32.
The JIDE Runtime download via Yahoo Groups : here
The JIDE Runtime hosted on the Parallax forum : here( forum thread)
Compiling a testJVM.java source file -
Set JIKESEXE="C:\Program Files\Parallax Inc\Javelin Stamp IDE\Jikes\Jikes.exe"
Set JIKESCLS="C:\Program Files\Parallax Inc\Javelin Stamp IDE\lib"
%JIKESEXE% -classpath %JIKESCLS% testJVM.java
Linking the testJVM.class to produce testJVM.jem and jem.out -
PropDirect --path .;%JIKESCLS% --link --debug testJVM
Including the testJVM.jem file in a Propeller Spin program -
PRI ShowAllBytecode_Version_1 | hubPtr
repeat hubPtr from @JemBytecodeStart to @JemBytecodeEnd
ShowThisBytecode( byte[ hubPtr ] )
PRI ShowAllBytecode_Version_2 | i
repeat i from 0 to BytecodeLength - 1
ShowThisBytecode( byte[ @jemBytecodeStart + i ] )
PRI BytecodeLength
return @JemBytecodeEnd - @JemByteCodeStart
DAT
JemByteCodeStart
FILE = "testJVM.jem"
JemByteCodeEnd
The Java(TM) Virtual Machine Specification Second Edition from Sun Microsystems, Inc.
Read online : here
Java for GBA - A port of the KVM ( J2ME/CLDC ) for the Game Boy Advance.
Source Code : here
LeJOS/TinyVM - LeJOS is replacement firmware for LEGO Mindstorms RCX and NXT bricks, a continuation in development on its fore-runner, TinyVM.
NanoVM - Java for the AVR. The NanoVM is a Java virtual machine for the Atmel AVR ATmega8 CPU, the member of the AVR CPU family. The NanoVM and its tools are distributed under the GPL and can be used on other AVR based systems as well.
More information : here
SimpleRTJ - A small footprint Java VM for embedded and consumer devices. The simple Real-Time-Java for the small embedded and consumer devices is a clean room implementation of Java Virtual Machine that has been specifically designed to run on devices with the small amount of system memory. In contrast to other embedded implementations of the virtual machine the simpleRTJ requires on average about 18-24KB of code memory to run. The evaluation version of simpleRTJ for embedded and consumer devices is available under the RTJ Computing's non-commercial source code license for private, educational and evaluation purposes.
More information from RTJ Computing : here
Taurus Java VM - A clean-room Java™ Virtual Machine implementation, designed to be highly portable, optimised for use on small, low-power devices. From version 1.04a onwards, JavaVM is covered by the terms of the GNU General Public License (GPL).
Specification, Documentation, Whitepapers, Sources and Downloads.
More information from Taurus Software & Consulting : here
The proposed Propeller JVM leverages the existing toolset used for development of programs for the JavelinStamp and the design of the Propeller JVM will therefore be influenced by that toolset.
The Jikes compiler is a full Java compatible compiler delivering complete bytecode for Java class files. The JavelinDirect / PropDirect tool bridges the divide between class files and the JEM bytecode the Propeller JVM will execute and thus is the primary tool ( along with the JVM itself ) which will influence design decisions and will need to change as design decisions are made.
There are two potential goals; a JVM which supports 'Java' as it is on the JavelinStamp ( an emulation with just minor changes to the toolset to better suit the Propeller ) or an enhancement to provide a Java which is ideally suited towards the Propeller with less regard to the JavelinStamp itself.
Development could be incremental and phased, delivering emulation then enhanced, or initially targeted to be ideally suited to the Propeller.
Because the JavelinStamp is based upon a constrained architecture, int is implemented as 16-bit not 32-bit, long ( 64-bit ) is not supported at all.
There are two choices for the Propeller, to retain the fundamental type-size as 16-bit internally with short and int as 16-bit and long as 32-bit, or to use a fundamental type-size of 32-bit with short as 16-bit, int as 32-bit and long as 32-bit rather than 64-bit.
The argument for a 16-bit type-size is less runtime memory use for holding method and local variables when a programmer uses int (16-bit ) but that is set against a more complicated and larger foot-print JVM which has to support both 16-bit and 32-bit primitive data sizes.
The argument for a 32-bit type-size is the simplification and smaller foot-print of the JVM dealing with only one 32-bit primitive data size at the expense of higher memory use for method and local variables at runtime.
The JavelinStamp uses a 'Virtual Peripheral' mechanism to implement a degree of concurrent processing. Whether that should be retained for the Propeller or how it should be changed needs to be decided.
The JavelinStamp native methods are part and parcel of the Java class files provided as part of the Java programming environment. Which of those should be retained, changed or removed, and which new native methods should be added for the Propeller needs to be decided.
The JavelinStamp like many constrained JVM implementations does not support threads. While any JVM should ideally support threads it needs to be decided if the Propeller JVM will or not and if it does the JVM will need to be designed to support them.
The JavelinStamp like many constrained JVM implementations does not support garbage collection. While any JVM should ideally support garbage collection it needs to be decided if the Propeller JVM will or not and if it does the JVM will need to be designed to support them.