4.1 Running the Bootloader Application

Follow these steps to run the bootloader application:

  1. Connect a micro USB cable to the DEBUG port of the SAM E54 Xplained Pro board.
  2. Build and program the UART fail safe bootloader (dual-bank bootloader) using the MPLAB X IDE.
  3. Launch the MCC for the UART fail safe bootloader application:
    1. Disable the Fuse Settings as shown in the Test Application Configurations section.
    2. Regenerate the code.
    3. Enable and execute this line after build option in the MPLAB X IDE Project Properties as shown in the Test Application Configurations section Figure 3-5.
  4. Build the bootloader application (uart_fail_safe_bootloader_sam_e54_xpro) again using the MPLAB X IDE.
    • This is required to generate the binary file for the bootloader application.
  5. Build the Test application (uart_fail_safe_bootloader_test_app_sam_e54_xpro) using the MPLAB X IDE but do not program.
  6. Run btl_app_merge_bin.py from the command prompt to merge the generated bootloader binary and the application binary. The following output must be displayed on the command prompt.
    Command: python <python script> -o <Offset> -b bootloader image -a application image 
    
    <Offset>: Application start address (E.g. - 0x00002000)
    <python script>: btl_app_merge_bin.py
    
    Example: python <harmony3_path>\bootloader\tools\btl_app_merge_bin.py -o 0x00002000 -b 
    <harmony3_path>\bootloader\apps\uart_fail_safe_bootloader\bootloader\firmware\sam_e54_xpro.X\dist\sam_e54_xpro\production
    \sam_e54_xpro.X.production.bin -a 
    <harmony3_path>\bootloader\apps\uart_fail_safe_bootloader\test_app\firmware\sam_e54_xpro.X\dist\sam_e54_xpro\production
    \sam_e54_xpro.X.production.bin
    Figure 4-1. Bootloader and Application Binary Merger Output
    Note: Running the help command provides a brief overview of options available as shown below.
    
    Command: python <python script> --help 
    
    <python script>: btl_app_merge_bin.py
    
    Example: python <harmony3_path>\bootloader\tools\btl_app_merge_bin.py --help
    Figure 4-2. Application Binary Merge Help Window
  7. Run btl_host.py from the command prompt to program the merged binary to the opposite panel. The merged binary btl_app_merged.bin will be generated in the path from where btl_app_merge_bin.py was executed.
    Command: python <python script> -v -s -i <COM PORT> -d <Device Name> -a <Address> -f  <bootloader_application_merged_image>
    
    <python script>: btl_host.py
    <COM PORT>: Serial communication port
    <Device Name>: SAME54
    <Address>: Application start address (Bank A: 0x00002000 / Bank B: 0x00080000)
    
    Example: python <harmony3_path>\bootloader\tools\btl_host.py -v -s -i COM18 -d same5x -a 0x00080000 -f btl_app_merged.bin
    Note: Running the help command provides a brief overview of options available as shown below.
    
    Command: python <python script> --help
     
    <python script>: btl_host.py
    
    Command: python <harmony3_path>\bootloader\tools\btl_host.py --help
    Figure 4-3. Application Bootloader Host Help Window
  8. The following figure shows the example output of the firmware programming.
    Figure 4-4. Firmware Upgrade Output
Note:
  1. After the successful programming of the application, Bank B is mapped to the 0x00000000 address, and Bank A is mapped to the 0x00080000 address.
  2. The starting address for the firmware always remains the same, due to the banks being swapped after each firmware upgrade.