Today was Monday of my eighth week at the Recurse Center as a participant in this year’s Summer 2 batch!

RC’s “Fall 1” Batch Started Last Week

The Fall 1 batch started last week and I’ve been spending some time getting to know all of the new folks. Like the Summer 2 batch this year, Fall 1 is also hybrid, but it seems like a lot more people are choosing to attend in person. It sounds like the Hub is much busier than when I visited and worked from there a couple weeks ago. It’s fun to have the injection of new energy and excitement midway through my own batch!

Working MoQ CLI Publisher

Last week, I finished the first iteration of moq-pub, my command line Media over QUIC ingest / publisher tool. It successfully sends media to a MoQ relay server and I can play back the media using a different JavaScript implementation. I’ll be cleaning up the code a bit and extracting it into a standalone repo to share soon.

Media over QUIC presentations

On Thursday I gave a very brief presentation about Media over QUIC to Recursers during Thursday presentations. With that context established, I’ll demo moq-pub at this week’s Thursday presentations.

I also gave a much longer presentation about Media over QUIC at BarCamp GR on Friday. It was very well received and I had a lot of fun filling the classroom whiteboards with explanatory diagrams.

API Design Noodling

Today I took a step back to mull over API design questions. Both because I’m thinking ahead towards helping moq-rs become a more easily consumed library (e.g. with a C FFI), and because I could work in that direction as I tidy up the code I already have in moq-pub.

Inspired by a new WebRTC implementation in Rust (str0m), I started reading up on the “Sans-I/O” approach to protocol library design that has helped the Python community bridge the gap between synchronous and async code. This approach has a lot of appeal, but I’m not yet 100% convinced it’ll be an easy fit for MoQ in particular given how much we’re trying to lean into affordances of the underlying transport protocol. It’s not clear exactly where the decoupled I/O boundary would fall or what that interface would look like for a MoQ implementation in Rust.

Embedded Rust Excursion

Besides reading and thinking about API design, I did also write a very small amount of Rust code today. Specifically, I managed to get the tooling in place to flash an old STM32 dev board with a very small bare metal Rust program to make an LED blink.

I borrowed heavily from another blog post about programming STM32F1 microcontrollers with Rust. That gave me the basic framework to get started.

Here are the additional things I needed to do to get my particular STM32L1-DISCOVERY dev board working:

  • Update the memory.x linker script with the specific values for my board (128k of Flash, 16k RAM)
  • Change out the STM32F1 specific HAL crates for STM32L1 variants
  • Update to a fork of the stm32l1xx-hal crate that has some changes from a not-yet-merged PR
  • Update to (similar) example code from that crate that matches the APIs of that version of that HAL library better
  • Build my code with cargo build --release
  • Attempt to flash board with cargo flash and get an error that “The firmware on the probe is outdated” and therefore incompatible with probe.rs
  • Track down a copy of STSW-LINK007, a firmware updating tool (the download contains both a Windows .exe as well as a cross-platform .jar)
  • Try to install OpenJDK various ways on my M1 MacBook Pro
  • Finally succeed by launching a shell in x86 mode (arch -x86_64 bash) and from there installing an Intel build via homebrew cask
  • Remove the automatically added quarantine attributes from the dylibs in the STSW-LINK007 download: xattr -d com.apple.quarantine ~/Downloads/stsw-link007/AllPlatforms/native/mac_x64/*.dylib
  • Launch the firmware updater from my Rosetta x86 emulated shell: java -jar ~/Downloads/stsw-link007/AllPlatforms/STLinkUpgrade.jar
  • Update the firmware on the ST-Link V2 embedded in my dev board
  • Flash my code to the board with: cargo flash --chip STM32L152RB --release

Here’s the repo with a version of this blinking LED example code that works for my particular board:

https://github.com/englishm/rusty-blink

As always, feel free to contact me about any of this on Zulip, IRC, Amateur Radio, Hachyderm, Bluesky, Discord, or wherever else you can find me (even if it’s the site formerly known as Twitter).