The firmware of our OOBD cup, the tiny OBD Bluetooth adaptor can be updated in the field via its Bluetooth interface. But as it is a little bit dangerous to flash a device over a wireless unsecure connection, we need to do some protection in case the connection breaks during flashing.
We did it that way that the bootloader is able to identify if the device contains valid firmware or not. If it is valid, the bootloader starts the firmware ready to run, but if it isn't, the bootloader jumps into the flash routine and waits for correct firmware to arrive.
To archive this, the firmware is armended with a additional checksum. The tool cortex_crc32 calculates this sum and add this to the firmware binary, which then can be used for flashing.