1.1 OTA Bootloader - Dual Bank

This example application shows how to use the OTA Bootloader Library to bootload an application on device having dual bank flash using RNBD.

OTA Bootloader and Applications Block Diagram

ota_btl_block_dual_bank_diagram

OTA Bootloader

  • This is a OTA bootloader which resides from
    • The starting location of the flash memory region for SAM devices

    • The starting location of the Boot flash memory region for PIC32M devices

      • Uses a Custom linker script btl.ld to place it in Boot flash memory

Performs Below Operation:

  1. Read the control block stored in the last sector of dual bank memory

  2. Checks if blockUpdated field is set to 1, then it will update the control block

    • SAM devices - If blockUpdated field is set to 0 then it jumps to Step 4
    • PIC32M devices - If blockUpdated field is set to 0 then map Program Flash Bank with higher serial number to the lower region and then it jumps to Step 4
  3. Set blockUpdated field to 0 and then update the control block in the dual bank flash memory. And perform the following operation.

    • SAM devices - Swap bank and trigger reset
    • PIC32M devices - Trigger reset
  4. Run OTA application as below

    • Calls the SYS_Deinitialize() function which releases the resources used. This Function is device specific and has to be implemented based on application requirement

    • Jumps to application space to run the OTA application OTA Application

  • This is a OTA application which resides from

    • The end of bootloader size in device flash memory for SAM devices

    • The start of Program Flash memory for PIC32M devices

      • Uses a Custom linker script app_mz.ld/app_mk.ld to place it in Program flash memory
  • It blinks an LED and provides console output

  • It calls the OTA_SERVICE_Tasks() function which receives the binary over OTA to be programmed into the inactive flash bank

  • Once the binary is received and programmed into the inactive flash bank, it generates a CRC32 value over programmed inactive flash bank space and verifies it against the received CRC32

  • If verification is successful then it updates the control block and trigger reset to run new application binary through OTA bootloader

Development Kits The following table provides links to documentation on how to build and run OTA bootloader and application on different development kits