What is it?HaikuVM is a JAVA VM for microcontrollers. It implements all JAVA bytecodes.
HaikuVM has been started for hobbyists who develop applications for AVRs (e.g. ARDUINO) to open the world of JAVA.
HaikuVM is so small that it even runs on the ASURO robot (which is driven by an ATmega8).
HaikuVM works by compiling JAVA bytecode to C data structures to be compiled by a C cross compiler for your target platform. So, the resulting code is small and fast. (More at
http://haiku-vm.sourceforge.net)
What's new in Version 1.0.0?1) Single line command interfaceEnter one line to compile, upload and run your JAVA program (let's say 'BlinkWithThread') to an Arduino connected on port com5:
cd haikuVM\myCProject
C:\haikuVM\bin\haiku -v --Config arduino --Config:Port com5 -o BlinkWithThread.hex C:\haikuVM\examples\src\main\java\arduino\tutorial\BlinkWithThread.java
Or Linux:
cd haikuVM/myCProject
/home/bob/haikuVM/bin/haiku -v --Config arduino /home/bob/haikuVM/examples/src/main/java/arduino/tutorial/BlinkWithThread.java
2) Direct access to memory and microcontroller registersStatic fields annotated with @NativeCVariable# (where # is one of 8, 16, 32 or 64) are directly mapped to (equal named and existing) C variables.
...
public static final int UDRE0 = 5;
@NativeCVariable8 // tells HaikuVM to map UCSR0A to a 8Bit C variable called UCSR0A
public static volatile int UCSR0A;
@NativeCVariable8 // tells HaikuVM to map UDR0 to a 8Bit C variable called UDR0
public static volatile int UDR0;
...
public void write(int b) {
while ( (UCSR0A & (1 << UDRE0)) == 0 ) /*poll*/ ;
UDR0=b;
};
Most of the code written for microcontrollers was originally written in C. This direct access to memory technique allows you to virtually copy&past this to JAVA.