SAM9X60-EK – Configure and Build at91bootstrap to Load an MPLAB® Harmony 3 Application from NOR Flash (QSPI) Memory

Introduction

This training topic describes how to download, configure, and build at91bootstrap to load an MPLAB® Harmony 3 Software Framework application binary image (harmony.bin) from NOR Flash (QSPI) Memory to DDR2 SDRAM on the SAM9X60-EK Evaluation Kit using the MPLAB X Integrated Development Environment (IDE).

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

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


Prerequisites

The following are prerequisites for this training:

This training topic was developed with MPLAB X IDE v6.05 and XC32 v4.21.


Before You Begin

Before you begin configuring at91bootstrap, you will need some information from the production build of the MPLAB Harmony 3 application. In this example, we use harmony.bin as our application image from the "SAM9X60-EK – Getting Started with MPLAB Harmony 3 Development: CSP Application: rtt_periodic_timeout" training page.

  1. NOR 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 steps below.


NOR Flash Memory

The SAM9X60-EK has a 64 Mbit Serial Quad I/O™ (SQI™) Flash memory (U8) (Microchip Technology SST26VF064B) that can be used for booting the system.

The at91bootstrap (boot.bin) binary will be written to location 0x0 to 0x0003FFFF. The harmony.bin binary will be written to location 0x00040000 to 0x000FFFFF.

sam9x60_ek_df_harmony_memory_map.png

Download at91bootstrap

1

Create a Project Directory.

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

2

Download or clone at91bootstrap version 4.

Download or clone from the Linux4sam GitHub repository.

This training topic was developed with at91bootstrap version 4.0.5.


Open Project at91bootstrap

1

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

2

Find and select the at91bootstrap project directory.

ide_at91_open_proj.png

3

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

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.

ide_at91bootstrap_configuration_error.png

Configure at91bootstrap Project Properties

1

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 DFP. Highlight the latest DFP and click on the Apply button. This will update the configuration to the latest DFP.

ide_at91_proj_properties_resolve.png

The DFP contains device-specific support software. The 32-bit MCU and MPU DFPs are maintained by Microchip Technology and are available on GitHub.

2

Configure the XC32 Compiler

In the Categories pane, select Makefile.

a

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

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

b

Enter the following text in the Clean command box:

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

Type the version number of the XC32 compiler on your host computer. In this step, we are using version 4.21.

The installation location of the 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.

ide_at91_sam9x60_curiosity_proj_xc32.png

c

Click on the Apply button.

3

Configure at91bootstrap to load harmony.bin from NOR Flash (QSPI) Memory.

a

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

b

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

ide_at91_kconfig_load_sam9x60ekdf_qspi.png

4

Make the following changes:

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

a

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

ide_at91_kconfig_nor_qspi.png

b

Expand Demo Application Image Storage Setup.

c

Observe Flash Offset for Demo-App.

This is the NOR Flash (QSPI) 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 NOR Flash (QSPI) memory.

Observe the value: 0x200000. This value is set in the default configuration.

Take note of this value as you will use it when writing the application binary (harmony.bin) to NOR Flash (QSPI) memory using the SAM-BA host applet qspiflash (see the "What’s Next?" section below).

d

Observe Demo-App Image Size.

This is the image size of the application binary image (here called Demo-App) to be copied from NOR Flash (QSPI) to SDRAM memory by at91bootstrap.
Observe the value: 0x00400000. This value is set in the default configuration.

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

e

Enter the address to load the application "0x23f00000" 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 rtt_periodic_timeout application.

ide_rtt_ddram_linker_production.png

f

Click on the Apply and OK buttons.

This completes the configuration of the at91bootstrap project properties.


Build at91bootstrap

1

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.

2

Observe the build is successful.

ide_at91_sam9x60_curiosity_build_successful.png

3

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 now be written to NOR Flash (QSPI) memory using the SAM-BA host applet qspiflash. Instructions on how to do this are listed in the "What’s Next?" section below.


Summary

The at91bootstrap has been configured and built to load an MPLAB Harmony 3 Software Framework application from NOR Flash (QSPI) memory on the SAM9X60-EK.


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.