EmbedVM - Embedded Virtual Machine

EmbedVM is a small embeddable virtual machine for microcontrollers with a C-like language frontend. It has been tested with GCC and AVR microcontrollers. But as the Virtual machine is rather simple it should be easy to port it to other architectures.

The VM simulates a 16bit CPU that can access up to 64kB of memory. It can only operate on 16bit values and arrays of 16bit and 8bit values. There is no support for complex data structures (struct, objects, etc.). A function can have a maximum of 32 local variables and 32 arguments.

Besides the memory for the VM, a small structure holding the VM state and the reasonable amount of memory the EmbedVM functions need on the stack there are no additional memory requirements for the VM. Especially the VM does not depend on any dymaic memory management.

EmbedVM is optimized for size and simplicity, not execution speed. The VM itself takes up about 3kB of program memory on an AVR microcontroller. On an AVR ATmega168 running at 16MHz the VM can execute about 75 VM instructions per millisecond.

All memory accesses done by the VM are parformed using user callback functions. So it is possible to have some or all of the VM memory on external memory devices, flash memory, etc. or "memory-map" hardware functions to the VM.

The compiler is a UNIX/Linux commandline tool that reads in a *.evm file and generates bytecode in vaious formats (binary file, intel hex, C array initializers and a special debug output format). It also generates a symbol file that can be used to access data in the VM memory from the host application.

EmbedVM is free software licensed under the ISC license (a GPL compatible licence that is similar in terms to the MIT license or the 2-clause BSD license).

Link to the sources and all currently available documentation (subversion repository):
http://svn.clifford.at/embedvm/trunk/

 

A Quick Introduction to EmbedVM (YouTube):

   

 

 

In papers and reports, please refer to EmbedVM as follows: Clifford Wolf. EmbedVM: A small embeddable virtual machine for microcontrollers. http://www.clifford.at/embedvm/, e.g. using the following BibTeX code:

@MISC{EmbedVM,
        author = {Clifford Wolf},
        title = {EmbedVM: a small embeddable virtual machine for microcontrollers},
        howpublished = "\url{http://www.clifford.at/embedvm/}"
}