at91bootstrap: Customizing a Default Configuration

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


at91bootstrap: Customize a Default Configuration

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 Program, RTOS, BusyBox, etc.

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

1

Configure at91bootstrap with the chosen defconfig file:

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

2

Start menuconfig:

$ make menuconfig

3

Select Image Loading Strategy ( ) --->.

4

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

at91bootstrap_image_loading_strategy.png

5

ESC-ESC back to the top-level menu.

6

Select Demo Application Image Storage Setup --->.

To know what value to enter, refer to the linker file or MAP file:

at91bootstrap_demo_app_storage.png

7

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

8

ESC-ESC back to the top-level menu.

9

Select ( ) Image Name.

10

Enter the name of the image to be loaded:

at91bootstrap_image_name.png

11

ESC-ESC back to the top-level menu.

12

ESC-ESC to exit menuconfig and save your configuration.

13

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 a SD Memory Card.

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

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

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

sd_card_format.png

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:

at91bootstrap_console_getting_started.png

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.

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.

1

After configuration of make, run menuconfig:

$ make menuconfig

2

Select Image Loading Strategy ( ) --->.

3

Select (X) Do not Load any image after bootstrap run.

at91bootstrap_image_loading_strategy_no_load.png

4

ESC-ESC back to the top menu.

5

Select [*] Build image for use with debuggers.

at91bootstrap_config_debugger.png

6

ESC-ESC to exit and Save your configuration.

7

Build at91bootstrap.

$ make

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


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

MPU’s 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:

1

After configuration of make, run menuconfig:

$ make menuconfig

2

Select Main Crystal configuration --->.

3

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

4

ESC-ESC back to the top menu.

5

ESC-ESC to exit and Save your configuration.

6

Build at91bootstrap.

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

Refer to the target device data sheet 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.

1

After configuration of make, run menuconfig:

$ make menuconfig

2

Select Memory selection --->.

3

Select RAM Configuration --->.

4

Select RAM size ( ) --->.

From this configuration page you can select the size of the RAM on your custom project board.

at91bootstrap_ram_config.png

5

ESC-ESC back to the RAM Configuration menu.

6

Select DDR-SDRAM device type ( ) --->.

at91bootstrap_sdram_config.png

7

ESC-ESC back to the RAM Configuration menu.

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

8

ESC-ESC back to the top menu.

9

ESC-ESC to exit and Save your configuration.

10

Build at91bootstrap.

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


Changing Display Banner

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

at91bootstrap_display_banner.png

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

1

After configuration of make, run menuconfig:

$ make menuconfig

2

Select Hardware Initialization Options --->.

3

Observe that [*] Display Banner has been enabled.

4

Select string value below [*] Display Banner.

at91bootstrap_hw_init_banner.png
at91bootstrap_new_banner.png

5

Enter your desired string.

6

ESC-ESC back to the top menu.

7

ESC-ESC to exit and Save your configuration.

8

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

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:

1

After configuration of make, run menuconfig:

$ make menuconfig

2

Select Memory Selection --->.

3

Select SD Card Configuration.

4

Select SD Host Controller Select ( ) --->.

From this page you can select the SD Memory Card slot for your requirements.

at91bootstrap_sd_host_select.png

Summary

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


What's Next?

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.