diff --git a/src/bootloader/bootloader.c b/src/bootloader/bootloader.c index 13e851c1c..091e32350 100644 --- a/src/bootloader/bootloader.c +++ b/src/bootloader/bootloader.c @@ -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); } @@ -902,7 +900,12 @@ static bool _devdevice_enter(secbool_u32 firmware_verified) UG_PutString(0, 0, " ", 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, " ", 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, " ", 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) { @@ -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; } }