1.3.2.2 SPI Bootloader Firmware Update mode execution flow
The SPI bootloader registers a callback with the underlying SPI peripheral library to get notified whenever a packet is received from the host. Once a packet is received, the callback is called and the bootloader reads the received packet into bootloader's internal buffer. Once a packet is received, it calls a routine to parse the received packet. While the bootloader is busy parsing and processing the packet, the BUSY GPIO line remains asserted to the "Busy" state. The host is expected to poll the status of the BUSY line before sending further commands to the bootloader. Once the packet is received, the bootloader sets the BUSY flag in the status byte and also sets appropriate flags for the Flash Programming Task to execute the command (Erase/Program/Verify).
Flash Programming Task Flow
This task is responsible for executing the Erase/Program and Verify commands
This task is non-blocking. It submits a Erase/Program request and then checks the status of flash operation whenever it gets a chance to run
Once the flash operation is complete, it clears the BUSY flag and sets appropriate error flags (if any) in the status byte. The BUSY line is de-asserted to "Not Busy" state, thereby indicating the host that the bootloader is ready to accept new commands from the host.