An Ocaml generic virtual machine for microcontrollers
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
avrs
benchs
bin
doc
etc
lib
src corrected a bug in simulator that shifted pixels Oct 22, 2018
tests
.gitignore
LICENSE-en
LICENSE-fr
Makefile
README.md
VERSION
configure

README.md

OCaml on Microcontrollers' Boards

OMicroB is an OCaml virtual machine dedicated at running OCaml programs on devices with very limited resources such as AVR Atmega32u4 microcontrollers (2.5 ko of RAM).

This tools, steming from the works of OCaPIC (https://github.com/bvaugon/ocapic) is seen as a generic virtual machine approach, which can be ported on various architectures.

OMicroB performs multiple static analysis passes in order to reduce the generated final executable.

Published version

An article describing our generic virtual machine approach has been published on ERTS 2018 :

A Generic Virtual Machine Approach for Programming Microcontrollers: the OMicroB Project (S. Varoumas, B. Vaugon, E. Chailloux)

Requirements

  • OPAM + OCaml (>= 4.03)
  • obytelib (on OPAM)
  • ocamlclean (on OPAM)
  • ocamlbuild (on OPAM)
  • gcc (for simulation)
  • avr-gcc, avr-libc (for AVR microcontrollers)
  • avrdude (for flashing to an AVR)

Installing

./configure && make && make install

Compiling an OCaml program

OMicroB is, at the moment, tied to the AVR C compiler. In order to compile an OCaml file for an AVR microcontroller, run

omicrob <file.ml>

that will generate a <file.hex> executable.

(The omicrob -help command will display the various available options, such as setting the stack size, the garbage collector algorithm, etc)

Flashing on a microcontroller

omicrob -flash <file.hex>

Simulator

OMicroB comes with a circuit simulator, for example running

make simul

in the tests/snake-mustard folder will simulate an Arduboy device on your computer, running the Snake game described in this folder.