[riot-notifications] [RIOT-OS/RIOT] Feat/add flashwrite APIs (#15511)
benpicco
notifications at github.com
Thu Nov 26 21:49:01 CET 2020
@benpicco commented on this pull request.
> @@ -150,6 +151,34 @@ int riotboot_flashwrite_putbytes(riotboot_flashwrite_t *state,
return 0;
}
+int riotboot_flashwrite_invalidate(int slot)
+{
+ extern const unsigned riotboot_slot_numof;
+
+ if (riotboot_slot_numof == 1){
+ LOG_WARNING(LOG_PREFIX "Only one slot configured\n");
+ return -1;
+ }
+ if ((riotboot_slot_validate(riotboot_slot_other()) != 0) || (riotboot_slot_validate(riotboot_slot_current()) != 0)){
+ LOG_INFO(LOG_PREFIX "There will be no valid images to run after reboot\n");
+ return -2;
+ }
+
+ uint8_t data_flash[4] = { INVALIDATE_HDR };
This will only set the first element to `INVALIDATE_HDR` and the others to `0`.
Granted, the signature will be invalidated if even a single character is changed, but what you were trying to achieve can be done with
```suggestion
uint8_t data_flash[RIOTBOOT_MAGIC];
memset(data_flash, INVALIDATE_HDR, sizeof(RIOTBOOT_MAGIC));
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15511#pullrequestreview-539544850
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201126/f7c329dd/attachment.htm>
More information about the notifications
mailing list