Datasheet

57
SAM9M10 [DATASHEET]
6355FATARM12-Mar-13
Figure 11-3. Remap Action after Download Completion
The NVM bootloader program initializes the NVM. It initializes the required PIO. It sets the right peripheral depend-
ing on the NVM and tries to access the memory. If the initialization fails, it restores the reset values for the PIO and
peripherals and then the next NVM bootloader program is executed.
If the initialization is successful, the NVM bootloader program reads the beginning of the NVM and determines if
the NVM contains valid code.
If the NVM does not contain valid code, the NVM bootloader program restores the reset value for the peripherals
and then the next NVM bootloader program is executed.
If valid code is found, this code is loaded from NVM into 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.
11.4.2 Valid Code Detection
There are two kinds of valid code detection. Depending on the NVM bootloader, either one or both of them is used.
11.4.2.1 ARM Exception Vectors Check
The NVM bootloader program reads and analyzes the first 28 bytes corresponding to the first seven ARM excep-
tion 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-4. LDR Opcode
Figure 11-5. B Opcode
Unconditional instruction: 0xE for bits 31 to 28
REM A P
nternal
M
Internal
SRA M
0x0030_0000
0x0000_0000
Internal
RO M
0x0040_0000
nternal
SAM
Internal
SRA M
0x0030_000
0
0x0000_000
0
Internal
RO M
0x0040_000
0
31 28 27 24 23 20 19 16 15 12 11 0
111001 I PU1W0 Rn Rd Oset
31 28 27 24 23 0
11101010 Oset (24 bits)