1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +00:00

Merge pull request #847 from trezor/prusnak/bootloader-restart

legacy/bootloader: soft reset after firmware upload
This commit is contained in:
Pavol Rusnak 2020-02-19 18:20:49 +01:00 committed by GitHub
commit d2bcccf0ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -19,6 +19,7 @@
#include <libopencm3/stm32/flash.h>
#include <libopencm3/usb/usbd.h>
#include <vendor/libopencm3/include/libopencmsis/core_cm3.h>
#include <string.h>
@ -415,9 +416,18 @@ static void rx_callback(usbd_device *dev, uint8_t ep) {
flash_state = STATE_END;
if (hash_check_ok) {
show_unplug("New firmware", "successfully installed.");
send_msg_success(dev);
shutdown();
__disable_irq();
// wait 3 seconds
char line[] = "will be restarted in _ s.";
for (int i = 3; i > 0; i--) {
line[21] = '0' + i;
layoutDialog(&bmp_icon_ok, NULL, NULL, NULL, "New firmware",
"successfully installed.", NULL, "Your Trezor", line,
NULL);
delay(30000 * 1000);
}
scb_reset_system();
} else {
layoutDialog(&bmp_icon_warning, NULL, NULL, NULL, "Firmware installation",
"aborted.", NULL, "You need to repeat", "the procedure with",

View File

@ -432,7 +432,7 @@ void usbPoll(void) {
void usbReconnect(void) {
if (usbd_dev != NULL) {
usbd_disconnect(usbd_dev, 1);
delay(1000);
delay(120000);
usbd_disconnect(usbd_dev, 0);
}
}