Author Topic: HaikuVM: A Java VM for microcontrollers (e.g. Atmega8) using the leJOS runtime.  (Read 2210 times)

0 Members and 1 Guest are viewing this topic.

Offline genom2Topic starter

  • Jr. Member
  • **
  • Posts: 7
  • Helpful? 0
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 interface
Enter one line to compile, upload and run your JAVA program (let's say 'BlinkWithThread') to an Arduino connected on port com5:

Code: [Select]
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:
Code: [Select]
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 registers
Static fields annotated with @NativeCVariable# (where # is one of 8, 16, 32 or 64) are directly mapped to (equal named and existing) C variables.
Code: [Select]
    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*/ ;
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.


Get Your Ad Here