← Back to the chapter · Next detail →

Technical detail · Microcontroller Programming: Timing and Reliability

Cortex-M address regions and attributes

Cortex-M code uses a 32-bit address space, even if a board has only a small amount of memory. The map gives tools a common starting point. The device manual says which flash, SRAM, and peripheral addresses exist on the selected chip.

A cache is a small, fast store that keeps copies of recently used data to reduce slower memory access. The stack holds function call state and local values; the heap supplies memory requested while a program runs.

Write-through and write-back describe when a cache writes changed data to memory: immediately or later. Write-allocate means a write to data absent from the cache brings that data into the cache; no write-allocate does not. A memory protection unit (MPU, distinct from the microprocessor sense) controls permissions and attributes for memory regions. Shared device memory can be observed by other system components; non-shared memory is treated as local to the relevant observer under the default attributes. Check the actual core and chip configuration before relying on these properties.

Address rangeArchitectural regionPractical interpretation
0x00000000–0x1FFFFFFFCodeBoot aliases, flash, ROM, and code-facing regions defined by the device
0x20000000–0x3FFFFFFFSRAMOn-chip volatile data and implemented aliases
0x40000000–0x5FFFFFFFPeripheralMemory-mapped device registers; accesses may have side effects
0x60000000–0x7FFFFFFFExternal RAM, lower halfCortex-M4 default normal memory: write-back, write-allocate
0x80000000–0x9FFFFFFFExternal RAM, upper halfCortex-M4 default normal memory: write-through, no write-allocate
0xA0000000–0xBFFFFFFFShared deviceExternal or system device space whose ordering/shareability matters
0xC0000000–0xDFFFFFFFNon-shared deviceDevice space not shared with another observer in the default model
0xE0000000–0xFFFFFFFFSystemPrivate peripheral bus, debug, interrupt controller, and vendor/system areas

These rows describe Cortex-M4 default attributes; MPU settings can override them where implemented. The labels for external RAM do not mean that every chip has a cache. Cortex-M0 and M0+ do not gain one from an address range. Check the core and chip manuals for memory and bus support. Most MCU work uses code, SRAM, peripherals, and system space.

A peripheral can occupy an address, but its registers do not act like ordinary RAM. A read may clear a flag, and writing one to a bit may clear it. The size and order of access can matter. Use the vendor header and read the register description before a read-modify-write operation.

← Back to the chapter · Next detail →