mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-13 19:18:56 +00:00
Merge pull request #847 from trezor/prusnak/bootloader-restart
legacy/bootloader: soft reset after firmware upload
This commit is contained in:
commit
d2bcccf0ae
@ -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",
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user