-
Notifications
You must be signed in to change notification settings - Fork 544
Use ACL to protect MBR and Bootloader against accidental FLASH overwrites by the user application #384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Use ACL to protect MBR and Bootloader against accidental FLASH overwrites by the user application #384
Changes from 3 commits
1307fe7
c61f330
3714bb7
8c45bf8
48cfda2
c2ae418
2d889d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,10 +11,11 @@ | |||||||||||||||
| */ | ||||||||||||||||
|
|
||||||||||||||||
| #include "bootloader_util.h" | ||||||||||||||||
| #include "dfu_types.h" | ||||||||||||||||
| #include <stdint.h> | ||||||||||||||||
| #include <stdbool.h> | ||||||||||||||||
| #include <string.h> | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| /** | ||||||||||||||||
| * @brief Function for aborting current application/bootloader jump to to other app/bootloader. | ||||||||||||||||
| * | ||||||||||||||||
|
|
@@ -164,8 +165,94 @@ static inline void bootloader_util_reset(uint32_t start_addr) | |||||||||||||||
| #error Compiler not supported. | ||||||||||||||||
| #endif | ||||||||||||||||
|
|
||||||||||||||||
| #ifndef SKIP_FLASH_PROT | ||||||||||||||||
| uint32_t bootloader_util_flash_protect(uint32_t address, uint32_t size, bool read_protect) | ||||||||||||||||
| { | ||||||||||||||||
| if ((size & (CODE_PAGE_SIZE - 1)) || (address > BOOTLOADER_SETTINGS_ADDRESS)) | ||||||||||||||||
|
||||||||||||||||
| if ((size & (CODE_PAGE_SIZE - 1)) || (address > BOOTLOADER_SETTINGS_ADDRESS)) | |
| uint32_t end_addr = address + size; | |
| if ((size == 0) || | |
| (size & (CODE_PAGE_SIZE - 1)) || | |
| (end_addr < address) || | |
| (address > BOOTLOADER_SETTINGS_ADDRESS)) |
Uh oh!
There was an error while loading. Please reload this page.