Blinking an LED with Rust on a Beaglebone Black

November 15, 2015

I started learning the Rust programming language about a week ago and have high hopes for this becoming one of the main languages I start to use professionally. Before that though, I wanted to find a hobby project to give me more motivation for working with the language on a regular basis, so I spent much of this weekend researching how to get Rust running on my Beaglebone Black so that I could get the traditional "Hello, World" example running (in other words, making an LED blink).

https://www.youtube.com/watch?v=_-_cLo1SQC8

There aren't official releases of Rust or Cargo for BBB yet, and I gave up on compiling Rust from source after hitting an internal compiler error in gcc (possibly due to lack of RAM). Luckily there are some unofficial binaries out there that work great. I also found the sysfs_gpio crate (Rust library) for GPIO manipulation.

I also tried creating a Docker image so that I could compile projects on my desktop, but cross-compile for deployment to the BBB. I was able to build the projects OK, but ran into an issue where a different GLIBC version was installed on the BBB, so the projects wouldn't run.

I've created a github repo for my BBB/Rust experiments. So far, I only have the blinking LED code working, which is really just the example from sysfs_gpio, but now that I have this working, I'm sure I can start building out some new crates for working with various sensors.