liveBook · Manning

Read-only data section

As explained in Embedded Software with Rust

The .rodata section contains read-only static data in a program image.

The .rodata section holds read-only static data. In the shown bare-metal layout, it stays in FLASH for both loading and execution because it does not need to change at runtime. section 4.1.1 section 4.1.3

.text :
  {
    *(.text .text.*)
  } > FLASH

  .rodata :
  {
    *(.rodata .rodata.*)
  } > FLASH

This linker-script fragment maps .rodata and its subsection names to FLASH. section 4.1.3

Unlike initialized mutable data in .data, .rodata does not need copying into RAM at startup. A static integer array such as TABLE is an example placed in .rodata. section 4.1.1 section 4.1.1

How Embedded Software with Rust covers it

How deep it goes
Explains FLASH placement and load-versus-execution addresses, without detailing .rodata initialization.
Examples
Uses a static integer array and a linker-script rule that maps .rodata and its subsections to FLASH.
What it assumes
Uses linker-script and embedded-memory context while defining LMA and VMA for microcontrollers.
What you can do after
Understand where read-only static data resides in the program’s load and execution layout.
How it connects
Connects .rodata with linker scripts, FLASH, LMA, VMA, .text, .data, and .bss.

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.