@@ -408,10 +408,8 @@ static size_t _api_write_chunk(const uint8_t* buf, uint8_t chunknum, uint8_t* ou
408
408
409
409
// Erase is handled inside of flash_write
410
410
if (flash_write (
411
- & FLASH_0 ,
412
- FLASH_APP_START + (chunknum * FIRMWARE_CHUNK_LEN ),
413
- (const uint8_t * )buf ,
414
- FIRMWARE_CHUNK_LEN ) != ERR_NONE ) {
411
+ & FLASH_0 , FLASH_APP_START + (chunknum * FIRMWARE_CHUNK_LEN ), buf , FIRMWARE_CHUNK_LEN ) !=
412
+ ERR_NONE ) {
415
413
return _report_status (OP_STATUS_ERR_WRITE , output );
416
414
}
417
415
@@ -902,7 +900,12 @@ static bool _devdevice_enter(secbool_u32 firmware_verified)
902
900
UG_PutString (0 , 0 , " <Enter bootloader>" , false);
903
901
UG_PutString (0 , SCREEN_HEIGHT / 2 - 11 , "DEV DEVICE" , false);
904
902
UG_PutString (0 , SCREEN_HEIGHT / 2 + 2 , "NOT FOR VALUE" , false);
905
- UG_PutString (0 , SCREEN_HEIGHT - 9 , " <Continue>" , false);
903
+ // Check that the firmware's reset handler isn't invalid.
904
+ if (((uint32_t * )FLASH_APP_START )[1 ] != 0xffffffff ) {
905
+ UG_PutString (0 , SCREEN_HEIGHT - 9 , " <Continue>" , false);
906
+ } else {
907
+ UG_PutString (0 , SCREEN_HEIGHT - 9 , " No firmware found" , false);
908
+ }
906
909
uint16_t ypos = SCREEN_HEIGHT / 2 - 4 ;
907
910
uint16_t xpos = SCREEN_WIDTH - 10 ;
908
911
if (firmware_verified != sectrue_u32 ) {
@@ -923,7 +926,8 @@ static bool _devdevice_enter(secbool_u32 firmware_verified)
923
926
if (qtouch_is_scroller_active (top_slider )) {
924
927
return true;
925
928
}
926
- if (qtouch_is_scroller_active (bottom_slider )) {
929
+ if (qtouch_is_scroller_active (bottom_slider ) &&
930
+ ((uint32_t * )FLASH_APP_START )[1 ] != 0xffffffff ) {
927
931
return false;
928
932
}
929
933
}
0 commit comments