Jump to main content

##

# 1.9.2 OTA Bootloader execution flow

OTA Bootloader - Dual Bank

- On device reset after systme initialize, The Bootloader task starts executing from while(1) super loop

- It retrieves the Control Block (Metadata) from inactive bank

  - If any error in reading the Control Block (Metadata) it directly jumps Run application

- It checks if the Meta Data read is valid.

  - If valid

    - Checks if the blockUpdated flag is set. If set it jumps to Update Control Block (Metadata) step Or continues to Trigger Check

  - If Invalid

    - It continues to Trigger Check

Trigger Check

- If there are no conditions to enter the firmware upgrade mode, the Bootloader jumps to Run application
  - Refer to Bootloader Trigger Methods for different conditions to enter firmware upgrade mode

Update Control Block (Metadata)

- The following fields are updated in the Control Block (Metadata), then it swaps bank and then triggers reset to Run application

  - Clears the blockUpdated flag

  - Set imageType to active

  - Set status to valid

Run Application

- The application start address used to jump to application space can be

  - Application start address generated during compile time Or

  - Application start address retrieved from valid Control Block (Metadata)

- Calls SYS_DeInitialize() function to release resources used

- Jumps to application space to run the updated application

OTA Bootloader - External Memory

- On device reset after systme initialize, The Bootloader task starts executing from the SYS_Tasks()

- Once the OTA driver is ready, it retrieves the Control Block (Metadata) from serial memory

  - If any error in reading the Control Block (Metadata) it directly jumps Run application

- It checks if the Meta Data read is valid.

  - If valid

    - Checks if the blockUpdated flag is set. If set it jumps to Programming step Or continues to Trigger Check

  - If Invalid

    - It continues to Trigger Check

Trigger Check

- If there are no conditions to enter the firmware upgrade mode, the Bootloader jumps to Run application
  - Refer to Bootloader Trigger Methods for different conditions to enter firmware upgrade mode

Programming

- Starts reading the application binary from serial memory and perform erase/program operations on internal flash

- Once programming is completed, it generates CRC32 on programmed space of internal flash and verifies it against the CRC32 value stored in Meta data

- Once verification is complete it clears the blockUpdated flag in the Control Block (Metadata) and triggers reset to Run application

Run Application

- The application start address used to jump to application space can be

  - Application start address generated during compile time Or

  - Application start address retrieved from valid Control Block (Metadata)

- Calls SYS_DeInitialize() function to release resources used

- Jumps to application space to run the updated application