Free Your Pi With This Bare Metal Programming Environment

[Rene Strange] has graced these fair pages a short while ago with a sweet Raspberry Pi software based poly synth, with a tantalising reference to it being a bare metal application. So now, we’ll look into circle, the bare metal programming environment that it is based upon. The platform consists of a large set of C++ classes to access the hardware as well as perform tasks such as task creation and scheduling in the cooperative multitasking, multicore environment. Supporting all Raspberry Pi boards from version 2 onwards (not including the Pico!) in both 32-bit and 64-bit flavours, the environment is pretty complete. Classes are provided for USB, networking, FatFS, as well as more mundane tasks such as dealing with interrupts. On top of these classes there are a pile of application-specific libraries, covering functions such as display interfacing, GUIs using a variety of frameworks, and some more esoteric applications such as interfacing to a Pico, and even sending the system log to a remote web browser!

Classes and libraries however, don’t always help by themselves, which is where the 42 (yes, we know) code examples come in very handy. They’ve provided example applications for some fun stuff like drawing Mandelbrot fractals to the display, as well as some more mundane tasks that we have to deal with such as getting that pesky DMA controller to play nice with the SPI hardware. All-in-all, this looks like a great set of tools for taking full advantage of some fairly beefy hardware for your next embedded project that needs plenty of resources, but not all that unnecessary operating system stuff.

Perhaps not quite as complete as circle, but we’ve seen a fair few Raspberry Pi Bare metal projects over the years, like the Nerdsynth, based on the PiZero, and this neat little bare metal assembly language clone of starfox.

Thanks [Ruhan] for the tip!

Header: Aryan Patidar, CC BY 4.0/Evan-Amos, Public domain.

The rust language logo being branded onto a microcontroller housing

Baremetal Rust On The Horizon

Rust Programming Langauge has grown by leaps and bounds since it was announced in 2010 by Mozilla. It has since become a very popular language owing to features such as memory safety and its ownership system. And now, news has arrived of an Embedded Devices Working Group for Rust aiming at improving support for microcontrollers.

Rust is quite similar to C++ in terms of syntax, however Rust does not allow for null or dangling pointers which makes for more reliable code in the hands of a newbie. With this new initiative, embedded development across different microcontroller architectures could see a more consistent and standardized experience which will result in code portability out of the box. The proposed improvements include IDE and CLI tools for development and setup code generation. There is also talk of RTOS implementations and protocol stack integration which would take community involvement to a whole new level.

This is something to be really excited about because Rust has the potential to be an alternative to C++ for embedded development as rust code runs with a very minimal runtime. Before Arduino many were afraid of the outcome of a simple piece of code but with rust, it would be possible to write memory-safe code without a significant performance hit. With a little community support, Rust could be a more efficient alternative. We have seen some Rust based efforts on ARM controllers and have covered the basics of Rust programming in the past if you want to get started. Good times ahead for hardware hackers.

Raspberry Pi Plays MIDI Without An Operating System

[youtube=http://www.youtube.com/watch?v=k6TCysv6AzE&w=580]

For all the interesting DSP functions locked away in the Raspberry Pi, it’s still hard to imagine using the Raspberry Pi as an eminently capable software synthesizer, tracker, or sequencer. Running any of the usual Linux digital audio programs means – surprise – running Linux, and the performance penalty associated with that.

It would be much better if all these audio programs could run directly on the Raspberry Pi without an operating system, and [Joe]’s project is right up that alley. He’s playing MIDI files without an operating system, in effect making the Raspberry Pi a very powerful embedded platform.

[Joe]’s build is the first bare metal audio code for the Raspberry Pi. It’s actually an LV2 plugin host that will load audio plugins, read MIDI files, and shoot the resulting audio out over the 1/8″ jack on the Pi.  This work wouldn’t have been possible without a few Raspberry Pi bare metal tutorials put together by [David Welch].

Hopefully this won’t be the last we’ll see of [Joe] and his code; the Raspberry Pi has more than enough horsepower to be an amazing sampler, synth, beat machine, or the next generation of Akai MPC. All we need are a few brave coders to take up coding bare metal on the Raspberry Pi.