From 6d434122f7b1600d9eb6098a6f0eabf11ae7bea4 Mon Sep 17 00:00:00 2001 From: matejcik Date: Wed, 29 Mar 2023 16:21:43 +0200 Subject: [PATCH] feat(core/bootloader): emulator can now show custom error screens --- core/embed/bootloader/bootui.h | 1 + core/embed/bootloader/emulator.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/embed/bootloader/bootui.h b/core/embed/bootloader/bootui.h index 0c2d0f8926..215013ec77 100644 --- a/core/embed/bootloader/bootui.h +++ b/core/embed/bootloader/bootui.h @@ -36,6 +36,7 @@ void ui_screen_boot(const vendor_header* const vhdr, const image_header* const hdr); void ui_screen_boot_wait(int wait_seconds); void ui_screen_boot_click(void); +void ui_click(void); void ui_screen_welcome_model(void); void ui_screen_welcome(void); diff --git a/core/embed/bootloader/emulator.c b/core/embed/bootloader/emulator.c index 0288ae4a76..0baec152ad 100644 --- a/core/embed/bootloader/emulator.c +++ b/core/embed/bootloader/emulator.c @@ -2,9 +2,10 @@ #include "common.h" #include "display.h" -#include "emulator.h" #include "flash.h" #include "rust_ui.h" +#include "bootui.h" +#include "emulator.h" uint8_t *FIRMWARE_START = 0; uint32_t stay_in_bootloader_flag; @@ -18,9 +19,16 @@ int main(int argc, char **argv) { FIRMWARE_START = (uint8_t *)flash_get_address(FLASH_SECTOR_FIRMWARE_START, 0, 0); - if (argc > 1 && argv[1][0] == 's') { + if (argc == 2 && argv[1][0] == 's') { // Run the firmware stay_in_bootloader_flag = STAY_IN_BOOTLOADER_FLAG; + } else if (argc == 4) { + display_init(); + display_backlight(180); + screen_fatal_error_rust(argv[1], argv[2], argv[3]); + display_refresh(); + ui_click(); + exit(0); } int retval = bootloader_main();