# Application Validation and Boot

The RSL15 program ROM contains a set of functions that are used to validate and boot applications, following the completion of the security processes.

The ROM considers an application valid if it starts with its vector table, and no errors that would prevent boot are detected. Possible errors, and the error codes reported for these errors, are described in the "Application Validation" table.

Table: Application Validation
Error | Error Code | Description
--- | --- | ---
None | 0x0 | No error detected
Bad Alignment | 0x1 | The Arm Cortex-M33 processor requires that the application’s vector table is aligned to a 512-byte boundary in memory, for a device with the number of external interrupts that are included in the RSL15 SoC. The location of the specified application is not at a valid location in memory.
Bad Stack Pointer | 0x2 | The initial stack pointer must point to a valid memory location on the system bus. This requires that the specified stack pointer is 32-bit aligned, and that the next address stack data will be placed at is in DRAM or BB_DRAM.
Bad Reset Vector | 0x3 | The program ROM checks that the reset handler is located immediately after the vector table (or after a CRC located after the vector table). This check is performed indirectly by confirming that the reset vector points to a location that: Provides space for at least the minimum number of entries in the vector table (a minimum valid vector table contains 4 entries: the stack pointer, reset vector, NMI handler, and hard fault handler) Provides space for no more than the stack pointer, the 88 potential vectors, and a CRC (maximum of 90 words between the base of the application and the reset vector’s location)
Failed to Start the Application | 0x6 | Indicates that the application has failed to boot or has returned with no identifiable cause.
Bad CRC | 0x7 | A CRC-CCITT value can be placed between the vector table and the reset handler. The boot validation step validates if a CRC calculated over the vector table matches the value written at this location. NOTE: This error code is considered to be a non-fatal error, since the inclusion of a CRC is optional. The first entry on the application’s stack after boot will indicate whether no-error has occurred (0x0) or if a bad CRC has been discovered (0x7).

If the ROM determines that an application should be booted, the ROM:

1. Sets the VTOR bit-field in the Arm Cortex-M33 processor’s SCB register to point to the application’s vector table
2. Loads the initial stack pointer value from the application’s vector table to the Arm Cortex-M33 processor’s SP register
3. Pushes the application’s status code to the SYSCTRL_SYSCLK_CNT register (valid error codes for a booted application are None and Bad CRC, as described in the "Application Validation" table)
4. Branches to the beginning of the reset handler, as indicated by the reset vector in the application’s vector table