SAMA7G54-EK – Configure and Build at91bootstrap to Load an MPLAB® Harmony v3 Application from e.MMC Flash Memory

Last modified by Microchip on 2023/11/21 22:17

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 Embedded MultiMediaCard (e.MMC) Flash Memory to DDR3L SDRAM on the SAMA7G54-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 e.MMC Flash 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

​This training topic was developed with MPLAB X IDE v6.15 and XC32 v4.30.

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 image from the "SAMA7G54-EK – Getting Started with MPLAB® Harmony 3 Development: CSP Application: pio_led_on_off_interrupt" training topic.

  1. e.MMCFlash Memory offset value to read harmony.bin
  2. The harmony.bin image size
  3. The DDR3L SDRAM address to load harmony.bin

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

Back to Top

Embedded MultiMediaCard (e.MMC) Flash Memory

The SAM9XA7G54-EK has a 4 GB e.MMC managed NAND Flash memory (U10) (SkyHigh Memory S40FC004C1B1C00000). It is connected to the Secure Digital Multimedia Controller port 0 (SDMMC0) of the SAMA7G54

Back to Top

Download at91bootstrap

Create a Project Directory

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


Download or clone at91bootstrap version 4 

Download or clone from the Linux4sam GitHub repository.

This training topic was developed with at91bootstrap version 4.0.6 

Back to Top

Open Project at91bootstrap

From MPLAB X IDE, select File > Open Project…

An Open Project dialog is displayed.


Find and select the at91bootstrap project directory.

Click on the Open Project button.  

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

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: Conf default

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


Ensure the Device selected is the SAMA7G54.

Configure the 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.30/bin/bin/pic32c-" 

Enter the following text in the Clean command box: 

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

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

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. 

Project Properties: makefile

Click on the Apply button.

Configure at91bootstrap to load harmony.bin from e.MMC Flash Memory
In the Categories pane, select Kconfig and click on the Load button. 

Find the at91bootstrap project directory and select configs directory and then select sama7g5ekemmc_uboot_defconfig and click on the Open button. 

Project Properties: kconfig


Make the following changes: 

In this step, you are taking an existing default configuration and altering it to load the MPLAB Harmony v3 application (harmony.bin) from e.MMC 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.

Project Properties: Next Software Type

Expand Demo Application Image Storage Setup
Set Next Software Image File Name to harmony.bin

Observe the address to load the application 0x66f00000 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 in the accompanying image for the pio_led_on_off_interrupt application. 

Linker for Production: ddram

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. 

Observe the build is successful

Build Successful


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 e.MMC Flash Memory using the SAM-BA Host Applet sdmmc.

Back to Top

Summary

The at91bootstrap has been configured and built to load an MPLAB Harmony v3 Software Framework application from e.MMC Flash Memory on the SAMA7G54-EK. 

Back to Top