In my last post, I talked about how we have some new documentation available for people interested in porting the Transterpreter. This documentation is, primarily, about how to use C and occam-pi together to configure hardware devices for working with the Transterpreter.
However, writing programs that involve two languages does not necessarily make life easier. Which is why I'm glad to say that it is possible to talk to hardware directly from occam-pi. In our porting documentation, we demonstrate the use of C and occam-pi to control the LEDs on a Texas Instruments MSP430-based device. What's nice is that we don't need C at all!
In occam-pi, we can declare a variable PLACED. Normally when you declare a variable the compiler decides on where, in memory, that variable will go. However, when working with memory-mapped I/O, you might want to place a variable there, and know that whenever you set that variable's value, or read from it, you are reading from a particular location in memory. The PLACED keyword allows you to choose exactly where in memory that you want a particular variable to live.
You can do the same thing in C, of course... but you can't guarantee the safety of that memory-mapped location in the context of many threads. occam-pi, on the other hand, guarantees at compile time that your program is free from race hazards.
Currently, you can see my explorations with this in the trunk of the source tree in the tmotesky wrapper. Things will move, eventually; for now, the Native subdirectory contains my explorations in configuring the Tmote Sky entirely from the interpreted language. Right now, I'm working on the SPI bus and radio configuration.