AT91 Bootstrap Loader Overview

The AT91 Bootstrap Loader is a first-stage bootloader for Atmel AT91 chips, such as the AT91SAM9260. It is not capable of booting the kernel on it's own, but instead loads a secondary bootloader, such as U-Boot. The entire purpose of AT91 Bootstrap is to load another program into memory and configure some of the necessary hardware drivers to aid in this function.

AT91 Bootstrap Loader is open source, and thus can be reconfigured to work differently than it was originally built. This page is a collection of various tweaks that can be done to the AT91Bootstrap Loader.

NOTE: The newest versions of AT91Bootstrap Loader (Version 3 and newer) are available from www.atmel.com. It is completely different from the older versions, and will not build with the toolchain distributed by Timesys. Amongst other things, it provides the ability to boot from SD card. Please visit the Atmel website for more information: http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4343

Configuration file

Each board and boot medium has a specific configuration file in the AT91 Bootstrap source tree. These take the form of: board/<board name>/<boot media>/<board name>.h. For example, for the AT91SAM9260-EK booting from dataflash, the relevant information is in board/at91sam9260ek/dataflash/at91sam9260ek.h.

Changing the Image Address

There are a number of #defines that determine the behavior of AT91 Bootstrap in the configuration file.

#define AT91C_SPI_PCS_DATAFLASH         AT91C_SPI_PCS1_DATAFLASH        /* Boot on SPI NCS1 */

#define IMG_ADDRESS             0x8000                  /* Image Address in DataFlash */
#define IMG_SIZE                0x30000                 /* Image Size in DataFlash    */

#define MACH_TYPE               0x44B                   /* AT91SAM9260-EK */
#define JUMP_ADDR               0x23F00000              /* Final Jump Address         */
  • AT91C_SPI_PCS_DATAFLASH — The Dataflash CS signal that is used for the boot medium (AT91C_SPI_PCS0_DATAFLASH or AT91C_SPI_PCS1_DATAFLASH).
  • IMG_ADDRESS — The address offset from the beginning of the boot medium that contains the image.
  • IMG_SIZE — Maximum size of the image.
  • MACH_TYPE — Machine Type ID of the processor (typically standardized by kernel.org).
  • JUMP_ADDR — Address in memory where image is loaded, and consequently where AT91 Bootstrap jumps to at the end of it's execution.

Enabling early debugging

It is possible to enable serial console output in the AT91 Bootstrap Loader, although this increases the image size.

In the configuration file, substitute:

#undef CFG_DEBUG

with

#define CFG_DEBUG 1

You can now use the dbg_print function to print to the serial console.

void dbg_print(const char *ptr)

Enabling the Watchdog Timer

The watchdog timer on the AT91SAM boards is very touchy, and is disabled by default. To enable the timer (i.e. NOT disable it), remove the following line from the file board/<board name>/<board name>.c:

writel(AT91C_WDTC_WDDIS, AT91C_BASE_WDTC + WDTC_WDMR);

References

AT91 Bootstrap Product Page on Atmel.com