Figure 2.4: Processor Register Set
application binary interface) which dictates how registers are used. [2] This model explicitly assumes that the RAM for an executing program is divided into three regions as illustrated in Figure 2.5. The data in RAM are allocated during the link process and initialized by startup code at reset (see Chapter 3). The (optional) heap is managed at runtime by library code implementing functions such as the malloc and free which are part of the standard C library. The stack is managed at runtime by compiler generated code which generates per-procedure-call stack frames containing local variables and saved registers.
The Cortex-M3 has a “physical” address space of 2
bytes. The ARM Cortex-M3 Technical Reference Manual defines how this address space is to be used. [ 1] This is (partially) illustrated in Figure 2.6. As mentioned, the “Code” region is accessed through the ICode (instructions) and DCode (constant data) buses. The SRAM and Peripheral areas are accessed through the System bus. The physical population of these regions is implementation dependent. For example, the STM32 processors have 8K–1M flash memory based at address (0x08000000).
1
32
The STM32F100 processor on the Discovery board has 8K of SRAM based at address 0x20000000. Not shown on this address map are the internal Cortex-M3 peripherals such as the NVIC which is located starting at