1.1.7.3 Using at91boostrap loader with Harmony3 MPU Bootloader

MPU harmony3 bootloaders are compiled and linked to execute from external DRAM memory that is available on the corresponding evaluation kit. This require all peripherals and clock leading to the DRAM memory to be configured prior to the application being programmed into DRAM. This is achieved using a bootstrap loader. We use AT91bootstrap loader for this purpose.

We have deployed the following pre-built bootstrap binaries inside our bootloader application repositories. They can be found under deps folder at the root of the repository.

Binary NameDescription
at91bootstrap.elfBootstrap which allows debug or run application using MPLABx
boot.binBootstrap which allows booting application using an SD/eMMC/NAND/Serial Flash media

Configure a debug tool

  • Open the MPLABx applicaton that you want to debug or run in MPLABx.

  • Right click on the application project and select properties. This will open the properties window. In the configuration option --> connected hardware tools, select the debugger.

    mpu_select_debugger

    Note: if no debugger is connected, click on the "show all" check box and select the supported debugger

  • Select the target toolchain and click on apply to save the changes

  • This will result in an additional menu option to be available in the configuration tree view called "bootstrap" as shown below:

    mpu_show_bootstrap

Configure bootstrap

  • Click on "Use bootstrap" check box to enable bootstrap support

  • Click on the "LOAD" button to load the bootstrap file. This will open a file picker, which allows you to choose the bootstrap binary file.

  • Navigate to the /deps/at91bootstrap_binaries_/ folder as explained in the previous section. You should choose "at91bootstrap.elf" file (The "Bootstrap entry address" and the "Bootstrap load address" text box can be left empty as this information will be read from the ELF file automatically)

    mpu_configured_bootstrap

Run/Debug MPU bootloader using MPLABx

You can now Run/Debug the MPU bootloader just like any other MPLABx applications. When executed, MPLABx performs a two stage loading:

Stage 1: Loads the bootstrap loader into the internal SRAM and executes it. This will configure the board specific peripherals and memory

Stage 2: Loads the Harmony 3 bootloader into the external DRAM and debugs it. User can perform actions like setting breakpoints, single-stepping etc.

When using MPLABx to debug a Harmony 3 bootloader, you will face the following limitations:

  • Call stack is not fully supported yet, hence stepping in and out of functions may not work correctly.