ROM Initialization Sequence
The ROM is split into two main parts:
- The low level initialization and setup, which is written in assembler: this part is responsible for ensuring that the power supplies are set up, and that memory instances are enabled for default power-up conditions.
- The higher level functionality implemented in C dealing with the various peripherals, life cycle states and security features: these are defined in more detail in Security Subsystem.
The ROM initialization sequence is shown graphically in the "ROM Initialization Sequence Flowchart" figure. The flowchart describes the various paths through the boot sequence, taking into account the possible life cycle states and power modes.
The "Boot Options" table shows the available boot options.
ROM Basic Initialization
The primary sequence of this initialization is as follows:
- Set up the NVIC to allow only NMI and Hard Fault exceptions.
- Disable the MPU, bus, and usage faults, forcing them to be always promoted to hard faults.
- Disable all of the external interrupts and clear all pending status indicators.
- Assign the NMI to a constant low source.
- Stop any running flash or flash copier operations.
- Reset the GPIOs.
- Enable all JTAG pins.
- Disable Pad Retention Mode.
- Configure the watchdog timer for a maximum timeout, and refresh.
- Disable DMA.
- Configure Non Secure code zone.
- Disable the SAU and set the ALLNS to zero so that everything is secure.
- Configure the non-secure accesses to RAM and peripherals as disabled.
- Make sure that the flash is not busy before setting up the RC.
- Configure the RC for 12 MHz.
- Select the RC oscillator as the system clock.
- Set up the various clock pre-scalars.
- Disable RF access.
- Disable the baseband interface.
- Enable all memories.
- Ensure that the Arm CryptoCell-312 (CC312) is enabled and ready to run.
- Set the system core clock variable and flash delays, indicating that the device is configured to use the 12 MHz RC oscillator.
ROM Status Variables & Status Codes
As part of its execution, the ROM sets several status variables indicating its execution status. These variables are stored near the base of RAM, starting at 0x20000004:
ROM Status
Variable indicating the status of the ROM execution, residing at 0x20000004.
ROM Context
Variable indicating the state of the device in which the ROM is executing. For example, this state could be energy harvesting mode or one of the secure life cycle modes. Resides at 0x20000008.
Application Status
Variable that is free to be used by the application. Resides at 0x2000000C.
Application Context
Variable that is free to be used by the application. Resides at 0x20000010.
The two tables below contain the possible values of ROM status ("ROM Status Values" table) and ROM context (the "ROM Context Values" table.