Site icon BBBlimp

Rust on Beagle Bone Blue

Thinking about reviving our blimp controls, Sebi unpacked our BBBlue again and had a bit of fun with it convincing it to interact with the Librobotcontrol over Rust.

The Rust code to work with seemed to be simple – just classical ‘Hello world’ enriched with an unsafe call to the librobotcontrol to blink LED #3 with 2Hz for 5s.

use librobotcontrol_sys as lrc;

fn main() {
    println!("Hello, world!");
    unsafe {
        lrc::rc_led_blink(lrc::RC_LED_USR3, 2.0, 5.0);

Toml file looked like this:

name = "blimp_control"
version = "0.1.0"
edition = "2021"

librobotcontrol-sys = "0.4.0"

While magic came in the Makefile, which looked like this:

	cross build --target armv7-unknown-linux-musleabihf

	scp "/home/sebula/code/bbblimp/blimp_control/target/armv7-unknown-linux-musleabihf/debug/blimp_control" debian@

As you can see above, Sebi is using “cross build –target armv7-unknown-linux-musleabihf” which allows him to cross-compile ARM code on his i686-64bit and then pushes it with SCP to the BBBlue sitting on a Wifi. This is pretty clever as compilation and code editing on a local laptop is much faster than externally the BBB.

This can really save time, Thank you Sebi!

Exit mobile version