How to Build and Flash Bootloaders for NOR on the Atmel AT91CAP9A-DK

The AT91CAP9A-DK can boot from either NAND flash or Dataflash. However, you can also store U-Boot and its environment in NOR flash. Because the NOR flash is not a default search location for the boot ROM, you cannot boot only from NOR. Instead, you must load the bootstrap file from Dataflash or NAND flash, which will then load U-Boot from NOR flash. This document describes how to load the bootloaders into the proper locations for this configuration.

Building the Bootloader Images

Building AT91 Bootstrap Loader

  1. Download the sources and decompress the archive into a working directory.
  2. Enter the directory for the board and configuration that you want.
    cd at91bootstrap-<version>/board/at91cap9adk/norflash/
  3. AT91 Bootstrap uses a basic make command, with CROSS_COMPILE variable. Assuming that the toolchain is in your path,
    make CROSS_COMPILE=armv5l-linux-

    will compile the AT91 Bootstrap Loader. The resulting file, norflash_at91cap9adk.bin, will be in the current working directory.

Building U-Boot

  1. Download the sources and decompress the archive into a working directory.
  2. Enter the U-Boot directory.
  3. Configure U-Boot to use NOR flash by modifying the file include/configs/at91cap9adk.h as follows:
    #undef CFG_USE_DATAFLASH
    #define CFG_USE_NORFLASH               1
    

    then type the command:
    make at91cap9adk_config
  4. U-Boot uses a basic make command, with CROSS_COMPILE variable. Assuming that the toolchain is in your path,
    make CROSS_COMPILE=armv5l-linux-

    will compile U-Boot. The resulting file will be in the U-Boot root directory as u-boot.bin.

Burning the Images to NAND Flash

  1. Unplug the board.
  2. Remove any SD or DataFlash cards from the board.
  3. If a bootloader exists in the on-board DataFlash or NAND flash, erase it.
  4. Plug the board in to the power supply to power on the board.
  5. Replace any jumpers and cards that you removed.
  6. Plug the B-Type USB connector into the USB Gadget port on the board, and the A-Type connector into your host machine.
  7. Start the SAM-BA tool. Select AT91CAP9-DK-MEM33, and \usb\ARM0 (Windows) or /dev/ttyUSB0 (Linux) as your Connection. Click Connect.
  8. Burn the AT91 Bootstrap Loader file to NAND flash:
    1. Click on the NandFlash tab, select Enable NandFlash under the scripts dropdown.
    2. Click the NandFlash tab.
    3. Select Enable NandFlash under the Scripts dropdown and click Execute.
    4. Select Send Boot File under the Scripts dropdown and click Execute.
    5. Navigate to the .bin file and click Open.
  9. Burn U-Boot to NOR Flash.
    1. Click the NorFlash tab.
    2. Select Enable NorFlash under the Scripts dropdown and click Execute.
    3. Click the Browse button next to Send File Name under the Download/Upload File section. Navigate to the u-boot.bin file and click Open.
    4. Set the Address box to 0x8000.
    5. Click Send File.
  10. Close SAM-BA and reset the board.

NAND Flash Memory Map

Start Address Size Function
0x0 0x20000 AT91 Bootstrap Loader

NOR Flash Memory Map

Start Address Size Function
0x4000 0x4000 U-Boot Environment
0x8000 0x30000 U-Boot