at91bootstrap: Customizing a Default Configuration

Last modified by Microchip on 2024/06/20 12:43

Introduction

This training topic shows you how a default configuration can be changed using menuconfig. Here are a few examples of some of the changes that can be made for your custom project:

  • Loading a bare metal binary image, RTOS, BusyBox, etc.
  • Building at91bootstrap for use with MPLAB® X IDE
  • Modifying Clock Source
  • Customize External RAM
  • Changing Display Banner
  • Booting from a different SD Memory Card slot

Prerequisites

For an introduction to at91bootstrap, visit the "at91bootstrap: A Second Stage Bootloader for Microchip MPUs" page.

Back to Top

Loading a Bare Metal binary image, RTOS, BusyBox, etc.

The at91bootstrap bootloader is capable of loading a bare metal, RTOS, BusyBox or another binary image to external RAM from external NVM Flash memory.

Configure at91bootstrap with the chosen defconfig file

$ make mrproper
$ make <board>_<nvm_boot_memory>_uboot_defconfig

Start menuconfig

$ make menuconfig

Select Image Loading Strategy ( )

Select (X) Load 1 MB into start of SDRAM

If the image to load is larger than 1 MB, you can select (X) Load 4 MB into start of SDRAM.
Image Loading Strategy dialog


ESC-ESC back to the top-level menu

Select Demo Application Image Storage Setup

To know what value to enter, refer to the linker file or MAP file as seen in the accompanying image.
Select Demo Application Image Storage Setup dialog


Enter the address of the external SRAM to load the image

To find this value, you can refer to the linker file or MAP file generated by the build. For example, the snippet below shows the linker file of an example getting-started program:

define memory mem with size = 4G;
define region RAM_region           = mem:[from 0x00200000 to 0x0021FFFF];
define region DDRAM_region         = mem:[from 0x20000000 to 0x23FFFFFF];
define region DDRAM_NOCACHE_region = mem:[from 0x24000000 to 0x24FFFFFF];

[..]

place at start of RAM_region { section .vectors };
place in RAM_region { block SRAM };
place in RAM_region { block IRQ_STACK };
place in RAM_region { block RAMCODE_BLOCK };

[..]

The snippet below shows the MAP file of an example getting-started program:

Section                 Kind         Address    Size  Object
  -------                 ----         -------    ----  ------
"A0":                                             0x3c
  section .vectors-1                 0x30'0000    0x3c  <Init block>
    .vectors              inited     0x30'0000    0x3c  cstartup.o [1]
                                   - 0x30'003c    0x3c

"P1-P3|P5":                                       0x60
  IRQ_STACK                          0x30'0040    0x60  <Block>
    IRQ_STACK             uninit     0x30'0040    0x60  <Block tail>
                                   - 0x30'00a0    0x60

"A1":                                             0xc8
  .cstartup               ro code  0x2000'0000    0xc8  cstartup.o [1]
                                 - 0x2000'00c8    0xc8

ESC-ESC back to the top-level menu

Select ( ) Image Name

Enter the name of the image to be loaded

Enter a String Dialog


ESC-ESC back to the top-level menu

ESC-ESC to exit menuconfig and save your configuration

Build at91bootstrap

​$ make

The results of the build will be located in the binaries/ directory:​

$ cd ~/project_1/at91bootstrap/binaries
$ ls -l
<board>_<nvm>_<image>_<version>.bin

 Below is an example of loading files to an SD Memory Card.

Note:

For an example of loading files to a QSPI Flash Memory, see the "ATSAMA5D27-SOM1-EK1 - Booting from QSPI Flash Memory" page.

 Copy and rename <board>_<nvm>_<image>_<version>.bin as boot.bin.

Copy getting_started.bin and boot.bin to an SD Memory Card formatted with a single FAT partition.
SD card format

 Insert the SD Memory Card into the custom project board (or evaluation kit) and power on.

You will see on the console at91bootstrap executing followed by the getting_started program:
COM7 - PuTTY window

Back to Top

Building at91bootstrap for use with MPLAB X IDE

In this scenario, at91bootstrap is configured to initialize external DRAM and is configured to not load any binary image. MPLAB X IDE first loads at91bootstrap into internal SRAM, at91bootstrap initializes external DRAM, and then MPLAB X IDE loads the binary.

Note:

There is a default configuration file for use with MPLAB X IDE for most evaluation kits. Look for <board>_bkptnone_defconfig in the at91bootstrap/boards/<board> directory.

The steps below are for evaluation kits that do not have a default configuration file for use with MPLAB X IDE.

After configuration of make, run menuconfig

$ make menuconfig

Select Image Loading Strategy ( )

Select (X) Do not load any image after bootstrap run

Image Loading Strategy Dialog


ESC-ESC back to the top menu

Select [*] Build image for use with debuggers

at91bootstrap-config-debugger-mrt338460.pngBuild Image Options Dialog


ESC-ESC to exit and Save your configuration

Build at91bootstrap

$ make

 The results of the build will be available in the ~/at91bootstrap/binaries directory.

Back to Top

Modifying Clock Source

When a microprocessor unit (MPU) performs a power-on-reset, it begins running on its internal 12 MHz RC oscillator (due to its fast startup time) and starts the first-stage boot process stored in its internal ROM (ROM Boot Code). However, the internal RC oscillator may not be stable and accurate enough for some peripherals (for example, USB). Each of the Microchip MPU evaluation kits has a 12 MHz crystal that can be enabled. Therefore, the external 12 MHz crystal oscillator is initialized and the main clock is configured to the external crystal oscillator.

MPUs can be configured for an external clock source. This signal typically comes from an external oscillator device and the signal is fed directly to the MPU.

The at91bootstrap can be configured for this scenario by following the steps below:

After configuration of make, run menuconfig

​$ make menuconfig

Select Main Crystal configuration

Select [*] Use external clock signal as a source of main clock

ESC-ESC back to the top menu

ESC-ESC to exit and Save your configuration

Build at91bootstrap

The results of the build will be available in the ~/at91bootstrap/binaries directory.

Note:

Refer to the target device datasheet for more detailed information on clock management.

Customize External RAM

The at91bootstrap can be configured for the type and size of external RAM (DDR2/DDR3) on your custom project board.

After configuration of make, run menuconfig:

​$ make menuconfig

Select Memory selection

Select RAM Configuration

Select RAM size ( )

RAM size ( ) selection


ESC-ESC back to the RAM Configuration menu

Select DDR-SDRAM device type ( )

DDR-SDRAM device type ( ) selection


ESC-ESC back to the RAM Configuration menu.

Warning

Alert!

DO NOT modify the Extern Memory Bank Base Address and Size.


ESC-ESC back to the top menu

ESC-ESC to exit and Save your configuration

Build at91bootstrap

The results of the build will be available in the ~/at91bootstrap/binaries directory.

Back to Top

Changing Display Banner

The at91bootstrap displays a banner on the target console when it begins running. For example, the default banner is shown below:

Default Banner

You can modify the banner to your requirements by following the steps below:

After configuration of make, run menuconfig:

​$ make menuconfig

Select Hardware Initialization Options

Observe that [*] Display Banner has been enabled

Select string value below [*] Display Banner

Hardware Installation Options dialog
Banner dialog


Enter your desired string

ESC-ESC back to the top menu

ESC-ESC to exit and Save your configuration

Build at91bootstrap

The results of the build will be available in the /at91bootstrap/binaries directory.

The at91bootstrap will now display the string you entered:
at91bootstrap new banner display

Back to Top

Booting from a different SD Memory Card Slot

Each of the Microchip 32-bit Microprocessor Units (MPU) contain two Secure Digital MultiMedia Card Controllers (SDMMC). Most of the evaluation kits also contain two SD Memory Card slots (often two different size jacks).

You can configure at91bootstrap to boot from either SD Memory Card slot. We show you how in the steps below:

After configuration of make, run menuconfig:

​$ make menuconfig

Select Memory Selection

Select SD Card Configuration

Select SD Host Controller Select ( )

From this page you can select the SD Memory Card slot for your requirements.
SD Host Controller Select dialog

Back to Top


Summary

In this training, you learned how to make changes to the default configuration and customize at91bootstrap for your project:

  • Loading a Bare Metal Program, RTOS, BusyBox, etc.
  • Building at91bootstrap for use with MPLAB X IDE
  • Modifying Clock Source
  • Customize External RAM
  • Changing Display Banner
  • Booting from a different SD Memory Card slot

Learn More

Back to Top