riotboot/flashwrite: use flashpage_raw when available#11683
Closed
fjmolinas wants to merge 3 commits intoRIOT-OS:masterfrom
Closed
riotboot/flashwrite: use flashpage_raw when available#11683fjmolinas wants to merge 3 commits intoRIOT-OS:masterfrom
fjmolinas wants to merge 3 commits intoRIOT-OS:masterfrom
Conversation
- If supported when finishing flashwrite, i.e. writing RIOT magic number, if FLASHPAGE_RAW is supported it will be used insetad of FLASHPAGE to avoid copying and erasing the page. - This also allows it work for sectors based flash, e.g. stm32f4
aabdf42 to
b2a7e74
Compare
kaspar030
requested changes
Jun 12, 2019
Contributor
kaspar030
left a comment
There was a problem hiding this comment.
Code looks fine. Will try to test tomorrow.
(Some of the alignment changes were a little off, fixing from too little spaces to too many.)
| @@ -0,0 +1,151 @@ | |||
| /* | |||
kaspar030
requested changes
Jun 12, 2019
Contributor
kaspar030
left a comment
There was a problem hiding this comment.
Hm, shouldn't flashpage_raw allow to not allocate a whole flash page as buffer?
The idea would be to erase a page on first write, but then write in FLASHPAGE_RAW_BLOCKSIZE sized chunks.
Contributor
Author
|
Closed in favor of #11705 |
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.
Contribution description
The following PR allows using
flashpage_write_raw()to finish an update process. The main objective of this is to support OTA onstm32f4/2/7. Since the flash is sector based if at the finish we are to perform an erase operation the whole sector would be erased (sectors that go from 16KB to 256KB). The idea is that since we only need to write 4 bytes ifflashpage_write_raw()is available erasing the sector again can be avoided since it was already erased at the start of theflashwriteprocess. So as long as the first 4 bytes are kept in an erased state '0xFF'flashpage_write_raw()can be used.Testing procedure
for nucleo-l073rz:
make -C tests/riotboot_flashwrite/ BOARD= nucleo-l073rz riotboot/flash termmake -C tests/riotboot_flashwrite/ BOARD= nucleo-l073rzriotbootcoap-client -m post coap://[fe80::2%tap0]/flashwrite -f tests/riotboot_flashwrite/bin/ nucleo-l073rz/tests_riotboot_flashwrite-slot1.riot.bin -b 64for samr21-xpro:
make -C tests/riotboot_flashwrite/ BOARD= samr21-xpro riotboot/flash termmake -C tests/riotboot_flashwrite/ BOARD= samr21-xpro rzriotbootcoap-client -m post coap://[fe80::2%tap0]/flashwrite -f tests/riotboot_flashwrite/bin/ samr21-xpro/tests_riotboot_flashwrite-slot1.riot.bin -b 64When the update finished reboot the node manually it should have started from a different slot.
nucleo-f446remake -C tests/riotboot_flashwrite/ BOARD=nucleo-f446re riotboot/flash termmake -C tests/riotboot_flashwrite/ BOARD=nucleo-f446re riotbootcoap-client -m post coap://[fe80::2%tap0]/flashwrite -f tests/riotboot_flashwrite/bin/ nucleo-f446retests_riotboot_flashwrite-slot1.riot.bin -b 64Issues/PRs references
Related to #11682 and #1168