Calculate SHA256 over firmware image uploaded via OTA #174
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR calculate the SHA256 checksum over the firmware stored in the flash of the MCU. The checksum is then stored
as ASCII encoded hexadecimal number within a hidden character string property
OTA_SHA256
.Note: As we don't know the length per-se we read chunks of the flash until we detect one containing only 0xFF (= flash erased). This only works for firmware updated via OTA and second stage bootloaders (SxU family) because only those erase the complete flash before performing an update.
Since the SHA256 firmware image is only required for the cloud servers to perform a version check after the OTA update this is a acceptable trade off. The bootloader is excluded from the calculation and occupies flash address range 0 to 0x2000, total flash size of 0x40000 bytes (256 kByte).
FIY @eclipse1985