SAMA7D65-Curiosity – Configure and Build at91bootstrap to Load an MPLAB® Harmony v3 Application from NAND Flash Memory
Introduction
This training describes how to download, configure, and build at91bootstrap to load an MPLAB® Harmony v3 Software Framework application binary image (harmony.bin) from NAND Flash Memory to DDR3L SDRAM on the SAMA7D65-Curiosity Kit using MPLAB X Integrated Development Environment (IDE).
Once at91bootstrap has been built, the resulting binary image (boot.bin) needs to be converted to a binary image with header. The converted binary image can be written to NAND Flash memory using the SAM-BA® In-System Programmer (ISP).
Prerequisites
- MPLAB X IDE installed on the host computer
- MPLAB XC32 Compiler installed on the host computer
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 pio_led_on_off_interrupt application.
- NAND Flash Memory offset value to read harmony.bin
- The harmony.bin image size
- The DDR3L SDRAM address to load harmony.bin
These values will be used to configure at91bootstrap in the steps below.
NAND Flash Memory
The SAMA7D65-Curiosity has a 4 Gb (512M x 8) NAND Flash memory (U8) (Macronix MX30LF4G28AD-XKI) 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.
Download at91bootstrap
Create a Project Directory.
For the purposes of this training, we’ll name our project directory "at91bootstrap".
Download or clone at91bootstrap version 4.
Download or clone from the Linux4sam GitHub repository.
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 the Open Project button.
The at91bootstrap project will be displayed in the Projects pane (upper left) and in the at91bootstrap – Dashboard pane (bottom left).
Configure at91bootstrap Project Properties
Open the at91bootstrap Project Properties using one of the following methods:
- In the Projects pane, highlight at91bootstrap and click on the wrench icon in the at91bootstrap - Dashboard.
- In the Projects pane, right-click on at91bootstrap and select Properties from the menu.
The Projects Properties – at91bootstrap dialog box opens.
Configure 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.45/bin/bin/pic32c-"
Enter the following text in the Clean command box:
make mplabclean CROSS_COMPILE="C:/Program Files/Microchip/xc32/v4.45/bin/bin/pic32c-"
Click the Apply button.
Configure at91bootstrap to load harmony.bin from NAND Flash memory.
In the Categories pane, select Kconfig and click on the Load button.
Find the at91bootstrap project directory and select configs directory, then select sama7d65_curiositynf_uboot_defconfig and click on the Open button.
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 NAND 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.
Expand Demo Application Image Storage Setup.
Observe the Flash offset for Demo-App.
This is the NAND Flash memory offset value to the application binary (called "Demo-App" here). This value is planned by the developer as part of the memory map of the NAND Flash memory.
Observe the 0x40000 value. 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 NAND Flash memory using the SAM-BA Host Applet nandflash (see the "Learn More" section below).
Observe the Demo-App image size.
This is the image size of the application binary image (called Demo-App) to be copied from NAND Flash to SDRAM memory by at91bootstrap.
Observe the 0x000D0000 value. This value is set in the default configuration.
Enter 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 application's linker script (ddr.ld). This value is shown in the accompanying image for the pio_led_on_off_interrupt application.
Click on the Apply and OK buttons.
Build at91bootstrap
Build the at91bootstrap project using one of the following methods:
- In the Projects pane, right-click on at91bootstrap and select Build from the menu.
- Click Build (hammer icon) in the tool ribbon.
Observe that the build is 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 need to be converted to binary image with header. The converted boot.bin image can now be written to NAND Flash memory using the SAM-BA Host Applet nandflash. For instructions on how to do this, see the "Learn More" section below.
Summary
The at91bootstrap has been configured and built to load an MPLAB Harmony v3 Software Framework application from NAND Flash memory on the SAMA7D65-Curiosity.