SAMA5D29-Curiosity – Configure and Build at91bootstrap to Load an MPLAB® Harmony v3 Application from SQI™ Flash Memory

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

Introduction

This training topic describes how to download, configure, and build at91bootstrap to load an MPLAB® Harmony v3 Software Framework application binary image (harmony.bin) from Serial Quad I/O™ (SQI™) Flash Memory to DDR2 SDRAM on the SAMA5D29-Curiosity Development Board using the MPLAB X Integrated Development Environment (IDE).  

Once at91bootstrap has been built, the resulting binary image (boot.bin) can be written to SQI Flash Memory using the SAM-BA® In-System Programmer (ISP).  

AT91bootstrap is a second-stage bootloader for Arm®-based Microchip Technology microprocessors (MPU). For more information see the "at91bootstrap: A Second Stage Bootloader for Microchip MPUs" page.

Prerequisites

  • MPLAB X IDE installed on the host computer 
  • MPLAB XC32 Compiler installed on the host computer 

 This training topic was developed with MPLAB X IDE v6.20 and MPLAB XC32 Compiler v4.35.

Before you Begin

Before you begin configuring at91bootstrap, you will need some information from the production build of the MPLAB Harmony v3 application. In this example, we use harmony.bin as our application from the "SAMA5D29-Curiosity – Getting Started with MPLAB Harmony v3 Development: CSP Application: pio_led_on_off_interrupt" training.

  1. SQI Flash Memory offset value to read harmony.bin
  2. The harmony.bin image size
  3. The DDR2 SDRAM address to load harmony.bin 

These values will be used to configure at91bootstrap in the following steps. 

64 Mb Serial Quad I/O™ (SQI™) Flash Memory with EUI-48 and EUI-64

The SAMA5D29-Curiosity has a 64 Mb SQI Flash Memory with EUI-48 and EUI-64 memory (U9) (Microchip SST26VF064BEUI). It is connected to the Quad SPI Interface 1 (QSPI1) peripheral of the SAMA5D29. 

An EUI-48 MAC address for the 10BaseT/100Base-TX Ethernet Reduced Media-Independent Interface (RMII) has been programmed into the SQI Flash Memory. 

Download at91bootstrap

Create a Project Directory. 

For the purposes of this training topic, we’ll name our project directory at91bootstrap. 

Back to Top


Download or clone at91bootstrap version 4.

Download or clone from the Linux4sam GitHub repository

This training was developed with at91bootstrap version 4.0.7.

Back to Top

Open Project at91bootstrap

From MPLAB X IDE, select File > Open Project… An Open Project dialog is displayed.

Back to Top


Find and select the at91bootstrap project directory. 

Back to Top


Click on the Open Project button.  

The at91bootstrap project will be displayed in the Projects pane (upper left) and in the at91bootstrap – Dashboard pane (bottom left). 

IDE Open Project

You may receive a Configuration Loading Error. This is due to an older version of the Device Family Pack (DFP) at the time of creating the at91bootstrap project. You will update the DFP to the latest version in the next steps. 

Back to Top

Configure at91bootstrap Project Properties

Open at91bootstrap Project Properties.

Open the at91bootstrap Project Properties using one of the following methods: 

  1. In the Projects pane, highlight at91bootstrap and click on the wrench icon in the at91bootstrap - Dashboard
  2. In the Projects pane, right-click on at91bootstrap and select Properties from the menu. 

The Projects Properties – at91bootstrap dialog box opens. 

If you received a Configuration Loading Error in the previous step, you may see a [Resolve] link next to a version of the Device Family Pack (DFP). Highlight the latest DFP and click on the Apply button. This will update the configuration to the latest DFP.  

Project Properties

Back to Top


In the Device drop-down box, select ATSAMA5D29 and click on the Apply button.

Back to Top


Configure the MPLAB XC32 Compiler.

In the Categories pane, select Makefile

Enter the following text in the Build command and Debug build command boxes: 

make CROSS_COMPILE="C:/Program Files/Microchip/xc32/v4.35/bin/bin/pic32c-" 

Enter the following text in the Clean command box: 

make mplabclean CROSS_COMPILE="C:/Program Files/Microchip/xc32/v4.35/bin/bin/pic32c-" 

Type the version number of the MPLAB XC32 Compiler on your host computer. In this step, we are using version 4.35. 

The installation location of the MPLAB XC Compiler versions can be found by selecting from the MPLAB X IDE toolbar: Tools > Options. An Options dialog box will open. Select Embedded from the toolbar and select the Build Tools tab. 

When cutting and pasting, beware of hidden formatting characters. 

Screen capture of Project Properties: Makefile

Click on the Apply button.

Back to Top


Configure at91bootstrap to load harmony.bin from SQI Flash Memory. 

In the Categories pane, select Kconfig and click on the Load button. 

Find the at91boostrap project directory and select configs directory and then select sama5d29_curiositydf_qspi_uboot_defconfig and click on the Open button. 

Screen capture of Project Properties: Kconfig load default configuration

Back to Top


Make the following changes: 

In this step, you are taking an existing default configuration and altering it to load the MPLAB Harmony v3 Software Framework application (harmony.bin) from SQI Flash Memory. This makes configuration a little bit easier than starting from scratch. 

Expand Next Software Type and select the Load 4 MB into start of SDRAM radio button. 

Kconfig load settings

Expand Demo Application Image Storage Setup.

Kconfig SQI settings

Observe Flash Offset for Demo-App is set to 0x00040000.

This is the SQI Flash Memory offset value to the application binary (here called Demo-App). This value is planned by the developer as part of the memory map of the SQI Flash Memory.  

Take note of this value as you will use it when writing the application binary (harmony.bin) to SQI Flash Memory using the SAM-BA Host Applet qspiflash (see What’s Next? section below) 

Observe Demo-App Image Size is set to 0x00100000. 

This is the image size of the application binary image (here called Demo-App) to be copied from SQI Flash Memory to SDRAM memory by at91bootstrap.  

It is important that the Demo-App Image Size is greater than the application binary size. In this example, harmony.bin is approximately 3KB. Much smaller than the value set in the default configuration. 

Enter the address to load the application 0x26F00000 to The External Ram Address to Load Demo-App Image.  

This value should match the .text load address in the applications linker script (ddram.ld). This value is shown below for the pio_led_on_off_interrupt application. 

IDE ddram linker

Click on the Apply and OK buttons.

This completes the configuration of the at91bootstrap project properties. 

Back to Top

Build at91bootstrap

Build at91bootstrap.

Build the at91bootstrap project using one of the following methods: 

  1. In the Projects pane, right-click on at91bootstrap and select Build from the menu.
  2. Click on the Build icon (hammer) in the tool ribbon. 

Back to Top


Observe the build is successful. 

IDE Output Window: Build Successful

Back to Top


Note the location of boot.bin

<project_directory>\at91bootstrap\build\binaries\boot.bin 

The boot.bin file is the binary image of at91bootstrap. The boot.bin image can be written to SQI Flash Memory using the SAM-BA Host Applet qspiflash. See the "Learn More" section.

Back to Top

Summary

The at91bootstrap has been configured and built to load an MPLAB Harmony v3 Software Framework application from SQI Flash Memory on the SAMA5D29-Curiosity. 

Back to Top

Learn More

Back to Top