Embedded computer systems seem to be the antithesis of functional language systems. Embedded systems are small, stand-alone, and are often forced to accept inelegant design compromises due to hardware cost. They run continuously and are reactive, that is, their primary goal is to monitor sensors and control effectors, using observed external events to trigger state-changing control actions. Yet this thesis describes how functional abstraction can tame the inelegance of embedded systems. Architectural compromises can be made in device drivers, programmed within the functional language, but a function-level interface is presented to the application programmer.
Four modifications are introduced to a test-bed purely-functional language in order to facilitate embedded-systems programming: I/O register access; communicating processes; interrupts; and a real-time incremental garbage collector. Referential transparency is preserved. The conventional model of communicating processes is augmented by the use of type classes and constructor classes to add type security around message-passing.
Two case studies of embedded applications are programmed: a marble-sorter and a liftshaft. Both give encouraging results for the adequacy of the approach. Two important areas are identified for future research. (1) It is not clear to what extent lazy evaluation is a help or a hindrance in programming embedded systems. (2) Real-time expression and guarantees of schedulability would extend the attractiveness of functional languages still further.
This doctoral Thesis is available in print as Functional Programming and Embedded Systems, YCST-95/04, January 1995, published by Department of Computer Science, University of York, York YO1 5DD, United Kingdom. This version is bound to a handy A5 size, and can be ordered at cost price from our librarian.
It is also available on-line in compressed postscript (443174 bytes). This version is formatted for printing double-sided on A4.