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
