Merged
Conversation
Disassembled the boot loader so that it can be understood. It is for reference only and not for compilation.
The bootloader stores flash settings in stride-2 format (one struct byte per 16-bit halfword), but the application was writing packed bytes (two bytes per halfword). This caused the bootloader's save/restore during OTA to corrupt all odd-indexed struct bytes, breaking the magic number check and invalidating all multi-byte fields on every firmware update. Fixes: - Flash_ProgramBuffer: write one byte per halfword (stride-2) - Flash_Load / Flash_Save verify: read back using stride-2 loop - FLASH_OTA_FLAG_OFFSET: corrected from 0x64 to 0x32 (struct byte offset, not flash byte offset; flash addr = base + offset * 2 = 0x08003C64) - reserved_ota_padding: shrunk from 56 to 6 bytes to match corrected offset - FLASH_STRUCTURE_VERSION: bumped 2 → 3 to invalidate old packed-byte records Behavior spec updated with full bootloader details and stride-2 flash format description (Section 8.1, Section 14).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Disassemble the boatload for REFERENCE ONLY.
Discovered that the settings can be persisted over OTA updates.