NanoVM Brings Java to the AVR
Posted 17 Dec 2005 at 23:25 UTC by steve
According to a Freshmeat
Harbaum has released a tiny Java virtual machine called NanoVM that can run on
Atmel AVRs including
the popular ATmega8 and Atmega32 chips. To make development easy,
you can also run the JVM on Linux/Unix machines. If you've ever wanted
to write code for your robot in Java, this may be a good way to try it
out. The entire JVM is less
than 8kB of code including native classes and a bootloader. NanoVM is
written in C and released as Free
Software licensed under the GNU GPL.
This could be really cool. It's probalby already really scaled down,
but it would be cool to scale it further and make a pic version. Naw,
probably wouldn't be worth it escpecially since only certain pics can do
true multitasking. Anyway, Java for an AVR already sounds cool!
It's weird that when Java first started out it was touted as being
able to run as a little IC chip thingy. It was a long time before
companies like Windriver and such came out with one and they aren't
for the faint of heart. Now, we have here a nanoVM and it's so
scaled back that it's hardly usable. Java just can't win anywhere
When Java came out, it seemed like its constant garbage collection
seemed incompatible with non-volatile microcontroller memory.
Jim, is NanoVM worth investigating? I can burn a Mega8 if you want to
play with one.
Maybe a cheap AVR Java Stamp with built-in H-bridge would be cool...I
think Advanced Circuits still has their free PCB offer going on, and
I'm looking at a whole week of free time.
I don't think I'd be interested. Pretty much the reason nowadays that
you want to use Java is because it already has all the cool libraries
built in that can do stuff like TCP/IP networking and screen stuff like
Dialog boxes & widgets (swing), media players for audio and video and
multitasking thread stuff all built in. All of these libs are cool
because you don't have to recreate the wheel. But what does this nanoVM
thing have? Well, it's so stripped down it's sort of like smallc. You
can do conditionals and "for loops" and peek and poke, and the basic
language stuff but little else. You get a lib that can talk to I/O
(LEDs and Motors). Really, Java is not a great language for doing dinky
stuff, it's really more geared for large scale applications. So to make
such a gizmo as nanoVM is more an exercise in "can I do it" rather than
much of anything useful for creating something like a network box.
There again I may be wrong. Perhaps it does have networking capability
and media capability all crammed into 8K but I doubt it. Also, all your
Java code has to be crammed in limiting eeprom data space? I'd say
stick with smallc or a basic interpreter or if you're really cool try
forth or for that matter learn ASM and do it right. I like Java but I
have real doubts about the usefulness of any Java VM for a micro.
Java's really needs a huge memory footprint otherwise you're just being
silly. It's like I have this hammer so let's make everything a nail
type of solution. Java's a hungry hog and needs gobs of resources to do
anything useful. So, Java is not a good solution for a micro no matter
what Sun's marketing team says. So, I don't think I'd waste my time
with any Java VM for a micro unless someone can make a really good case
as to why I should. I mean, don't get me wrong, I commend the guy for
making such an animal that can really interpret real java bytecodes and
all, but really I have a hard time justifying using it. I mean if it
had more usefulness than just another flavor of smallc I might be
interested. Anyway, you should use the right tool for the job and I'd
rather use ASM or c for a tiny memory limited microcontroller.
I agree with your well-written assessment. When I looked further at
the web site, it seemed like the implementation was pretty constrained
to their robotic platform, and I didn't browse around long enough to
see if they had schematics and such for their board.
The more I think about it, Java is probably better suited to Atmel's
ARM processors, if Java's suited to tiny micros at all.