liveBook · Manning

Memory placement

As explained in Embedded Software with Rust

Memory-region placement is the assignment of an object or section to a specific address range in a program's memory layout.

Memory placement assigns code and data to specific address ranges. In bare-metal firmware, a linker script defines where executable code, constants, variables, the interrupt vector table, and the stack reside. section 4.1

Rust attributes can control data representation, alignment, and section placement; linker scripts define the memory regions that sections occupy. These controls matter when hardware can access only particular RAM regions. section 5.4 section 7.2.6

For a buffer used by a peripheral:

  • Prefer static storage with explicit memory-region placement when the peripheral cannot reach every RAM region. section 7.2.6
  • Use linker scripts and section attributes to fix the buffer's address at link time; verify that its region is reachable by the peripheral. section 5.4 section 7.2.6

DMA reachability

On an STM32H7, the main DMA controllers can reach DTCM, while the low-power BDMA peripheral is limited to a particular SRAM block. A statically placed buffer makes its address checkable against the peripheral's reachable regions. section 7.2.6

How Embedded Software with Rust covers it

How deep it goes
Explains linker-script placement and Rust attributes, while deferring detailed linker mechanics.
Examples
Uses the STM32F103 Blue Pill for placement techniques and contrasts DMA-accessible regions on the STM32H7.
What you can do after
Configure statically placed buffers and check their linked memory regions against DMA access limits.
How it connects
Links linker scripts, Rust representation and alignment attributes, and DMA reachability.

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.