Metasepi team meeting #7: Snatch application on tiny OS
Metasepi team meeting #7:
Snatch application on tiny OS
Who am I?
☆ Twitter: @master_q
☆ Organizer of Metasepi project
☆ A developer of Ajhc Haskell compiler
☆ A Debian Maintainer
☆ 10 years' experience in developing
OS using NetBSD.
☆  Demo
☆  What is Ajhc?
☆  What is Metasepi?
☆  What is compiler to build OS
☆  How to use Ajhc
☆  Snatch application on tiny OS
☆  Let's Snatch it!
☆ RSS reader running on mbed (ARM).
☆ Show reddit articles on LCD display.
☆ You can watch the movie following.
Architecture: ARM Cortex-M3
RAM size: 64kB
IO: Ethernet, LED, LCD, SD Card, USB
 What is Ajhc?
☆ Ajhc := A fork of jhc
☆ jhc := John's Haskell Compiler
☆ Jhc outputs binary that has lowmemory-footprint and runs fast.
☆ Good for embedded software.
Why need Ajhc?
☆ GHC is de facto standard on Haskell.
☆ GHC := Glasgow Haskell Compiler
☆ Why need another Haskell compiler?
☆ To develop kernel named "Metasepi".
 What is Metasepi?
☆ Unix-like OS designed by strong type.
☆ Using ML or more strong type lang.
. . . and suchlike.
Why need Metasepi?
☆ We have already Linux or Windows.
☆ But the developers are suffering.
☆ If use the kernel changed by you,
☆ you will get many runtime error.
☆ Difficult even to reproduce it.
Doesn't OSS have good quality?
☆ "The Cathedral and the Bazaar"
☆ "Given enough eyeballs, all bugs are
☆ But if you develop your own product
☆ Less runtime errors.
Kernel desperately wants type
☆ Kernels are developed with C lang.
☆ Error on user space => SEGV
☆ Error on kernel space => halt!
☆ Should design kernel with the
☆ C language is safe?
 What is compiler to build OS
☆ Need strong type.
☆ Need flexibility such as C language.
☆ Create it if there are not!
☆ From scratch? No thank you...
☆ Look for our compiler base.
Want POSIX free compiler
Programs to print "hoge" on terminal.
The lesser depends on POSIX, the
Jhc output has only 20 undef
$ nm hs.out | grep
Survive burning out
Let's develop in dogfooding style. (The
method is called "Snatch".)
 How to use Ajhc
Case of Ubuntu 12.04 amd64.
$ sudo apt-get install haskell-platform libncurses5-dev gcc m4
$ cabal update
$ export PATH=$HOME/.cabal/bin/:$PATH
$ cabal install ajhc
$ which ajhc
$ echo 'main = print "hoge"' > Hoge.hs
$ ajhc Hoge.hs
You can use on Windows or Mac OS X.
Detail of usage
Please read "Ajhc User's Manual".
Also you can read in Japanese.
 Snatch application on tiny OS
Snatch only the LED blinker thread.
☆ Board: STM32F4 Discovery
☆ OS: ChibiOS/RT
PR: Call For Articles
☆ Fanzine of functional programming.
☆ About Haskell or OCaml or . . .
☆ Article about Ajhc in C84 book.
☆ Call me if you read it!