MicroLisp: Lisp For Microcontrollers Now Has Lisp-Based ARM Assembler

In a way it feels somewhat silly to market a version of Lisp as targeting resource-constrained platforms, considering the systems it ran on back in the 1960s, but as time goes on, what would have given 1970s Big Iron a run for its money is now a sub-$5 microcontroller that you can run uLisp (MicroLisp) on. This particular project now even has an ARM assembler that is written in Lisp whose source code (GitHub) fits on a mere two A4-sized pages.

ULisp currently supports five platforms, being AVR-nano (ATmega328 and similar low-cost AVRs), AVR, ARM, ESP (8266 and 32), as well as RISC-V. The purpose of this assembler is to execute native ARM instructions when running on an ARM board, since uLisp itself runs a Lisp interpreter on the platform. When executed natively like this, a considerable speed-up of the task can be expected, as illustrated by a number of ARM assembler examples in the documentation.

Running a Fibonacci sequence that takes 24.6 seconds with the Lisp version on an Adafruit Metro M4 is reduced to a mere 61 ms when ARM assembly is used instead. This shouldn’t be too shocking, since this assembler essentially bypasses the Lisp runtime, coming closer to what would be the performance of firmware written in e.g. C. However, it also demonstrates that with this ARM assembler it is possible to have your Lisp and still get native performance when you want it, all using Lisp code.

A yellow computer with a black keyboard and a small monochrome LCD screen

Low Power Challenge: The PotatoP Runs Lisp For Months Without Recharging

A common complaint among laptop users is that while battery technology has vastly improved over the past decades, a simulltaneous shrink in form factors has meant that a typical laptop today doesn’t last much longer on a battery charge than one from the early 2000s. But it doesn’t have to be that way, as [Andreas Eriksen] demonstrates with his entry for the Low Power Challenge. The PotatoP is a portable computer that should be able to run for about two years on a single battery charge, and can be topped up through an integrated solar panel.

Granted, it doesn’t have the processing power of even the cheapest laptop you can buy today, but it’s perfectly fine for [Andreas]’s use case. He’s a Lisp hacker, and a Sparkfun RedBoard Artemis can run uLisp just fine on its 48 MHz Cortex-M4F processor. The operating environment is very basic though, even requiring [Andreas] to write his own text editor, called Typo, to give him editing luxuries like backspace functionality and a movable cursor.

The Artemis board is very power-efficient by itself – typical power consumption is less than 1 mA. [Andreas] added a simple monochrome black-and-white LCD screen capable of displaying 53 columns of text, plus an SD card reader for data storage, and designed a sleek 3D-printed case to hold everything together. When running a typical piece of code, the entire system uses around 2.5 mA, which translates to about 125 days of continuous run-time on the beefy 12000 mAh lithium battery. Add a bit of solar power, plus a more realistic eight-hour working day, and the two year runtime estimated by [Andreas] appears entirely reasonable.

This has to be one of the most power-efficient portables we’ve ever seen, and one running Lisp at that. Despite its age, Lisp keeps popping up in interesting custom computers like the Lisperati1000 cyberdeck and The Lisp Badge.

Continue reading “Low Power Challenge: The PotatoP Runs Lisp For Months Without Recharging”

Lisp Runs This Microcontroller Pendant

As a programming language, Lisp has been around longer than any other active language except for Fortran. To anyone who regularly uses it, it’s easy to see why: the language allows for new syntax and macros to be created fluidly, which makes it easy to adapt it to new situations, like running it on a modern Atmel microcontroller to control the LEDs on this star pendant.

The pendant has simple enough hardware — six LEDs arranged around the points of the star, all being driven by a small ATtiny3227 operating from a coin cell battery. This isn’t especially spectacular on it’s own, but this particular microcontroller is running an integer version of a custom-built Lisp interpreter called uLisp. The project’s creator did this simply because of the whimsy involved in running a high-level programming language on one of the smallest microcontrollers around that would actually support the limited functionality of this version of Lisp. This implementation does stretch the memory and processing capabilities of the microcontroller quite a bit, but with some concessions, it’s able to run everything without issue.

As far as this project goes, it’s impressive if for nothing other than the ‘I climbed the mountain because it was there’ attitude. We appreciate all kinds of projects in that same vein, like this Arduino competitor which supports a programming language with only eight commands, or this drone which can carry a human.

AVR Bare Metal With Lisp

There are two kinds of programmers: those who don’t use Lisp, and those who need new parenthesis keycaps every six months. Lisp is one of those languages you either really love or really hate. If you love it, you may have checked out ulisp, which runs on Arduino boards of the AVR and ARM variety, as well as ESP chips, RISC-V, and others. A recent update allows the language to insert assembler into AVR programs.

We probably don’t need to convince anyone reading Hackaday why adding assembler is a good thing. It seems to integrate well with the environment, too, so you can write assembler macros in Lisp, which opens up many possibilities.

Continue reading “AVR Bare Metal With Lisp”