Enabling interrupts on an armv7-a processor and the beaglebone black in particular is an interesting journey. In this article I will describe the process from start to finish for writing a generic interrupt handler in rust (and assembly).

An interrupt is the mechanism a processor uses to pause whatever it’s doing and pursue a side quest. This side quest may be something like “oh hey, someone plugged in a USB device. Let’s go check out what it is”. Or the side quest could be context switching between different threads. …


In this article I will describe one approach to implementing a stack using baremetal rust for the beaglebone black. Feel free to check out part 1 of my series for information on how to compile the code: https://sharpcoder.medium.com/baremetal-rust-for-beaglebone-black-part-1-compilation-6609cdc2545c

All source files can be found here: https://github.com/SharpCoder/baremetal-rust/tree/master/02-stack

This particular task is somewhat ambitious because the size of our data structure will not necessarily be known at compile-time. That means we’re going to need dynamic memory allocation. Typically you can accomplish this with some standard rust libraries, such as:

unsafe { alloc(Layout::new::<T>()) as *mut T };

But just to make life extra…


Image of the Beaglebone Black computing system

In this article I will explain how to compile a baremetal rust application for the Beaglebone Black SoC. The goal of this application will eventually be to emit morse code messages on the user LED’s. Manipulating the GPIO will be covered in a subsequent article.

All code in this article can be found on my github repo https://github.com/SharpCoder/armv7a-rust-os

References

First and foremost, some references and credit. The Beaglebone Black uses the AM3358 1GHz ARM Cortex A-8 and that is specifically what we will be programming, so the technical reference manual will be imperative.

AM335x Technical Reference Manual http://www.sal.wisc.edu/st5000/datasheets/tq-systems/spruh73p.pdf

And then a…


The ATTiny85 is truly an amazing little device. In my current project, I’ve used it to create a rotary encoder peripheral which I mean to hook up to the raspberry pi. The peripheral on its own took me weeks to design correctly, but now that it works beautifully I have to ask… How can I get those readings back to the raspberry pi? The answer is, of course, bit banging!

Some people may scoff at the idea of wasting software cycles to do the menial tasks required to communicate between devices. But to me, it is a fun challenge with…


Learning the i2c protocol using a raspberry pi can actually be a challenging task. The pi typically comes fully loaded with a complete Linux distro and as a result, we become far removed from the old days of pure bit banging. The mere notion of hardware level programming is typically accessible only through operating-system level functionality that simply doesn’t exist in the fun beginner languages like nodejs or even java. In this article, I will explain one way of communicating over i2c using simple tools and demonstrate how to read a data sheet and then write a driver for the…

Josh Cole

I am a self-taught software engineer, hacker, baremetal enthusiast.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store