liveBook · Manning

Execution environment

As explained in Embedded Software with Rust

A runtime environment is the collection of execution support, hardware state, and software facilities available to a running program.

An embedded execution environment is the support available while firmware runs. Unlike desktop Rust, bare-metal code may have no operating system or standard-library runtime; it commonly uses `no_std`, `core`, and static allocation. section 2.1.1 section 1.3.1

Without an operating system or external loader, startup must prepare memory before transferring control to the application. The reset handler performs this setup and conventionally never returns. section 4.3 section 4.4

Table 1.1 Desktop Rust versus Embedded Rust applications
Feature Desktop Rust (std-based) Embedded Rust (no_std)

Runtime Environment

Rich runtime support provided by an OS (Linux, Windows, macOS).

Minimal runtime environment provided by the programmer or specialized crates (e.g., cortex-m-rt, riscv-rt).

Standard Library

Full access to std for file I/O, networking, threads, and dynamic heap allocation.

Restricted to core library; no built-in threads, no file I/O, and no dynamic memory allocation by default.

Memory Management

Automatic memory layout managed by the OS; heap is globally available.

Requires explicit memory layout defined by a custom linker script (memory.x). Heap usage requires a custom allocator.

Startup Process

OS loads the program and executes the standard main() function.

The developer must define a custom entry point (_start or similar) and handle low level initialization (copying data, zeroing BSS) before the application begins.

I/O and Peripherals

Relies on OS APIs for I/O (sockets, files).

Requires direct access to memory-mapped registers (MMIO) and hardware abstraction layers (HALs).

Compare hosted Rust’s OS-provided support with the runtime, memory, and startup responsibilities of embedded Rust. section 2.1.1 section 1.3.1

Use fixed-capacity storage

A `no_std` program without an allocator cannot use a heap-backed `Vec`; a fixed-size array provides storage without heap allocation. section 1.3.1

How Embedded Software with Rust covers it

How deep it goes
Connects no_std constraints to startup setup and the reset handler, without detailing all initialization steps.
Examples
Contrasts desktop std support with embedded no_std and replaces heap-backed Vec with a fixed-size array.
What it assumes
Introduces no_std through comparison with desktop Rust and assumes familiarity with heap-backed types such as Vec and String.
What you can do after
Operate/configure: recognize that bare-metal firmware needs startup setup and a minimal runtime.
How it connects
Links runtime support to no_std, core, linker scripts, memory layout, and reset handlers.

Also explained in

Compare how 5 books explain execution environment →

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.