Title: AT91SAM%20Boot%20Strategies%20Application%20Deployment
1AT91SAM Boot StrategiesApplication Deployment
Frederic BOYERSupport Training Group
EngineerAT91 Training CoordinatorARM MCU MPU
2Outline
- Introduction
- Boot Solutions
- Application Deployment
- NVM Programming Solutions
31. Introduction
4NAND vs. NOR Flash
1. Introduction
Advantage of NAND High Speed Program/Erase Low
Cost-per-bit High Capacity
Advantage of NOR High Speed Random Access Byte
Programming Code execution
Disadvantage of NAND Slow Random Access
Time Difficulty of Byte Programming
Disadvantage of NOR Slow Program Speed Slow
Erase Speed
Applications Suitable for Code Memory eXecute In
Place (XIP)
Applications Suitable for Data
Memory Program/Data Mass Storage
5NOR vs. NAND Boot Considerations
1. Introduction
- NOR Flash
- Used as an eXecute In Place (XIP) memory no need
to copy the program into RAM - Used to replace ROM
- NAND Flash
- Programs stored cannot be executed directly
- Code Shadowing must be performed memory contents
must be first copied into memory-mapped RAM and
executed there - Used to replace Hard Disk Drive
6AT91SAM Boot Strategies Introduction
1. Introduction
- To ensure maximum boot possibilities, memory
layout can be changed with different parameters. - On our AT91SAM, either GPNVM bit or BMS pin is
responsible for the boot memory selection - GPNVM bit for embedded flash µC SAM7, SAM9XE.
- BMS pin for the others SAM926x, SAM9G20,
SAM9R(L)
GPNVM bit (Embedded Flash based µC)
BMS pin (Flashless µC)
OR
Power Up
Boot Memory Selection
7AT91SAM Boot Strategies Introduction (cont.)
1. Introduction
- Regarding GPNVM bit or BMS pin state, the µC will
either - Boot from ROM
- Or Boot from the XIP memory (internal or external
Flash)
Boot Memory Selection
Boot From (Int. or Ext.) Flash
Boot From ROM
OR
8Boot Memory Selection for Flash based µC(SAM7
and SAM9XE)
1. Introduction
- GPNVM bit is sampled when VDDCORE is powered.
- GPNVM can be
- Set thanks to the EFC Controller
- Cleared thanks to the EFC Controller or by
asserting the ERASE pin.
Power Up
No
Yes
Boot From Embedded Flash
Boot From ROM
9Boot Memory Selection for Flashless µC(SAM926x,
SAM9R(L), SAM9G20)
1. Introduction
- BMS pin is sampled when VDDCORE is powered.
Power Up
Yes
No
Boot From External 16-bit Flash
Boot From ROM
102. Boot Solutions
11Booting From an eXecute In Place Memory
2. Boot Solutions
- XIP Memories used for booting purpose are
- Embedded Flash (SAM7, SAM9XE)
- External 16-bit Flash (SAM926x, SAM9R(L),
SAM9G20) - No boot program is executed, no initialization
performed - Whole microcontroller configuration must be made
in the application, such as - Clocks configuration Main Oscillator, PLL
- Embedded Flash Controller configuration (Wait
States) - External Bus Interface configuration (Setup,
Hold)
122. Boot Solutions
Booting from ROM
AT91SAM Boot ROM supports numerous applications
NVM Memory Bootloader
SAM-BA Boot
FFPI
IAP Function
2nd LevelBootloader
ISP
Gang Programmer Interface
IAP
13BootROM Applications
2. Boot Solutions
Flash AT91 µC NVM Bootloader SAM-BABoot FFPI IAP Function
SAM7S - X X -
SAM7X/XC - X X -
SAM7SE - X X -
SAM7L - X X X
SAM9XE - X X X
FlashLess AT91 µC
SAM9260 X X - -
SAM9261(S) X X - -
SAM9263 X X - -
SAM9R(L)64 X X - -
SAM9G10 X X - -
SAM9G20 X X - -
SAM9G45 X X - -
14NVM Memory Bootloader Application
2. Boot Solutions
1st Level Bootloader
- Contrary to XIP memories, it is not possible to
boot directly from a DataFlash, serial Flash,
NAND Flash, SDCard or EEPROM - NVM Memory content must be first copied into
memory-mapped RAM and executed there - NMV Memory Bootloader called NVM-Boot is
responsible for this copy
NVM-Boot
No need for external NOR Flash memory !
Yes
Valid Code ?
Copy code fromNVM memory into SRAM
No
Reset Peripherals, remap and execute code out of
SRAM
Next NVM-Boot
15Supported NVM Memories
2. Boot Solutions
One NVM memory for a whole application !!!
- Serial DataFlash ATMEL AT45D and AT45DCB
- Serial Flash Industrys most advanced 25xxx
compatible serial Flash (ATMEL AT25/26, SST, ST,
Winbond) - SLC NandFlash 8- and 16-bit, small and large
blocks - SDCard any FAT12/16/32 formatted SD Cardswhich
are not High Capacity SDHC - EEPROM any I²C Memory EEPROM
16What is a valid code?
2. Boot Solutions
- SD Card Example
- boot.bin file in the root directory of any
FAT12/16/32 formatted SD Cards - Code size lt AT91SAM internal SRAM size
Max code size value must be checked in the
Boot Program section of each product datasheet
17What is a valid code (contd)?
2. Boot Solutions
- DataFlash, NAND Flash, Serial Flash EEPROM
example - The ARM exception vectors must have valid ARM
instructions (B or LDR), excluding the 6th vector - The 6th vector (reserved vector _at_ 0x14), must
correspond to the size of the image to be copied
in internal SRAM. - Code size lt AT91SAM internal SRAM size
Vector 1 Vector 2 Vector 3 Vector 4 Vector
5 Vector 6 Vector 7 Vector 8
00 e59ff074 04 e59ff014 08 e59ff014 0c
e59ff014 10 e59ff014 14 00000800 18
e59ff060 1C e59ff00C
e59 ? LDR opcode
ARM exception vectors
Max code size value must be checked in the
Boot Program section of each product datasheet
18NVM Memory Bootloader Support
2. Boot Solutions
AT91 NVM DataFlash (SPI) Serial Flash (SPI) SLC NandFlash (EBI) Standard SDCard (MCI) EEPROM (TWI)
SAM9260 rev A SAM9260 rev B X X - - - X - - - -
SAM9261(S) rev A SAM9261 rev B X X - X - X - X - X
SAM9263 rev A SAM9263 rev B X X - - - X - X - -
SAM9R(L)64 rev A X - X X -
SAM9G10 rev A X X X X X
SAM9G20 rev A SAM9G20 rev B X X X X X X X X X X
SAM9G45 rev A X X X X X
- H/W (driven pins, clocks) S/W (max downloadable
code size) constraints can be found in the Boot
Program section of the product.
19No Valid Code Found
2. Boot Solutions
- As soon as valid code is found in a bootable
memory, - the boot ROM sequence is completed.
If no valid code is found, what is the next step?
20AT91SAM9R(L)64 Boot ROM Sequence
2. Boot Solutions
SD Card Boot on MCI
NandFlash-Boot on EBI Chip Select 3
DataFlash-Boot on SPI Chip Select 0
SAM-BA Boot
21SAM-BA Boot Application
2. Boot Solutions
- SAM-BA Boot is a little monitor that provides
In-System Programming Solutions through different
communication channels - DBGU Serial port interface
- USB Device port
- Used to interface ISP Software such as SAM-BA
GUI. - Check Boot Program section of the product
datasheet for H/W and S/W constraints such as
crystals/clocks support.
Free AT91 ISP Programming Solutions
222. Boot Solutions
AT91SAM7L AT91SAM9XE IAP Function
- IAP In Application Programming
- IAP feature is a function located in ROM, that
can be called by any software application - When called, this function sends the desired
FLASH command to the EFC and waits for the FLASH
to be ready - Executed from ROM, allows FLASH programming by
code running out of FLASH - This function takes one argument in parameter
the command to be sent to the EFC
Ease IAP Development
23FFPI Fast Flash Programming Interface
Application
2. Boot Solutions
H/W Programming Solution For Gang Prog.
- Provides programming solutions for high volume
programming, with two interface options - Serial JTAG interface
- Parallel 8-bit (AT91SAM7S16/32) or 16-bit (other
AT91SAM)
Security Bit Must Be Cleared
TST1
Serial (JTAG)
Parallel (8- or 16-bit)
243. AT91SAM Application Deployment
253. Application Deployment
Standard Application Deployment
AT91 Bootstrap
1st Level Bootloader (NVM Memory Bootloader)
2nd Level Bootloader
U-bootE-boot
FLASH Media(s)
(Optional)3rd Level Bootloader
Linux WinCEStandalone App
Main Application
263. Application Deployment
AT91 Bootstrap
Free
- Free 2nd Level Bootloader for AT91SAM9
- AT91Bootstrap integrates several sets of
algorithms - Device initialization such as clock speed
configuration, PIO settings, SDRAM initialization - Physical media algorithms such as DataFlash, NAND
Flash, etc. - Loaded thanks to NVM Memory Bootloader located in
ROM - Current Version is 1.11 and is integrated in our
software packages
NVM Memory Bootloader Support GNU IAR Keil
NAND Flash
AT45 DataFlash
25xxx Serial Flash
SD Card
CFI NOR Flash
I2C EEPROM In Dev In Dev In Dev
273. Application Deployment
DATAFLASH Boot Example
Application
Getting Started
Application
SAMBA Boot
0x8400
AT91Bootstrap
AT91Bootstrap
AT91Bootstrap
DataFlash Boot
NVM Boot
DataFlash Boot
0x0000
ROM
DATA FLASH
Application
AT91Bootstrap
AT91Bootstrap
0x20000000
0x300000
SDRAM
SRAM
Current running Application in Red
283. Application Deployment
NAND FLASH Boot Example
Linux Kernel
Linux Kernel
0x60000
SAMBA Boot
U-Boot
U-Boot
0x20000
NVM Boot
NandFlash-Boot
NandFlash-Boot
AT91Bootstrap
AT91Bootstrap
0x0000
ROM
NAND FLASH
Linux Kernel
0x22200000
AT91Bootstrap
U-Boot
0x20000000
0x300000
SDRAM
SRAM
Current running Application in Red
29AT91SAM NVM Programming Solutions
304. NVM Programming Solutions
NVM Programming Solutions
- Development Tools such as IAR, Keil integrate
their own flash loaders utility to flash the
application during debug phase - SAM-BA GUI Atmels Free programming solution for
on-chip and on-board memories - Serial port, USB and JTAG SAM-ICE support
- Graphical or command line interface
- Easy customization to create a custom board, add
new memories, etc. - AT91Boot_DLL.dll Atmels Free solution for
customers to create their own GUI Interfaces - Gang Programmers support for all AT91SAM
flash-based microcontrollers thanks to FFPI
Free
Free
314. NVM Programming Solutions
SAM-BA GUI (AT91 ISP)
- Customizing SAM-BA is possible by adding or
modifying TCL scripts files
Create your own board
Add memory modules
Modify Memory Algorithms
- Enable the NAND Flash, then Use the Sendboot
file script
- Command Line Mode allows memory programming
without any GUI interaction
32AppendixAT91SAM Boot Program Algorithm Flow
Diagrams
33AT91SAM7X/XC/SE Boot Sequence
Power Up
Security Bit Must Be Cleared
No
Yes
No
Yes
PA0PA11
PA2 0
Yes
Boot From Flash User Application
Boot From ROM SAM-BA Boot
FFPI
34AT91SAM7S Boot Sequence
Power Up
Security Bit Must Be Cleared
Yes
No
TST 1
Boot From Flash User Application
PA0PA11
Yes
PA2 1
Yes
No
Boot From ROM
Boot From Flash SAM-BA Boot
- SAM-BA Boot
- Recovery
- 10 seconds
FFPI
Power Up
with TST0
35SAM-BA Boot Recovery Application (SAM7S only)
Security Bit Must Be Cleared
- AT91SAM7S ROM is not mapped by default
- SAM-BA Boot Recovery Application is responsible
for copying SAM-BA Boot into Flash - 10 seconds necessary for the copy
- Needs a power up sequence to run SAM-BA Boot
(TST0)
TST1
Unlock Sectors 0 1
Copy SAM-BA Boot from ROM to FLASH
while(1)
Power Up
36AT91SAM7L Boot Sequence
Power Up
IAP Function
Security Bit Must Be Cleared
No
Yes
No
Yes
PC0PC11
Yes
Boot From Flash User Application
Boot From ROM SAM-BA Boot
FFPI
37AT91SAM9XE Boot Sequence
Power Up
IAP Function
Security Bit Must Be Cleared
No
Yes
No
Yes
PA0PA11
PA2 0
Yes
Boot From Flash User Application
Boot From ROM SAM-BA Boot
FFPI
38AT91SAM9260 Boot Sequence
Power Up
Boot From ROM
Boot From External 16-bit Flash
Yes
No
BMS 1
DataFlash-Boot on SPI0 Chip Select 0
Boot From External Memory on EBI Chip Select
0 User Application
DataFlash-Boot on SPI0 Chip Select 1
NandFlash-Boot on EBI Chip Select 3
SAM-BA Boot
Not Supported On revision A
Optional
39AT91SAM9261(S) Boot Sequence
Power Up
Boot From ROM
Boot From External 16-bit Flash
Yes
No
BMS 1
SerialFlash-Boot on SPI0 Chip Select 0
Boot From External Memory on EBI Chip Select
0 User Application
DataFlash-Boot on SPI0 Chip Select 0
NandFlash-Boot on EBI Chip Select 3
SDCard-Boot on MCI
EEPROM-Boot on TWI
Not Supported On revision A
SAM-BA Boot
Optional
40AT91SAM9263 Boot Sequence
Power Up
Boot From ROM
Boot From External 16-bit Flash
Yes
No
BMS 1
SD Card Boot on MCI1
Boot From External Memory on EBI0 Chip Select
0 User Application
NandFlash-Boot on EBI0 Chip Select 3
DataFlash-Boot on SPI0 Chip Select 0
SAM-BA Boot
Not Supported On revision A
Optional
41AT91SAM9R(L)64 Boot Sequence
Power Up
Boot From ROM
Boot From External 16-bit Flash
Yes
No
BMS 1
SD Card Boot on MCI
EBI Chip Select 0 User Application
NandFlash-Boot on EBI Chip Select 3
DataFlash-Boot on SPI Chip Select 0
SAM-BA Boot
Optional
42AT91SAM9G20 Boot Sequence
Power Up
Boot From ROM
Boot From External 16-bit Flash
Yes
No
BMS 1
SerialFlash-Boot then DataFlash-Boot on SPI0
Chip Select 0
Boot From External Memory on EBI Chip Select
0 User Application
SerialFlash-Boot then DataFlash-Boot on SPI0
Chip Select 1
NandFlash-Boot on EBI Chip Select 3
SDCard-Boot on MCI
EEPROM-Boot on TWI
SAM-BA Boot
Optional