diff --git a/bootloader/boot.cpp b/bootloader/boot.cpp index dc574c4f8..a88f334be 100644 --- a/bootloader/boot.cpp +++ b/bootloader/boot.cpp @@ -37,6 +37,8 @@ void Boot::setMode(BootMode mode) { } void Boot::busError() { + // Ion::Device::Flash::DisableInternalProtection(); + // Ion::Device::Flash::EraseSector(0); if (config()->isBooting()) { config()->slot()->boot(); } diff --git a/ion/src/device/shared/drivers/internal_flash.cpp b/ion/src/device/shared/drivers/internal_flash.cpp index 5c5d0aaec..136bfb842 100644 --- a/ion/src/device/shared/drivers/internal_flash.cpp +++ b/ion/src/device/shared/drivers/internal_flash.cpp @@ -44,7 +44,7 @@ static void close_protection() { } } -static void enable_protection_at(int i) { +static void disable_protection_at(int i) { if (!FLASH.OPTCR()->getLOCK()) { switch (i) { @@ -78,7 +78,7 @@ static void enable_protection_at(int i) { } } -static void disable_protection_at(int i) { +static void enable_protection_at(int i) { if (!FLASH.OPTCR()->getLOCK()) { switch (i) {