NanoVM - Embedded Virtual Machine

Eric Engler

 

Updated: April 18, 2007

 
     

April 18, 2007: added Asuro robot assembly notes

April 10, 2007: initial creation of this page about NanoVM


What is NanoVM?

NanoVM is a small Virtual Machine for Atmel ATMega 8-bit microcontrollers. This is a subset of a real Java Virtual Machine, but it allows you to run Java programs that were cross-compiled on a PC using a real Java compiler. You need to run a special downloader program, NanoVMTool, that will translate the Java byte code to the NanoVM format, and then it downloads the NVM formatted program to the microcontroller over the serial port.

NanoVM was developed by Till Harbaum, and you should check his page first to get a better idea of what NanoVM can do.


Who is NanoVM for?

  • Robotics Hobbiests and Java Students
  • Embedded developers looking for other open source languages
  • Advanced developers trying to understand the internals of a Virtual Machine
  • Advanced .NET developers looking for ideas on porting the CLR to small devices, much smaller than those targeted by the Microsoft Micro Framework


English Port of the NanoVM Wiki Information

I translated some of the more advanced infomation from the German language Wiki, and I added some new material to explain it better.
Here's a Microsoft Word document: NanoVM English.doc

Here's a PDF document: NanoVM English.pdf


What is my game plan?

NanoVM was written for the AVR ATMega8 processor that is used by the Asuro robot. My first task is to document how to use all of the related software on Windows. It is currently documented for linux, but I think it will all work on Windows.

  1. Assemble my Asuro robot
  2. Make sure it works with the provided C programs using gcc with WinAVR
  3. Compile NanoVM itself. I'll use gcc with WinAVR
  4. Figure out how to burn NanoVM into flash using free Windows tools, and a cheap Atmel Dragon development board.
  5. Try both the Sun Java compiler, and IBM's Jikes to compile user programs.
  6. Use NanoVMTool on Windows to convert and download a user program
  7. Ensure that the NanoVM native routines for the Asuro work fine

Next, I'll try using NanoVM on the Sparkfun Arduino USB development board using an ATMega168. This is an open development board, with completely open source code. Then I'll try plugging in the ATMega168 to the Asuro robot to give me more flash memory (16K vs 8K).

I'd like to see if I can use the IR connection to download new programs.

Then I'd like to consider how best to add an event handling mechanism to NanoVM. It currently relies on native methods written in C, which can be polled from Java. But there's no way to call a Java method upon receiving an interrupt.

Next I'd like to support In-Circuit Debugging (ICD), using a custom IDE from the PC to step thru the code as it executes on the embedded device.

Having done all of this, I have some ideas for extending NanoVM, and porting it to support other targets, outside of the AVR family. Among these other targets may be the 9s12C32, the msp430, and ARM devices based on the Cortex M8 and ARM7TDMI cores.

And even later I will also consider later the possibility of supporting other source languages, such as BASIC, C, or C#. I would like to add some features of the .NET CLR, such as pointer dereferencing, to NanoVM. Extra datatypes, and a redesigned Garbage Collector to avoid losing one bit from each integer would see like a good idea, but this has to be weighed against RAM requirements.


Visit my other web pages

AsmIDE Home Page - for hc11/hc12 assembler language development

EmbeddedGNU Home Page - for C language development

Pluto assembly language debugger


My Contact Info

Tell me if you would like to help with any of these items!

Eric Engler email: Eric Engler Email Address