boot directly st bootlaoder
This commit is contained in:
@@ -22,6 +22,8 @@ typedef enum
|
||||
BootCheck = 0x42,
|
||||
BootErase = 0x43,
|
||||
BootVersion = 0x44,
|
||||
BootReboot = 0x45,
|
||||
BootBootloader = 0x46,
|
||||
} BootOperation;
|
||||
|
||||
|
||||
@@ -143,6 +145,17 @@ int bootloader_bridge(int klen, uint8_t * keyh)
|
||||
u2f_response_writeback(&version,1);
|
||||
return 0;
|
||||
break;
|
||||
case BootReboot:
|
||||
printf1(TAG_BOOT, "BootReboot.\r\n");
|
||||
device_reboot();
|
||||
break;
|
||||
#ifndef SOLO_HACKER
|
||||
case BootBootloader:
|
||||
printf1(TAG_BOOT, "BootBootloader.\r\n");
|
||||
flash_option_bytes_init(1);
|
||||
boot_st_bootloader();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return CTAP1_ERR_INVALID_COMMAND;
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ int main(int argc, char * argv[])
|
||||
{
|
||||
uint8_t hidmsg[64];
|
||||
uint32_t t1 = 0;
|
||||
uint32_t stboot_time = 0;
|
||||
uint32_t boot = 1;
|
||||
|
||||
set_logging_mask(
|
||||
@@ -94,6 +95,7 @@ int main(int argc, char * argv[])
|
||||
}
|
||||
|
||||
#ifdef SOLO_HACKER
|
||||
stboot_time = millis();
|
||||
if ( RCC->CSR & (1<<29) )// check if there was independent watchdog reset
|
||||
{
|
||||
RCC->CSR |= (1<<23); // clear reset flags
|
||||
@@ -147,6 +149,17 @@ int main(int argc, char * argv[])
|
||||
delay(250);
|
||||
device_reboot();
|
||||
}
|
||||
#ifdef SOLO_HACKER
|
||||
// Boot ST bootloader if button is held for 2s
|
||||
if (!device_is_button_pressed())
|
||||
{
|
||||
stboot_time = millis();
|
||||
}
|
||||
if ((millis() - stboot_time) > 2000)
|
||||
{
|
||||
boot_st_bootloader();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Should never get here
|
||||
|
@@ -486,6 +486,18 @@ void ctap_overwrite_rk(int index,CTAP_residentKey * rk)
|
||||
}
|
||||
}
|
||||
|
||||
void boot_st_bootloader()
|
||||
{
|
||||
__disable_irq();
|
||||
|
||||
__set_MSP(*((uint32_t *)0x1fff0000));
|
||||
|
||||
((void (*)(void)) (*((uint32_t *)0x1fff0004)))();
|
||||
|
||||
while(1)
|
||||
;
|
||||
}
|
||||
|
||||
void boot_solo_bootloader()
|
||||
{
|
||||
LL_IWDG_Enable(IWDG);
|
||||
|
Reference in New Issue
Block a user