Skip to content

Commit

Permalink
Merge pull request #1332 from NickeZ/nickez/dont-boot-to-ff
Browse files Browse the repository at this point in the history
Nickez/dont boot to ff
  • Loading branch information
NickeZ authored Dec 3, 2024
2 parents 3b69f37 + b163c7e commit 886e2fd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/bootloader/bootloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,8 @@ static size_t _api_write_chunk(const uint8_t* buf, uint8_t chunknum, uint8_t* ou

// Erase is handled inside of flash_write
if (flash_write(
&FLASH_0,
FLASH_APP_START + (chunknum * FIRMWARE_CHUNK_LEN),
(const uint8_t*)buf,
FIRMWARE_CHUNK_LEN) != ERR_NONE) {
&FLASH_0, FLASH_APP_START + (chunknum * FIRMWARE_CHUNK_LEN), buf, FIRMWARE_CHUNK_LEN) !=
ERR_NONE) {
return _report_status(OP_STATUS_ERR_WRITE, output);
}

Expand Down Expand Up @@ -902,7 +900,12 @@ static bool _devdevice_enter(secbool_u32 firmware_verified)
UG_PutString(0, 0, " <Enter bootloader>", false);
UG_PutString(0, SCREEN_HEIGHT / 2 - 11, "DEV DEVICE", false);
UG_PutString(0, SCREEN_HEIGHT / 2 + 2, "NOT FOR VALUE", false);
UG_PutString(0, SCREEN_HEIGHT - 9, " <Continue>", false);
// Check that the firmware's reset handler isn't invalid.
if (((uint32_t*)FLASH_APP_START)[1] != 0xffffffff) {
UG_PutString(0, SCREEN_HEIGHT - 9, " <Continue>", false);
} else {
UG_PutString(0, SCREEN_HEIGHT - 9, " No firmware found", false);
}
uint16_t ypos = SCREEN_HEIGHT / 2 - 4;
uint16_t xpos = SCREEN_WIDTH - 10;
if (firmware_verified != sectrue_u32) {
Expand All @@ -923,7 +926,8 @@ static bool _devdevice_enter(secbool_u32 firmware_verified)
if (qtouch_is_scroller_active(top_slider)) {
return true;
}
if (qtouch_is_scroller_active(bottom_slider)) {
if (qtouch_is_scroller_active(bottom_slider) &&
((uint32_t*)FLASH_APP_START)[1] != 0xffffffff) {
return false;
}
}
Expand Down

0 comments on commit 886e2fd

Please sign in to comment.