PreonVM

Last updated
PreonVM
Written in C, Java
Platform ARM Cortex-M
Type Java virtual machine
License Proprietary software
Website PreonVM

PreonVM is an implementation of the Java virtual machine developed by Virtenio. [1] The PreonVM was initially developed to run on the Atmel AVR ATmega256, but has been ported to ARM Cortex-M3 systems. Therefore the VM can run on a microcontroller with 8 kB RAM and 256 kB ROM at a minimum. The PreonVM requires no additional operating system and runs directly on the microcontroller.

Contents

Every class file of the application is transformed via a ClassLinker to strip all parts of class files that is not required. This makes it possible to reduce the class file size by about 80%, which is required for a small device. The ClassLinker builds a .vmm file which combines all application class files in a special format which can be read and executed by the PreonVM on the microcontroller.

The VM supports all Java data types incl. long and double, threads, synchronization, Garbage collection with memory defragmentation, exceptions, system properties and IRQ/event system. The PreonVM comes with a library of driver classes for IO like I2C, SPI, USART, CAN, PWM, IRQ, RTC, GPIO, ADC, DAC and with drivers for some sensors and IC's.

Code example

The following code examples uses an SHT21 sensor and reads the relative humidity.

publicclassSHT21Demo{publicstaticvoidmain(String[]args){// sensor is connected to I2C bus instance 1NativeI2Ci2c=NativeI2C.getInstance(1);i2c.open();// create and init SHT21 sensor instanceSHT21sht21=newSHT21(i2c);sht21.setResolution(SHT21.RESOLUTION_RH12_T14);sht21.reset();// read and print humidity every secondwhile(true){sht21.startRelativeHumidityConversion();Thread.sleep(100);intrawRH=sht21.getRelativeHumidityRaw();floatrh=SHT21.convertRawRHToRHw(rawRH);System.out.println("SHT21: rawRH="+rawRH+"; RH="+rh);Thread.sleep(900);}}}

See also

References

  1. "PreonVM - JavaVM for embedded systems". VIRTENIO GmbH. Archived from the original on 2019-11-05. Retrieved 2025-11-17.