Most MCU-based embedded systems come with firmware programmed with assembler, C, and/or C++. But as referenced in a paper published in 2000 entitled ” Point of view: Lisp as an alternative to Java“, functional programming languages like Lisp or Scheme may lead to shorter development times compared to C/C++ or Java.
That’s with this idea in mind that LambdaChip was created. It is a lightweight, open-source virtual machine designed to run on embedded systems with limited resources, for instance, an 80MHz microcontroller with 50KB RAM, and programmable with Scheme multi-paradigm programming language, a dialect of Lisp widely used for functional programming research and teaching.
The company behind the project, also called LambdaChip, has just created its own hardware with LambdaChip Alonzo, an STM32 Cortex-M4 development board with 512KB flash, 128KB RAM, and that also comes with Bluetooth LE connectivity.
- MCU – STMicro STM32F411CEU6 Arm Cortex-M4 MCU @ 100 MHz with 512KB flash, 128KB RAM; UFQFN48 package
- Storage – MicroSD card socket
- Connectivity – Bluetooth 4.0 Low Energy
- Expansion – 2.54mm pitch header for GPIOs
- Debugging – 10-pin programming header for an external debugger
- Misc – RGB LED, white LED, 3x buttons (BOOT0, RST, and User)
- Power Supply – 5V via USB-C port, or battery via 2-pin connector
The board is not really unique, but includes the features need for LambdaChip such as a microSD card where the resulting binary is copied after compilation and automatically loaded by the virtual machine.
You’ll need a debugger to program the board, and that’s why the company also provides a complete kit with the Saruman debugger, USB and debugger cables, microSD card, USB SD card reader, and an acrylic case.
A Linux-based operating system is recommended for development, but since as they provide a docker image, Windows and Mac OS are also supported. Everything is done from the command line through the Laco environment with a Scheme compiler generating a LEF bytecode file. That is what a blinky sample looks like in Scheme:
(define (main x)
(gpio-toggle! "dev_led0" 15)
(if (= x 0)
(main (- x 1))))
You can download the schematics (PDF only), and read the documentation on LambdaChip website. The BLE demo below shows how to use the Laco environment to program the board, and transmits some messages to an Android phone running LightBlue app.
LambdaChip Alonzon board can be purchased for $29.00, but most people interested in the project would probably prefer to purchase the full kit for $99.00. Both are available on Seeed Studio.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
7 Replies to “Use Scheme functional programming language with LambdaChip Alonzo STM32 board”
May not be as polished/all-inclusive as the LambdaChip stuff, but if you have some MCU boards laying around, uLisp is very cool and very useful: http://www.ulisp.com/ – broad CPU support, extensible via normal Arduino IDE methods, etc.
If we’re going with interpreted languages, why not Python instead?
Would be interested to see if has anyone done a Lisp vs. Python resource usage comparison.
LambdaChip seems the only optimized compiler in MCU world. All others are interpreters, say, micropython, elua, ulisp, etc.
The trade-off is to drop REPL to control hardware, but the bytecode can be optimized for both size and performance.
Besides, LambdaChip is based on ZephyrRTOS, so it means it never concerns to support various platform, it can run on any platform supported by ZephyrRTOS, and that list is so long…
No thanks, I don’t like Lots of Irritating Single Parentheses.
LISP is normally interpreted, and it looks like the Lambda chip compiles to byte code for a virtual machine.
One question: how does this integrate with C? Python, Lua, Rust, C++, and such all integrate well with C, making it easy to interface with existing C code.
It’s not hard today, there is FFI (Foreign Function Interface), or write a similar one.
BTW, pick a better modern editor, and a parens plugin. Today the parens are handled well by the plugin, no irritation. It’s 21st century.
The have their own shop now: https://shop.lambdachip.com/