Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Udemy

Mastering Embedded Rust: Bare Metal, FFI, Crates, Projects

via Udemy

Overview

Master safe, modern embedded systems in Rust with bare-metal, FFI, drivers, crates & projects on STM32 microcontrollers

What you'll learn:
  • Rust programming language from scratch
  • Build your first bare-metal Rust application from scratch
  • Learn how to set up the Rust toolchain for building firmware that runs on ARM Cortex-M microcontrollers
  • Write your own linker script and startup file, and understand how memory layout and bootstrapping work in embedded Rust
  • Use cargo-binutils to inspect and analyze ELF files
  • Set up a modern and efficient workflow using VS Code to build, flash, and debug your Rust code with embedded targets
  • Using and understanding core embedded Rust crates
  • Log and debug efficiently in resource-constrained environments
  • Get hands-on with ARM Cortex peripherals like SysTick and ITM using the cortex-m and cortex-m-rt crates
  • Rust FFI: Create safe Rust APIs to interface with existing C libraries, making it easier to integrate Rust into existing C-based codebases
  • Learn how to safely pass structs, strings, and enums between Rust and C while maintaining type safety and control
  • Expose Rust functions to be callable from C, using unsafe and FFI concepts to manage cross-language interoperability safely
  • Step-by-step, build a real-world Flappy Bird game application using Rust
  • Build hardware-agnostic drivers using the embedded-hal traits, making your code portable across multiple microcontroller platforms.
  • Interface with real sensors ( MPU6050) to control game mechanics
  • Structure your code in clean, maintainable modules
  • Use the STM32 HAL crate to easily configure and control your microcontroller’s peripherals with safe Rust abstractions
  • Writing generic embedded code

==> Looking to add another embedded programming language to your arsenal? Give Rust a shot — you won’t be disappointed!!

This course is your starting point for using Rust on ARM Cortex Mx based microcontrollers such as STM32, even if you are new to embedded systems.

This is a fully hands on course that takes you from scratch into real world embedded Rust development on STM32. Each video builds on the previous, helping you progress step-by-step, from writing bare metal code to advanced topics like FFI, crates, driver development, and traits. Ideal for those new to Rust and embedded systems.


Why Rust for embedded?

Rust prevents many common memory issues (like null pointer dereferencing, buffer overflows, and use-after-free errors) through:

  • Ownership model: Rust’s strict rules around ownership, borrowing, and lifetimes prevent most accidental memory misuse.

  • Type safety: Rust’s type system ensures that you access data correctly and helps prevent certain types of invalid memory access by enforcing strict variable usage patterns.

Thanks to Cargo, Rust’s official package manager, you can easily add features by simply including external libraries, or "crates," which are like plug-and-play components.


What will you learn?

Here’s what you will master in this course:

  1. A beginner-friendly introduction to Rust, tailored for embedded systems

  2. Complete toolchain setup for cross-compiling, flashing, and debugging

  3. Debugging and logging with defmt and probe-rs for real-time tracing

  4. High-level peripheral programming with STM32 HAL crate

  5. Step-by-step, build a real-world Flappy Bird game application using Rust

  6. Interface with real sensors (MPU6050) to control game mechanics

  7. Clean, modular coding practices and hardware abstraction

  8. Build hardware-agnostic drivers using the embedded-hal traits

  9. Writing and understanding your own linker scripts and startup code

  10. Building generic embedded code using Rust generics and traits

  11. Safe and seamless Rust + C integration through FFI

  12. Confidence to write robust, reusable, and production-grade embedded firmware in Rust


Hardware Requirements

Note: If you already have a microcontroller development board, we recommend continuing with it. This course is designed with such thoroughness that the concepts and steps can be applied to most development boards though some minor adjustments may be needed. But, if you prefer to use the exact same board as the instructor for a smoother experience, you can check out the recommended hardware


1) Microcontroller development board

Option-1. STM32F303-Based Board

  • The course primarily utilizes Fastbit STM32 Nano board which is based on the STM32F303 microcontroller and onboard MPU6050 sensor.

Option 2. Any STM32 Microcontroller Board

  • You can use any development board featuring an STM32 microcontroller. The course content is designed to be adaptable, allowing you to follow along with the specific STM32 board you have available.

2)SWD-Based Debugger

  • An SWD (Serial Wire Debug) based debugger is required for programming and debugging your STM32 microcontroller. This tool is essential for loading your programs onto the microcontroller and for debugging your projects in real-time.

3) LCD shield

  • In one of the projects, you will need a TFT LCD module for experimentation. This course uses the Fastbit 1.28" TFT LCD with an 8-bit parallel interface, based on the GC9A01 LCD driver. However, you are free to use the same or a similar compatible module

4) MPU6050 sensor


Software requirements

  1. VS Code

  2. STM32CubeIDE

Syllabus

  • Introduction
  • Rust Toolchain Installation
  • Rust Fundamentals: Quick intro to core concepts
  • Cross compilation
  • Writing start-up code and linker script for bare metal Rust program
  • Flash and Debug
  • Exercise 002: Bare metal Rust application to handle LEDs using Interrupts
  • Exercise 003: Using external crate cortex-m-rt and cortex-m
  • Exercise 004: ITM prints
  • Rust Foreign Function Interface(FFI)
  • Exercise 005: Flappy Bird game implementation(Rust + C)
  • Creating hardware agnostic device driver using embedded-hal
  • Working with Hal crate and PAC
  • Using Traits
  • Logging
  • Exercise 005: Flappy Bird game implementation(Rust + C) contd.

Taught by

FastBit Embedded Brain Academy and Kiran Nayak

Reviews

4.6 rating at Udemy based on 138 ratings

Start your review of Mastering Embedded Rust: Bare Metal, FFI, Crates, Projects

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.