Download Real-Time Concepts for Embedded Systems by Qing Li
Transcript
This document is created with the unregistered version of CHM2PDF Pilot execute from ROM while using RAM for data, • execute from RAM after being copied from ROM, and • execute from RAM after being downloaded from a host system. In the discussions to follow, the term ROM refers to read-only memory devices in general. 3.3.1 Executing from ROM Using RAM for Data Some embedded devices have such limited memory resources that the program image executes directly out of the ROM. Sometimes the board vendor provides the boot ROM, and the code in the boot ROM does not copy instructions out to RAM for execution. In these cases, however, the data sections must still reside in RAM. Figure 3.3 shows this boot scenario. Figure 3.3: Boot sequence for an image running from ROM. Two CPU registers are of concern: the Instruction Pointer (IP) register and the Stack Pointer (SP) register. The IP points to the next instruction (code in the .text section) that the CPU must execute, while the SP points to the next free address in the stack. The C programming language uses the stack to pass function parameters during function invocation. The stack is created from a space in RAM, and the system stack pointer registers must be set appropriately at start up. The boot sequence for an image running from ROM is as follows: 1. The CPU s IP is hardwired to execute the first instruction in memory (the reset vector).