Jump to main content

##

# 1.2 I2C Fail Safe Bootloader

This example application shows how to use the Bootloader Library to bootload an application on device having dual flash bank feature using I2C protocol

Bootloader Application

- This is a fail safe bootloader application which resides from starting location of both the banks of device flash memory region for SAM devices with dual bank support
- It uses I2C peripheral library in non-interrupt mode
- Trigger Methods
  - It uses the On board Switch as bootloader trigger pin to force enter the bootloader at reset of device
  - It checks for bootloader request pattern (0x5048434D) from the starting 16 Bytes of RAM to force enter bootloader at reset of device

NVM Host Application

- This is a embedded I2C host application which sends the application image stored in it's internal flash (NVM) to the inactive bank of the target board over the I2C bus

- The user application binary must be converted to a header file containing the application image in HEX format in a C style array. A btl_bin_to_c_array.py utility is provided to do this conversion

- To program the bootloader to the inactive flash bank, the user application binary may be combined with the bootloader using the btl_app_merge_bin.py utility. The combined binary file must be converted to a header file using the btl_bin_to_c_array.py utility

- Add the generated image header file of the application or bootloader and application combined to the NVM host application project. Rebuild and program the NVM host application. This results in the application image being copied in the host MCU's flash (NVM)

Test Application

- This is a test application which resides from end of bootloader size in device flash memory
- It will be loaded into flash memory by bootloader application
- It blinks an LED and provides console output
- It uses the On board Switch to trigger the bootloader from firmware
  - Once the switch is pressed it loads first 16 bytes of RAM with bootloader request pattern (0x5048434D) and resets the device

Development Kits The following table provides links to documentation on how to build and run I2C Fail Safe bootloader on different development kits