nxboot: enhance the access to flash device #3136
Draft
+2
−2
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.
Summary
619ea01 boot/nxboot/loader/flash.c: open partition with O_DIRECT flag
There is no need to use buffers in a bootloader. We expect a sequential
access, therefore we just need to erase the erase page before writing
to it for the first time, which is something FTL layer already takes
care of.
95e4b0c boot/nxboot/loader/boot.c: copy partition with blocksize large writes
The previous logic
MAX(info_from.blocksize, info_where.blocksize)
wasincorrect. The most effective access with by writing the entire
size of the block, therefore just decide the size based on the
target page size.
Impact
Nxboot now utilizes changes presented in apache/nuttx#16642. Should not have impact on current implementation as the additional flags are ignored if changes in apache/nuttx#16642 are not applied.
Testing
Tested with apache/nuttx#16642 patch applied. Nxboot successfully updates and reverts new image. All works as before, but additional buffering is skipped.