liveBook · Manning

Runtime crate

As explained in Embedded Software with Rust

A runtime crate supplies target-specific startup and exception-handling support for an embedded application.

A runtime crate supplies target-specific startup and exception-handling support for bare-metal Rust firmware, where there is no operating system or standard library. section 1.3 section 2.1.1

On common targets, runtime crates handle essential startup tasks:

  • Place the vector table and set the initial stack pointer. section 1.3.3
  • Copy initialized data into .data and zero .bss before transferring control to the entry function. section 1.3.3
  • Register interrupt and exception handlers, with defaults that applications can override. section 1.3.3

The common choices are cortex-m-rt for Cortex-M and riscv-rt for RISC-V. They reduce startup boilerplate; projects with unusual needs can use extension points for linker scripts, vector placement, early initialization hooks, or panic behavior. section 1.3.3 section 4.4.7

How Embedded Software with Rust covers it

How deep it goes
Details vector tables, stack setup, .data copying, .bss zeroing, and handler registration, while deferring customization mechanics.
Examples
Names cortex-m-rt and riscv-rt, and illustrates startup through vector tables, stack setup, and memory initialization.
What it assumes
Targets bare-metal Rust without std and distinguishes it from hosted Rust with operating-system and runtime support.
What you can do after
Apply cortex-m-rt or riscv-rt to automate low-level initialization, then use extension points for non-standard startup needs.
How it connects
Connects no_std Rust with vector tables, linker scripts, interrupt handlers, and exception handling.

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.