PICBIT: A Scheme System for the PIC Microcontroller

Marc Feeley and Danny Dubé, PICBIT: A Scheme System for the PIC Microcontroller, Fourth Workshop on Scheme and Functional Programming. November 7, 2003.

This paper explains the design of the PICBIT R4RS Scheme system which specifically targets the PIC microcontroller family. The PIC is a popular inexpensive single-chip microcontroller for very compact embedded systems that has a ROM on the chip and a very small RAM. The main challenge is fitting the Scheme heap in only 2 kilobytes of RAM while still allowing useful applications to be run. PICBIT uses a novel compact (24 bit) object representation suited for such an environment and an optimizing compiler and byte-code interpreter that uses RAM frugally. Some experimental measurements are provided to assess the performance of the system.

A very interesting perspective on language implementation, found via @dhess and previous discussion.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

PICBIT vs. Forth

I enjoyed this paper. It's an interesting problem to engineer a high-level programming language for a target with only 2KB of RAM. In particular the simultaneous scarcity of RAM and plentitude of ROM makes for some interesting trade-offs.

I was recently working on from-scratch embedded Forth systems and we had similar trade-offs to make there, but on those we had so much RAM (16KB) that we didn't really feel the pinch.

The main question I have after reading the paper is: why? What makes PICBIT good for programming embedded systems?

In Forth's case the main selling point is that even with 2KB of RAM you can fit a complete programming environment with compiler, debugger, and REPL. This creates a comfortable environment where you can develop applications interactively over the serial link and don't have to rely on lengthy edit-compile-reflash workflows. This is also one of my favourite characteristics of Lisp and Scheme, but I don't know if it's preserved by PICBIT.

REPL not available

This is also one of my favourite characteristics of Lisp and Scheme, but I don't know if it's preserved by PICBIT.

I don't think it is; it looks like a separate compilation step on the host is required to size various tables and tune the object memory.