Software & Tools

Download Report

Transcript Software & Tools

AT91SAM Boot Strategies Application Deployment

Frederic BOYER Support & Training Group Engineer AT91 Training Coordinator ARM MCU & MPU

Outline

Introduction

Boot Solutions

Application Deployment

NVM Programming Solutions

ARM-Based Products Group 2

1. Introduction

1. Introduction

NAND vs. NOR Flash

Advantage of NAND

High Speed Program/Erase Low Cost-per-bit High Capacity

Disadvantage of NAND

Slow Random Access Time Difficulty of Byte Programming

Advantage of NOR

High Speed Random Access Byte Programming Code execution

Disadvantage of NOR

Slow Program Speed Slow Erase Speed

Applications

Suitable for

Data

Memory Program/Data Mass Storage

Applications

Suitable for

Code

Memory eXecute In Place (XIP) ARM-Based Products Group 4

1. Introduction

NOR vs. NAND Boot Considerations

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 ARM-Based Products Group 5

1. Introduction

AT91SAM Boot Strategies Introduction

To ensure maximum boot possibilities, memory layout can be changed with different parameters.

On our AT91SAM, either GPNVM bit or BMS pin responsible for the boot memory selection: is

  GPNVM bit for embedded flash µC: SAM7, SAM9XE.

BMS pin for the others: SAM926x, SAM9G20, SAM9R(L)…

GPNVM bit

(

Embedded Flash

based µC) OR

Power Up BMS pin

(

Flashless

µC) Boot Memory Selection ARM-Based Products Group 6

1. Introduction

AT91SAM Boot Strategies Introduction (cont.)

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 ROM

OR

Boot From (Int. or Ext.) Flash

ARM-Based Products Group 7

1. Introduction

Boot Memory Selection for Flash based µC (SAM7 and SAM9XE)

 

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

GPNVM bit = 1

Yes

Boot From ROM Boot From Embedded Flash

ARM-Based Products Group 8

1. Introduction

Boot Memory Selection for Flashless µC (SAM926x, SAM9R(L), SAM9G20)

BMS pin is sampled when VDDCORE is powered.

Power Up

Yes

BMS pin = 1

No

Boot From ROM Boot From External 16-bit Flash

ARM-Based Products Group 9

2. Boot Solutions

2. Boot Solutions

Booting From an eXecute In Place Memory

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…) 11 ARM-Based Products Group

2. Boot Solutions

Booting from ROM

AT91SAM BootROM

NVM Memory Bootloader SAM-BA Boot FFPI IAP Function 2 nd Level Bootloader ISP Gang Programmer Interface

ARM-Based Products Group

IAP

12

2. Boot Solutions

Flash AT91 µC SAM7S SAM7X/XC SAM7SE SAM7L SAM9XE FlashLess AT91 µC SAM9260 SAM9261(S) SAM9263 SAM9R(L)64 SAM9G10 SAM9G20 SAM9G45

BootROM Applications

NVM Bootloader SAM-BA Boot X X X X X X X X X X X X X X X X X X X

ARM-Based Products Group

FFPI X X X X X IAP Function X X -

13

2. Boot Solutions

NVM Memory Bootloader Application

 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

Yes

Valid Code ?

No

Copy code from NVM memory into SRAM Next NVM-Boot Reset Peripherals, remap and execute code out of SRAM ARM-Based Products Group 14

2. Boot Solutions

Supported NVM Memories

 Serial DataFlash: ATMEL AT45D and AT45DCB  Serial Flash: Industry’s most advanced ST, Winbond…) 25xxx compatible serial Flash (ATMEL AT25/26, SST,  SLC NandFlash: 8- and 16-bit, small and large blocks  SDCard: any FAT12/16/32 formatted SD Cards which are not High Capacity SDHC  EEPROM: any I²C Memory EEPROM ARM-Based Products Group 15

2. Boot Solutions

What is a valid code?

SD Card Example

:

 boot.bin file in the root directory of any FAT12/16/32 formatted SD Cards  Code size < AT91SAM internal SRAM size* * Max code size value must be checked in the Boot Program section of each product datasheet ARM-Based Products Group 16

2. Boot Solutions

What is a valid code (cont’d)?

DataFlash, NAND Flash, Serial Flash & EEPROM example:   The ARM exception vectors must have valid ARM instructions (B or LDR), excluding the 6 th vector The 6 th vector ( reserved vector @ 0x14), must correspond to the size of the image to be copied in internal SRAM .  Code size < AT91SAM internal SRAM size* 00

e59

ff074 04

e59

ff014 08

e59

ff014 0c

e59

ff014 10

e59

ff014 14

00000800

18

e59

ff060 1C

e59

ff00C

‘e59’

LDR opcode

Reset Undefined Instruction Software Interrupt Prefect Abort Data abort Reserved:

SIZE OF THE IMAGE

Normal interrupt Fast interrupt ARM exception vectors * Max code size value must be checked in the Boot Program section of each product datasheet ARM-Based Products Group 17

Vector 1 Vector 2 Vector 3 Vector 4 Vector 5 Vector 6 Vector 7 Vector 8

2. Boot Solutions

NVM Memory Bootloader Support

AT91 NVM SAM9260 rev A SAM9260 rev B SAM9261(S) rev A SAM9261 rev B DataFlash (SPI) X X X X Serial Flash (SPI) -

-

X SLC NandFlash (EBI)

-

X

-

X Standard SDCard (MCI) -

-

X EEPROM (TWI) -

-

X SAM9263 rev A SAM9263 rev B SAM9R(L)64 rev A SAM9G10 rev A SAM9G20 rev A SAM9G20 rev B SAM9G45 rev A X X X X X X X

-

X X X X

-

X X X X X X

-

X X X X X 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.

ARM-Based Products Group 18

2. Boot Solutions

No Valid Code Found

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?

ARM-Based Products Group 19

2. Boot Solutions

AT91SAM9R(L)64 Boot ROM Sequence

SD Card Boot on MCI NandFlash-Boot on EBI Chip Select 3 DataFlash-Boot on SPI Chip Select 0 SAM-BA Boot ARM-Based Products Group 20

2. Boot Solutions

SAM-BA Boot Application

 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.

ARM-Based Products Group 21

2. 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 22 ARM-Based Products Group

2. Boot Solutions

FFPI – Fast Flash Programming Interface Application

Provides programming solutions for high volume programming, with two interface options

  Serial: JTAG interface Parallel: 8-bit (AT91SAM7S16/32) or 16-bit (other AT91SAM)

Serial

(JTAG)

Parallel

(8- or 16-bit) ARM-Based Products Group 23

3. AT91SAM Application Deployment

3. Application Deployment

Standard Application Deployment

1st Level Bootloader (NVM Memory Bootloader) 2nd Level Bootloader (Optional) 3rd Level Bootloader Main Application AT91 Bootstrap U-boot E-boot Linux WinCE Standalone App

ARM-Based Products Group

FLASH Media(s)

25

3. Application Deployment

AT91 Bootstrap

Free 2 nd 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

Keil

NVM Memory Bootloader Support

NAND Flash AT45 DataFlash 25xxx Serial Flash SD Card CFI NOR Flash I 2 C EEPROM GNU In Dev ARM-Based Products Group IAR In Dev In Dev 26

3. Application Deployment

D

ATA

FL

ASH

Boot Example

SAMBA Boot

DataFlash Boot

ROM

0x8400 0x0000

D ATA F LASH

0x300000

Application

0x20000000

SRAM SDRAM

Current running Application in Red

ARM-Based Products Group 27

3. Application Deployment

NAND FLASH Boot Example

SAMBA Boot ROM

0x60000 0x20000 0x0000

NAND FLASH Linux Kernel

0x22200000 0x300000

AT91Bootstrap

0x20000000

U-Boot SRAM

Current running Application in Red

ARM-Based Products Group SDRAM 28

AT91SAM NVM Programming Solutions

4. 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: Atmel’s 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: Atmel’s Free their own GUI Interfaces solution for customers to create

Gang Programmers: support for all AT91SAM flash-based microcontrollers thanks to FFPI

ARM-Based Products Group 30

4. NVM Programming Solutions

SAM-BA GUI (AT91 ISP)

 Customizing SAM-BA is possible by adding or modifying TCL scripts files  Enable the NAND Flash, then Use the Sendboot file script  Command Line Mode: allows memory programming without any GUI interaction ARM-Based Products Group 31

Appendix AT91SAM Boot Program Algorithm Flow Diagrams

AT91SAM7X/XC/SE Boot Sequence

Power Up

PA0=PA1=1 PA2 = 0

Yes

FFPI

Yes

TST = 1

No No

GPNVM2 = 1

Yes

Boot From ROM SAM-BA Boot ARM-Based Products Group Boot From Flash User Application 33

AT91SAM7S Boot Sequence

Power Up Yes No

TST = 1

No

FFPI PA0=PA1=1

Yes

PA2 = 1 Boot From ROM

Yes

Boot From Flash User Application SAM-BA Boot Recovery

≈ 10 seconds

Power Up with TST=0

ARM-Based Products Group Boot From Flash SAM-BA Boot 34

SAM-BA Boot Recovery Application (SAM7S only)

 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 Unlock Sectors 0 & 1  Needs a power up sequence to run SAM-BA Boot (TST=0) Copy SAM-BA Boot from ROM to FLASH while(1);

Power Up

ARM-Based Products Group 35

AT91SAM7L Boot Sequence

Power Up

IAP Function

Yes

TST = 1

No No

GPNVM1 = 1

Yes

PC0=PC1=1 FFPI

Yes

Boot From ROM SAM-BA Boot ARM-Based Products Group Boot From Flash User Application 36

PA0=PA1=1 PA2 = 0

Yes

FFPI

AT91SAM9XE Boot Sequence

Power Up

IAP Function

Yes

TST = 1

No No

GPNVM3 = 1

Yes

Boot From ROM SAM-BA Boot ARM-Based Products Group Boot From Flash User Application 37

AT91SAM9260 Boot Sequence

Power Up

DataFlash-Boot on SPI0 Chip Select 0

Yes

DataFlash-Boot on SPI0 Chip Select 1 NandFlash-Boot on EBI Chip Select 3 SAM-BA Boot BMS = 1

No

Boot From External Memory on EBI Chip Select 0 User Application ARM-Based Products Group

Not Supported On revision A

Optional 38

AT91SAM9261(S) Boot Sequence

Power Up

SerialFlash-Boot on SPI0 Chip Select 0

Yes

DataFlash-Boot on SPI0 Chip Select 0 NandFlash-Boot on EBI Chip Select 3 SDCard-Boot on MCI EEPROM-Boot on TWI SAM-BA Boot BMS = 1

No

Boot From External Memory on EBI Chip Select 0 User Application ARM-Based Products Group

Not Supported On revision A

Optional 39

AT91SAM9263 Boot Sequence

Power Up Yes No

BMS = 1 SD Card Boot on MCI1 NandFlash-Boot on EBI0 Chip Select 3 Boot From External Memory on EBI0 Chip Select 0 User Application DataFlash-Boot on SPI0 Chip Select 0 SAM-BA Boot ARM-Based Products Group

Not Supported On revision A

Optional 40

AT91SAM9R(L)64 Boot Sequence

Power Up 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 41 ARM-Based Products Group

AT91SAM9G20 Boot Sequence

Power Up

SerialFlash-Boot then DataFlash-Boot on SPI0 Chip Select 0 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

Yes

BMS = 1 ARM-Based Products Group

No

Boot From External Memory on EBI Chip Select 0 User Application Optional 42