01 - New Project: Hubris on micro:bit
For my first project, I set my sights on learning about embedded Rust.
I've used Rust a little in the past, but the whole concept of no_std was something I have never touched. It seems odd to me that a language with more bells and whistles than something like C also has an option to remove standard library functionality altogether. It's like saying "embedded Java": it just sounds kinda awkward (although a quick Google search tells me that's been a thing too).
I attribute this confusion about embedded languages to a general lack of understanding of embedded programming and embedded systems. All the more reason to look into it a bit deeper.
Getting started with the micro:bit v2
After googling a bit more, I found this great tutorial on how to get started with embedded Rust programming on a simple microcontroller board, the micro:bit v2. It has a nRF52 series chip running an ARM Cortex-M4 32-bit instruction set.
Aside; are all Cortex-M4 chips 32-bit? Also, does Cortex mean the same thing as Thumb, or is that a different distinction? ARM ISA naming is confusing, I gotta figure it out.
There's also some flash and RAM, and some peripherals: LEDs, a speaker and mic, accelerometer/magnetometer, DMA controller, etc.
The tutorial showed how to set up an embedded Rust workflow with cargo-embed and probe-rs. It was super useful in showing how to compile, deploy, and debug the programs running on the board. However, I felt like I was simply reading the tutorial, compiling and flashing the program, and seeing the result, without putting in much work. As a result I didn't feel like I was learning that much. I wanted to find something else to run on the board, and ideally that something needed to be modified a bit to get it to run there.
Enter Hubris
Hubris is a cute little OS targeting embedded systems. It has some neat features, like a microkernel design, "tasks" that are allocated at build-time (no fork/spawn!), IPC and lightweight notifications. It even has something called a "caboose"! What is it for? I don't know, but it sounds fun! What I do know is that it's written in Rust, and I want to learn embedded Rust, so it seems like a suitable program to port. I've also been following the company that wrote this OS for a while, and I've been looking for an excuse to mess around with this codebase.
So for this first project, I'm going to try to run a blinky program with Hubris on the micro:bit. Once I get there, depending on how fed up I am, I'll move on to writing some more complicated applications, perhaps using some of the devices on the board.