Skip to content

Commit

Permalink
[SAMD21] Don't issue a chip erase if address is 0
Browse files Browse the repository at this point in the history
If a user selects "Nano33BLE" in the IDE but tries to flash a SAMD board, the commandline being used will not specify a base address, so the whole flash will be erased (the bootloader too)
  • Loading branch information
facchinm committed Jul 30, 2020
1 parent 52e0a4a commit 89f3556
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/D2xNvmFlash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ D2xNvmFlash::erase(uint32_t offset, uint32_t size)
void
D2xNvmFlash::eraseAll(uint32_t offset)
{
if (offset == 0) {
// Not bailing out will provoke the bootloader to be erased
throw FlashEraseError();
}
// Use the extended Samba command if available
if (_samba.canChipErase())
{
Expand Down

0 comments on commit 89f3556

Please sign in to comment.