1 Role of the ROM Code

The ROM code (or Boot ROM) is stored in on-chip mask ROM and executes on power-on or after a Reset. It is responsible for loading the user application or a second-stage bootloader from an external NVM into the internal SRAM. The size of this user application is limited. Once loaded into the internal SRAM, the ROM code disables all peripheral clocks it has previously enabled, sets the PIO muxing back to its Reset state and then jumps to the address of the internal SRAM to execute the user application.

The user application should be linked so that its entry point is at the very beginning of the internal SRAM. Nevertheless, just before jumping to the user application, the ROM code also remaps the internal SRAM at address 0x0. Thus when the user application places its Arm® exception vector table at the beginning of the internal SRAM, the vectors are also seen at 0x0 by the Arm core when it needs to access them.

In the Arm9™ architecture, the 6th exception vector is reserved and the ROM code uses this 32-bit data to store the size of the user application. The ROM code fetches this value to know exactly how many bytes it should transfer from the external NVM, optimizing boot time. The ROM code also checks the other exception vector values to decide whether the user application can be considered as valid, or whether it should be skipped. The ROM code then tries to boot from the next external NVM in the boot sequence.

Figure 1-1. ROM Code Process Flow