don't let openblt erase itself #6290
This commit is contained in:
parent
b0154825a6
commit
9401aecd0c
|
@ -19,12 +19,22 @@ blt_addr FlashGetUserProgBaseAddress() {
|
|||
}
|
||||
|
||||
blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data) {
|
||||
// don't allow overwriting the bootloader
|
||||
if (addr < FlashGetUserProgBaseAddress()) {
|
||||
return BLT_FALSE;
|
||||
}
|
||||
|
||||
return (FLASH_RETURN_SUCCESS == intFlashWrite(addr, (const char*)data, len)) ? BLT_TRUE : BLT_FALSE;
|
||||
|
||||
return BLT_TRUE;
|
||||
}
|
||||
|
||||
blt_bool FlashErase(blt_addr addr, blt_int32u len) {
|
||||
// don't allow erasing the bootloader
|
||||
if (addr < FlashGetUserProgBaseAddress()) {
|
||||
return BLT_FALSE;
|
||||
}
|
||||
|
||||
if (!intFlashIsErased(addr, len)) {
|
||||
return (FLASH_RETURN_SUCCESS == intFlashErase(addr, len)) ? BLT_TRUE : BLT_FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue