9. Converting a Rust Project to Bare-Metal Firmware | no_std, no_main, & panic_handler Explained

❤️ Support this series (optional): If you find these STM32 + Rust tutorials helpful and would like to support more embedded content, you can do so here: paypal.me/edwardpie Thank you for helping me continue creating free embedded systems tutorials! In this video, we take a regular Rust project and manually transform it into a bare-metal firmware project for STM32 ARM Cortex-M microcontrollers. Instead of relying on templates or project generators, you'll learn exactly what changes are required and why each one is necessary. We begin by removing Rust's dependency on the standard library with #![no_std], then replace the normal program entry point using #![no_main]. Finally, we implement a custom #[panic_handler] to satisfy the compiler when panics occur in a bare-metal environment. Along the way, we'll discuss why these attributes are required and how they allow firmware to run directly on hardware without an operating system. This is the ninth video in the STM32 + Rust series, where we continue building the foundation for embedded Rust development. Understanding these three components is a major milestone because nearly every bare-metal Rust firmware project will use them before adding startup code, peripherals, and hardware abstraction layers. By the end of this tutorial, you'll understand how to manually convert a standard Rust application into a bare-metal firmware project, why no_std, no_main, and panic_handler are essential, and how they prepare your code to run on STM32 ARM Cortex-M microcontrollers.

All Rust features explained
▶︎

All Rust features explained

Rust Programming Full Course  | Learn ⚙️ in 2024 | #rustprogramming #rust
▶︎

Rust Programming Full Course | Learn ⚙️ in 2024 | #rustprogramming #rust

Let’s Handle 1 Million Requests per Second, It’s Scarier Than You Think!
▶︎

Let’s Handle 1 Million Requests per Second, It’s Scarier Than You Think!

I Hacked This Temu Router. What I Found Should Be Illegal.
▶︎

I Hacked This Temu Router. What I Found Should Be Illegal.

STM32 Linker Script from scratch | Bare Metal Tutorial
▶︎

STM32 Linker Script from scratch | Bare Metal Tutorial

Complete Terraform Course - From BEGINNER to PRO! (Learn Infrastructure as Code)
▶︎

Complete Terraform Course - From BEGINNER to PRO! (Learn Infrastructure as Code)

The Invisible Phone: Ditch PSTN Forever – No IMEI, No IMSI, No KYC, Total Stealth Calling
▶︎

The Invisible Phone: Ditch PSTN Forever – No IMEI, No IMSI, No KYC, Total Stealth Calling

This Post Office Was Totally Out of Control | 100% Cat Mail Co.
▶︎

This Post Office Was Totally Out of Control | 100% Cat Mail Co.

CHOSEN ONE!! YOUR IDENTITY REVEAL JUST SHOOK THE INTERNET... AND THEIR MINDS
▶︎

CHOSEN ONE!! YOUR IDENTITY REVEAL JUST SHOOK THE INTERNET... AND THEIR MINDS

Android 17 sucks. So I put Linux on a phone.
▶︎

Android 17 sucks. So I put Linux on a phone.

The Most Important Conversation in AI Right Now
▶︎

The Most Important Conversation in AI Right Now

Rust adoption in Linux is NOT going well…
▶︎

Rust adoption in Linux is NOT going well…

AJ Styles On Retirement, Gunther, Hall Of Fame, John Cena, One More Match?
▶︎

AJ Styles On Retirement, Gunther, Hall Of Fame, John Cena, One More Match?

MORNING PRAYER | Surrender Your Family to God with Faith and Walk this Day in His Peace and Prote...
▶︎

MORNING PRAYER | Surrender Your Family to God with Faith and Walk this Day in His Peace and Prote...

Inflation, Deficits, Interest Rates: Warning, Immediate Danger!
▶︎

Inflation, Deficits, Interest Rates: Warning, Immediate Danger!

URGENT UPDATE - Iran War Expert: A Mass Casualty Attack Is Coming! | Robert Pape
▶︎

URGENT UPDATE - Iran War Expert: A Mass Casualty Attack Is Coming! | Robert Pape

The World's Most Important Machine
▶︎

The World's Most Important Machine

Update from Ukraine | Russia Lost Su-57 jet over Moscow, Su-35 Was Shot Down by F-16
▶︎

Update from Ukraine | Russia Lost Su-57 jet over Moscow, Su-35 Was Shot Down by F-16

Why Sperm Whales Are The Most TERRIFYING Apex Predator On Earth
▶︎

Why Sperm Whales Are The Most TERRIFYING Apex Predator On Earth

How I animate 3Blue1Brown | A Manim demo with Ben Sparks
▶︎

How I animate 3Blue1Brown | A Manim demo with Ben Sparks

Watch Linux kernel developer write a USB driver from scratch in just 3h for Apple Xserve front-panel
▶︎

Watch Linux kernel developer write a USB driver from scratch in just 3h for Apple Xserve front-panel

Don't Hang Up On AI Scammers. Do THIS Instead.
▶︎

Don't Hang Up On AI Scammers. Do THIS Instead.

10. From Reset to main() | What Happens When an STM32 Microcontroller Starts Up
▶︎

10. From Reset to main() | What Happens When an STM32 Microcontroller Starts Up

I Bought And Restored "Old" Technology To Prove The Economy Is Imploding
▶︎

I Bought And Restored "Old" Technology To Prove The Economy Is Imploding

By August, We'll Have Frontier AI Running Locally
▶︎

By August, We'll Have Frontier AI Running Locally

Assembly Language Programming with ARM – Full Tutorial for Beginners
▶︎

Assembly Language Programming with ARM – Full Tutorial for Beginners

Political Prophet Predicts the Next Phase in Iran, Trump’s War Plan, & Israel’s Plot to Sabotage It
▶︎

Political Prophet Predicts the Next Phase in Iran, Trump’s War Plan, & Israel’s Plot to Sabotage It

How to make 3D Games in Godot
▶︎

How to make 3D Games in Godot

Helios Is AMD’s First AI System To Rival Nvidia Vera Rubin — We Got An Exclusive, First Look
▶︎

Helios Is AMD’s First AI System To Rival Nvidia Vera Rubin — We Got An Exclusive, First Look

Ai companies are terrified
▶︎

Ai companies are terrified