DEV Community

JoeStrout
JoeStrout

Posted on

MiniScript on a bare-metal Raspberry Pi

I recently discovered a C++ library (circle) that simplifies writing C++ programs to run on the Raspberry Pi, directly "on the metal" — without any operating system. I've had a Raspberry Pi 400 on my side table for a couple years now, running the standard Linux distribution, but not getting much use. What I really wanted was an experience like the classic home computers of the 80s: turn it on, and within seconds you are at a friendly blinking cursor, waiting for you to type some BASIC (or in our case, MiniScript) code.

So I decided to make exactly that.

Animated GIF of MiniScript-Pi in action, showing  raw `print "Hello world!` endraw ,  raw `print 6*7` endraw , and a MiniScript version of the classic 10PRINT demo

(For a bigger video showing the boot time and the Raspberry Pi, check out the YouTube video.)

What it does

  • Boots very fast
  • Presents a working MiniScript REPL
  • Supports command history
  • Provides all the MiniScript core intrinsics (print, rnd, etc.)

What it doesn't do

  • Key auto-repeat
  • Left/Right/Delete by word rather than by character
  • Have any editor or persistent in-memory program
  • Retain variables after hitting control-C
  • Provide any intrinsic methods/classes beyond what's in the MiniScript core

With these limitations — particularly the lack of an editable program — it's really just a tech demo, not useful for any real work. But it's a neat tech demo, if I do say so myself.

Try it!

If you have a Raspberry Pi (especially a Pi 4 — the code is untested and may not work on other versions of the Pi), you can run this yourself! Download the zip file from the release page, unzip it, and copy all the files therein onto an empty SD or MicroSD card formatted as FAT32. Insert this card into your Raspberry Pi, and turn it on. That's it!

If you're a developer and feeling adventurous, you can also try building it yourself. The source is all on GitHub. It uses the circle-stdlib project (which is circle plus some additions to support much of the C and C++ standard libraries) as a submodule; hopefully I've set that up correctly, but you could always clone that separately and place it in the MiniScript-Pi folder. Check out circle's build instructions for info on setting up your toolchain. (Mac users: be careful with the configure script, which does not work properly on MacOS; find me on Discord and I'll help you fix the script or configure manually.)

What's next?

Honestly, as much fun as this is, I need to put it on the shelf for a while, so I can focus on other projects like getting Mini Micro 1.2.1 out the door.

But if this project excites you and you want to see further development, do let me know! Your wish is my data point taken into serious consideration. 😁

Top comments (1)

Collapse
 
nigel447 profile image
nigel447

well worth the time to read this ++