When I was about 14 years old I had a summer job at an electronics company. I had just gotten my Commodore 64, and the guy who owned the electronics company asked me to bring my C64 to work, so that we could play with it. He bought me Rodnay Zaks “Programming the 6502”, which I still have in my bookshelf (the C64 actually had a 6510 CPU, but it was essentially a 6502 with some additional I/O pins). With the help of that book, the scarce documentation I could find (mostly German computer magazines), and this guy at the electronics company, I started learning how computers actually work. This is where my interest in and soft spot for bare metal programming, operating systems, compilers, and interpreters all stem from.
Fast forward to today, there is now an abundance of readily available SoCs and boards to play with, most of which are much more powerful than my old C64, still much cheaper and more compact.
For some time I have been thinking about the relation between an operating system and a virtual machine, in particular for embedded systems. And in particular, a virtual machine suitable for running some form of LISP. Therefore I decided to start a project writing a virtual machine, targeting primarily embedded systems, with suitable OS features, allowing you to write embedded software in LISP.
I was initially thinking of targeting the Raspberry Pi, as it is easy to get hold of. But it is also pretty poorly documented, and still riddled with binary blobs. I also looked at the BeagleBone Black, which seems nicer from a documentation point of view. But then I found the Adafruit Feather series of development boards. The Feather boards comes in two different versions, one with the Atmel ATmega32u4 AVR microcontroller, and one with the Atmel ATSAMD21G18 ARM Cortex-M0+ microcontroller. In addition to the microcontroller, the Feather boards optionally comes with one additional component, such as a WiFi chip, an ISM radio chip, a GPS chip, and so on. I decided to start out targeting the Cortex-M0, as it includes a whopping 256kB of flash and 32kB of SRAM, various serial communications devices (UART, SPI, I2C), and various other digital and analog inputs and outputs. All in all, a very fun platform.
Having chosen an initial hardware platform, I started research virtual machine architectures. Turns out there are many, but the primary difference is between stack based and register based machines (much as for hardware processors, I guess). After some reading, I settled for starting out with Peter J. Landins design, the SECD Machine. I am sure there are many other choices, but one has to start somewhere… :-)
You might argue that this work has already been done over and over again; there are many implementations of variants of the SECD Machine available on the internet. But with projects like this, the point is not so much the end result, but rather the path to it. I do this, not because of a great need of the end result, I do it because it is fun, and I think I will learn a lot about both hardware and software.
As of this writing, no code exists, but as soon as I have got something, I will put it up on GitLab!