The NVM bootloader program first initializes the PIOs related to the NVM device. Then it configures the right
peripheral depending on the NVM and tries to access this memory. If the initialization fails, it restores the reset
values for the PIO and the peripheral, and then tries to fulfill the same operations on the next NVM of the
sequence.
If the initialization is successful, the NVM bootloader program reads the beginning of the NVM and determines if
the NVM contains a valid code.
If the NVM does not contain a valid code, the NVM bootloader program restores the reset value for the peripherals
and then tries to fulfill the same operations on the next NVM of the sequence.
If a valid code is found, this code is loaded from the NVM into the internal SRAM and executed by branching at
address 0x0000_0000 after remap. This code may be the application code or a second-level bootloader. All the
calls to functions are PC relative and do not use absolute addresses.
Figure 11-4. Remap Action after Download Completion
0x0000_0000
Internal
ROM
REMAP
0x0010_0000
Internal
SRAM
0x0000_0000
0x0010_0000
0x0030_0000
Internal
ROM
Internal
ROM
0x0030_0000
Internal
SRAM
Internal
SRAM
11.4.3 Valid Code Detection
There are two kinds of valid code detection.
11.4.3.1 ARM Exception Vectors Check
The NVM bootloader program reads and analyzes the first 28 bytes corresponding to the first seven ARM
exception vectors. Except for the sixth vector, these bytes must implement the ARM instructions for either branch
or load PC with PC relative addressing.
Figure 11-5. LDR Opcode
31
28 27
24 23
20 19
16 15
12 11
0
1 1 1 0 0 1 I PU 1W0
Rn
Rd
Offset
Figure 11-6. B Opcode
31
28 27
24 23
0
11101010
Offset (24 bits)
68 SAMA5D3 Series [DATASHEET]
Atmel-11121F-ATARM-SAMA5D3-Series-Datasheet_02-Feb-16