Repository navigation
Implement fast write + ring buffer - #7
Merged
Merged
Conversation
constructors to clearify intentions.
ERASE_SIZE and WRITE_SIZE in flash trait.
Collaborator
Author
|
Merged. Everything passes, other than the system-flash example overflowing, which is expected. |
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.
This PR implement user flash fast write + ring buffer in place of standard writes.
Why
We need to use fast write for user flash for two reasons:
Behavior
PAGE_SIZE *2(128 bytes for V003) ring buffer is used to buffer protocol payload. This allows a full flash page to fit in the buffer while still have room for at least one protocol payload being buffered. Thus, protocol payload must not be larger than a single flash page size.WRITEcommand operation, the bootloader will buffer the payload, check if the buffer has enough data for a full page write, and automatically flush the whole page if buffer contains at least a full page size.FLUSHcommand is added so that the CLI can manually flush the buffer. There are two use cases:The bootloader remains mostly stateless and simple so it can fit in 1920 bytes of system flash storage.
Note
This implementation overflows the system flash (1920 bytes) by about 142 bytes. So the system flash CI build will fail and is expected. Another PR will be filed to optimize flash size. The purpose of this PR is get the fast write implementation behave correctly.