On an HS-FS device, the flash-based
UART SBL with FOTA project follows this flow:
- Boot to flash (standalone or
emulation boot).
- Initialize device (clocks, GPIOs,
peripherals, and so forth).
- Compare the current bank mode to
the bank mode in which the most recent successful firmware upgrade occurred.
- If this is the first time
the device has booted and the SBL or application was loaded through CCS
or JTAG, then the SBL bypasses this check.
- This is possible to boot
existing firmware after a bank mode change, but, this example requires a
firmware upgrade every time the bank mode changes.
- If the current bank mode is the
same as the previous bank mode, then start the timeout period to wait for a
firmware upgrade command (5 seconds). If the bank mode has changed, then the
device waits indefinitely for a firmware upgrade and does not attempt to boot to
existing firmware.
- If a firmware upgrade command is
received, then CPU1 receives the firmware and programs the upgrade over UART for
the requested CPU (CPU1 or CPU3).
- If no firmware upgrade command is
received before the timeout, then branch to the application entry point and
begin executing.
- Once the application is
executing, interrupts are configured to make sure that a firmware upgrade
command can be received and processed over UART.
- If the firmware upgrade command
is received, then the application branches to the SBL code and performs the
requested firmware upgrade. Any application ISRs in the existing application is
serviced throughout the duration of the firmware upgrade.
- Once the firmware has been
successfully programmed to the inactive flash region, the SBL programs the
inactive BANKMGMT region such that a swap is triggered on a device reset.
- For more details on bank
swaps, refer to Section 2.2.
- If successful, then CPU1 programs
the current bank mode to the first byte of the data flash. This indicates the
bank mode of the most recent successfully firmware upgrade next time the device
boots.
- After the firmware upgrade is
completed, the SBL returns control to the application if this exists.
- If successful, then a bank swap
is triggered and the new firmware executes after a device reset.
On an HS-SE device, the flash-based
UART SBL with FOTA project follows this flow:
- Boot to flash (standalone or
emulation boot)
- Initialize device (clocks, GPIOs,
peripherals, and so forth.)
- Compare
the current bank mode to the bank mode in which the most recent successful
firmware upgrade occurred.
- If this is the first time
the device has booted and the SBL or application was loaded through CCS
or JTAG, then the SBL bypasses this check
- This is possible to boot
existing firmware after a bank mode change, but for the sake of
simplicity this example requires a firmware upgrade every time the bank
mode changes.
- If the current bank mode is the
same as the previous bank mode, then start the timeout period to wait for a
firmware upgrade command. If the bank mode has changed, then the device waits
indefinitely for a firmware upgrade and does not attempt to boot to existing
firmware.
- If a firmware upgrade command is
received, then CPU1 receives the firmware and sends to the HSM in chunks. The
HSM authenticates and programs each chunk to the inactive flash.
- Once all chunks have been
programmed by the HSM, CPU1 requests the HSM to perform an integrity check on
the firmware and programs the certificate to flash.
- If no firmware upgrade command is
received before the timeout, then branch to the application entry point and
begin executing.
- Once the application is
executing, interrupts are configured to make sure that a firmware upgrade
command can be received and processed over UART.
- If firmware upgrade command is
received, then the application branches to the SBL code and performs the
requested firmware upgrade. Any application ISRs in the existing application is
serviced throughout the duration of the firmware upgrade.
- Once the firmware has been
successfully programmed to the inactive flash region, the SBL programs the
inactive BANKMGMT region such that a swap is triggered on a device reset.
- If successful, then CPU1 programs
the current bank mode to the first byte of the data flash. This indicates the
bank mode of the most recent successfully firmware upgrade next time the device
boots.
- After the firmware upgrade is
completed, the new firmware executes after a device reset.
Note:
The general process of a FOTA
upgrade is similar between HS-FS and HS-SE devices, but the key difference is
the integration of the HSM. The HSM is responsible for authenticating existing
and incoming flash image, programming the authenticated incoming image, and
performing an integrity check of the incoming image. On an HS-FS device, these
steps are not required. CPU1 is responsible for receiving the incoming image and
programming to flash without any authentication or integrity checks.