Skip to content

Commit 292d763

Browse files
committed
Disabled 'Boot to flash' option in Nvm devices
This change is a small part of the commit dbdd088
1 parent cd2ad92 commit 292d763

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/BossaThread.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,12 @@ WriteThread::Entry()
133133

134134
flasher.write(_filename.mb_str(), _offset);
135135

136-
flash->setBootFlash(_bootFlash);
137-
flash->setBod(_bod);
138-
flash->setBor(_bor);
136+
if (flash->canBootFlash())
137+
flash->setBootFlash(_bootFlash);
138+
if (flash->canBod())
139+
flash->setBod(_bod);
140+
if (flash->canBor())
141+
flash->setBor(_bor);
139142
if (_lock)
140143
flash->lockAll();
141144
if (_security)

src/NvmFlash.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ NvmFlash::getBootFlash()
287287
void
288288
NvmFlash::setBootFlash(bool enable)
289289
{
290-
printf("Ignoring set boot from flash flag.\n");
290+
if (!enable)
291+
throw BootFlashError();
291292
}
292293

293294
void

src/NvmFlash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class NvmFlash : public Flash
7272

7373
bool getBootFlash();
7474
void setBootFlash(bool enable);
75-
bool canBootFlash() { return true; }
75+
bool canBootFlash() { return false; }
7676

7777
void writePage(uint32_t page);
7878
void readPage(uint32_t page, uint8_t* data);

src/Samba.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ Samba::checksumBuffer(uint32_t start_addr, uint32_t size)
664664
errno = 0;
665665
uint32_t res = strtol((char*) &cmd[1], NULL, 16);
666666
if (errno != 0)
667-
throw SambaError();
667+
throw SambaError();
668668
if (_debug)
669669
printf("%x\n", res);
670670
return res;

0 commit comments

Comments
 (0)