Datasheet

SAM9G45 [DATASHEET]
Atmel-6438O-ATARM-SAM9G45-Datasheet_08-Dec-15
64
10.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.
10.4.2.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 10-4. LDR Opcode
Figure 10-5. B Opcode
Unconditional instruction: 0xE for bits 31 to 28
Load PC with PC relative addressing instruction:
Rn = Rd = PC = 0xF
I==0 (12-bit immediate value)
P==1 (pre-indexed)
U offset added (U==1) or subtracted (U==0)
W==1
The sixth vector, at offset 0x14, contains the size of the image to download. The user must replace this vector with
his/her own vector. This information is described below.
Figure 10-6. Structure of the ARM Vector 6
The value has to be smaller than 60 Kbytes. 60 Kbytes is the maximum size for a valid code. This size is the
internal SRAM size minus the stack size used by the ROM Code at the end of the internal SRAM.
Example
An example of valid vectors follows:
00 ea000006 B0x20
04 eafffffe B0x04
08 ea00002f B_main
0c eafffffe B0x0c
10 eafffffe B0x10
14 00001234 B0x14
<- Code size = 4660 bytes <
60 Kbytes
18 eafffffe B0x18
10.4.2.2 boot.bin file check
The NVM bootloader program looks for a boot.bin file in the root directory of a FAT12/16/32 formatted NVM Flash.
31 28 27 24 23 20 19 16 15 12 11 0
111001IPU1W0 Rn Rd Oset
31 28 27 24 23 0
11101010 Oset (24 bits)
31 0
Size of the code to download in bytes