8000 [SAMD21] Don't issue a chip erase if address is 0 · arduino/BOSSA@89f3556 · GitHub
[go: up one dir, main page]

Skip to content

Commit 89f3556

Browse files
committed
[SAMD21] Don't issue a chip erase if address is 0
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)
1 parent 52e0a4a commit 89f3556

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/D2xNvmFlash.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ D2xNvmFlash::erase(uint32_t offset, uint32_t size)
107107
void
108108
D2xNvmFlash::eraseAll(uint32_t offset)
109109
{
110+
if (offset == 0) {
111+
// Not bailing out will provoke the bootloader to be erased
112+
throw FlashEraseError();
113+
}
110114
// Use the extended Samba command if available
111115
if (_samba.canChipErase())
112116
{

0 commit comments

Comments
 (0)
0