liveBook · Manning

Bare-metal target

As explained in Embedded Software with Rust

A bare-metal target is an execution platform on which software runs directly on hardware without an operating system.

A bare-metal target runs software directly on hardware, without an operating system. Such targets have tight memory budgets and may require direct register-level control. Embedded Rust uses `no_std` for these systems, where the standard library is unavailable. section 1.0 section 2.8

Startup and failure behavior must be explicit. A `no_std` program supplies its own entry point, through a linker command such as `ENTRY` or a label such as `_start`, and defines a panic handler that never returns. A panic handler can log, break into a debugger, signal a fault, or rely on a watchdog reset. section 1.3.2

#![no_std]

#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
    loop {
        // optional: log, blink, or wait for watchdog
    }
}

This minimal panic handler loops indefinitely; development or production firmware can add its chosen failure behavior. section 1.3.2

Building firmware requires explicit target configuration and cross-compilation. Runtime crates such as `cortex-m-rt` or `riscv-rt` replace the standard library’s role; Cargo and binary utilities build and inspect firmware for deployment. section 2.8

How Embedded Software with Rust covers it

How deep it goes
Explains no_std startup, custom entry points, and explicit panic handling.
Examples
Uses ENTRY or _start labels and a panic handler that can log, signal a fault, or await watchdog reset.
What you can do after
Configure firmware targets and toolchains, and define entry and panic behavior for no_std systems.
How it connects
Connects Rust to no_std, cross-compilation, target triples, and embedded runtime crates.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Embedded Software with Rust. The section links point to the parts of the book it draws on.