Home / TinyVM

Energy-Efficient Programming Environments
for Wireless Sensor Networks


  • Energy efficiency of a wireless sensor network (WSN) directly affects its longevity.
  • Energy efficiency requires programs with small memory footprint.
  • Dissemination of programs into WSNs is problematic due to high transmission cost.
  • Bytecode offers better compression opportunities than binary code.
  • We introduce a light-weight virtual machine (VM) on sensor nodes to execute bytecode, thus reducing memory footprint and deployment cost of programs.
  • A VM offers the additional benefit of hardware-independent execution.

A Bytecode / Binary Code Mixed-Mode Execution Environment for WSNs

An application image for our mixed-mode execution environment contains binary code and bytecode. Mixed-mode execution denotes intertwined execution of binary code and bytecode. The thread of control can jump from bytecode to binary code (native calls) and vice versa. Native calls are realised as indirect calls via the VM's jumptable. Calls from binary to byte code use a trampoline embedded in bytecode functions. With mixed-mode execution there is a clear trade-off between execution speed and memory footprint. Frequently executed code is compiled to binary code and less frequently executed code is compiled to bytecode.

Compile Path

  • Storage class specifiers vm and mc
  • Splitter partitions sources accordingly
  • TinyVM LCC backend compiles C to bytecode
  • GCC compiles C to binary code
  • Linker generates image containing TinyVM plus application image
  • Image deployed on sensor nodes

Bytecode Compression

  • The bytecode stream is split into
    • Op-code stream,
    • Number stream and
    • Symbol stream.
  • Each stream is compressed using Huffman encoding.
  • Adding a dictionary-based approach will further improve compression rates.

TinyVM, a Light-Weight Virtual Machine for WSNs

  • The TinyVM instruction set covers all C programming language constructs.
  • We use the VM specification tool Vmgen to specify the semantics of TinyVM instructions.
  • The TinyVM footprint is less than 12KB.

Experimental Results

Our survey of programs from the MiBench and Spec2K benchmark suites showed that
  • Huffman-encoded bytecode occupies only 36%-57% of the space of the corresponding binary code,
  • bytecode executes only 2-12 times slower on TinyVM on the ARM Xscale than binary code, and
  • a Speed-up by a factor of 2 can be gained through the use of superinstructions.

Supported Platforms

  • ARM Xscale CPU: Linksys NSLU2/Linux and IMote2
  • Intel IA32: Linux
  • Atmega128: Mica2


  • An Embedded Systems Programming Environment for C.
    B. Burgstaller, B. Scholz, and A. Ertl .
    In Proc. of the Euro-Par Conference,
    Lecture Notes in Computer Science (LNCS), Springer Press,
    Dresden, Germany, 29th August - 1st September 2006.
    [pdf] [slides]