Haskell on mcu

From base48
Jump to: navigation, search


Let's run some dose of Haskell on Cortex-M3/M4.

JHC

This is Haskell -> C transpiler (much like Cython for python) with very small runtime system (RTS), about 3k LOCS.

This seems to work, got it to produce x86_64 binary and some .c files. Produced code seems reasonably small.

AJHC

Fork of JHC for project Arafura, there is a slight difference in RTS in garbage collector and allocator. This is probably more suitable for 20k RAM in MCU.

However I did not manage to get ajhc load libraries, so it doesn't work yet.

There is an examples repository with some code that should run on stm32f4-discovery board. It uses some C wrapping to get HW up and running. However direct interaction with HW via writes and reads to/from memory (there's some monad with peek and poke) should be possible, so need for calls to C is minimal.


Dafuq

AJHC has targets.ini, this is descriptor how to call gcc for different target architectures. Adding arm-none-eabi-gcc in -mthumb and nosys mode seems trivial. This could maybe apply to JHC as well.

Needed

  • merge small memory stuff from ajhc to jhc
  • magic dust
  • a pony
  • 20k ducks of awesome