2.4.5 Configure at91bootstrap to Load a Custom Bare-Metal Application from NAND Flash Memory

In this section, we will customize at91bootstrap to load and execute a custom bare-metal application directly from NAND Flash memory instead of U-Boot. By default, at91bootstrap is configured to load U-Boot as the second-stage bootloader, but in this scenario, we will modify the sam9x60_curiositynf_uboot_defconfig to load the bare-metal application, i.e., Harmony3. This requires adjustments to the next software type and image storage setup to ensure that at91bootstrap correctly loads the Harmony3 bare-metal application stored in NAND Flash memory.

To configure at91bootstrap to load a Harmony3 bare-metal application from NAND Flash memory into external volatile memory (DDRAM), proceed as follows:

  1. Go to Project→ Properties→ Kconfig→ Load→ Harmony3→ at91bootstrap→ configs→ sam9x60_curiositynf_uboot_defconfig→ Open.
  2. Perform the following changes:
    • Next Software Type: Load 4 MB into the start of DDRAM (see Figure 2-6).
    • Demo Application Image Storage Setup:
      1. Flash Offset for Demo-App: NAND Flash offset where the bare-metal application is programmed. In this example, an offset of 0x40000 is chosen.
      2. Demo-App Image Size: Size of the image that at91bootstrap will copy from NAND to DDRAM. In this example, a demo app image size of 0xc0000 is chosen. This is taken as a safety value. It is not necessary to enter the exact application size, but rather a larger value to accommodate the different application sizes during development.
      3. External RAM Address to Load Demo-App Image: This should match the entry point address for the bare-metal application. This can also be verified by looking at the code section memory placement in the application linker file.
  3. Click Apply, then OK.

This completes the at91bootstrap configuration for loading a bare-metal application from NAND Flash memory.

Figure 2-5. Load at91bootstrap NAND Flash Boot Configuration

An example configuration for the SAM9X60-Curiosity board is shown below.

Figure 2-6. Next Software Type Configuration
Note: at91bootstrap requires Python 3.x.y (python3) for the scripts that generate the Programmable Multibit Error Correcting Code (PMECC) headers for NAND Flash memories.