Featured Article March 21, 2026

Bare-Metal Rust vs C++ on ARM Cortex-M

A definitive comparison of memory safety, binary size, and real-time performance when utilizing zero-cost abstractions in modern firmware development.

DM

Derek Molloy

Author & Engineer

#![no_std]
#![no_main]

use cortex_m_rt::entry;
use stm32h7xx_hal::{pac, prelude::*};

#[entry]
fn main() -> ! {
let dp = pac::Peripherals::take().unwrap();
let pwr = dp.PWR.constrain();
let pwrcfg = pwr.freeze();

let rcc = dp.RCC.constrain();
let ccdr = rcc.sys_ck(400.MHz()).freeze(pwrcfg, &dp.SYSCFG);

// Initialize the LED pin as an output
let gpioc = dp.GPIOC.split(ccdr.peripheral.GPIOC);
let mut led = gpioc.pc13.into_push_pull_output();

loop {
    led.toggle();
    cortex_m::asm::delay(20_000_000);
}
}

Books & Learning Resources

Comprehensive guides from fundamental electronics to advanced edge computing.

New Interactive Online Book

Edge Programming in C/C++ and Rust

Read my latest book entirely online. Master modern systems programming with interactive code examples, cross-compilation guides, and real-time operating system concepts tailored for IoT and Edge devices.

Start Reading Free

Edge
Programming

C/C++ & Rust
Exploring
Raspberry Pi

Exploring Raspberry Pi

Interfacing to the Real World with Embedded Linux. The definitive guide to engineering with the RPi.

View on Amazon
Exploring
BeagleBone

Exploring BeagleBone

Tools and Techniques for Building with Embedded Linux. In-depth coverage of the BeagleBone platform.

View on Amazon

Recent Articles

View all
std::atomic<bool> ready{false};
std::atomic<int> data{0};

void producer() {
data.store(42, std::memory_order_relaxed);
ready.store(true, std::memory_order_release);
}
C++ Concurrency

Demystifying Memory Ordering in C++

Understanding acquire-release semantics and how to correctly implement lock-free data structures without relying on sequential consistency.

Microcontroller
Embedded Linux

Device Trees from Scratch

Stop copy-pasting `.dts` files. A comprehensive guide to writing custom device tree overlays for custom carrier boards.

Server rack
Yocto Project

Optimizing Yocto Build Times

Utilizing sstate-cache effectively and setting up distributed builds using ICECC to drastically reduce bitbake execution times.

fn handle_irq() {
cortex_m::interrupt::free(|cs| {
    if let Some(mut rx) = RX.borrow(cs).borrow_mut().deref_mut() {
        let byte = rx.read().unwrap();
        // Process byte safely
    }
});
}
Rust Embedded

Safe Interrupt Handling in Rust

Dealing with shared mutable state across interrupt boundaries without resorting to unsafe blocks, utilizing Mutex and RefCell.

Hardware tools
Hardware Design

High-Speed PCB Layout Rules

Impedance matching, length tuning, and stackup design considerations when routing DDR memory on custom baseboards.

System Admin

Writing Custom Systemd Services

Ensuring your custom binaries start up correctly at boot, restart on failure, and integrate with the journal logging system.

About Derek Molloy

I am a Professor in the School of Electronic Engineering at Dublin City University. My research and teaching interests are in the areas of embedded systems, digital electronics, object-oriented programming, and the Internet of Things (IoT).

Through this website, my YouTube channel, and my books, I aim to provide high-quality educational content bridging the gap between high-level software engineering (C++, Rust) and physical hardware interfaces.

Subscribe to the Newsletter

Get notified about new tutorials, video releases, and book updates. I respect your inbox—no spam, just high-signal technical content.