diff --git a/core/embed/extmod/modtrezorutils/modtrezorutils.c b/core/embed/extmod/modtrezorutils/modtrezorutils.c index d3c711784f..d00e35d11f 100644 --- a/core/embed/extmod/modtrezorutils/modtrezorutils.c +++ b/core/embed/extmod/modtrezorutils/modtrezorutils.c @@ -136,9 +136,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_trezorutils_memcpy_obj, 4, 5, STATIC mp_obj_t mod_trezorutils_halt(size_t n_args, const mp_obj_t *args) { mp_buffer_info_t msg = {0}; if (n_args > 0 && mp_get_buffer(args[0], &msg, MP_BUFFER_READ)) { - ensure(secfalse, msg.buf); + error_shutdown(msg.buf); } else { - ensure(secfalse, "halt"); + error_shutdown("halt"); } return mp_const_none; } diff --git a/core/embed/firmware/bl_check.c b/core/embed/firmware/bl_check.c index ae8ba6f24c..bf31311eaf 100644 --- a/core/embed/firmware/bl_check.c +++ b/core/embed/firmware/bl_check.c @@ -204,7 +204,7 @@ void check_and_replace_bootloader(void) { (new_bld_hdr->hw_model != 0)) { // reject non-model T bootloader // 0 represents pre-model check bootloader - ensure(secfalse, "Incompatible embedded bootloader"); + error_shutdown("Incompatible embedded bootloader"); } } // at this point, due to the previous check_image_model call, we know that the @@ -213,7 +213,7 @@ void check_and_replace_bootloader(void) { // against the firmware hw_model. else if (board_name != HW_MODEL) { // reject incompatible bootloader - ensure(secfalse, "Incompatible embedded bootloader"); + error_shutdown("Incompatible embedded bootloader"); } ensure(flash_area_erase(&BOOTLOADER_AREA, NULL), NULL); diff --git a/core/embed/prodtest/main.c b/core/embed/prodtest/main.c index 61a746e504..005819b8cf 100644 --- a/core/embed/prodtest/main.c +++ b/core/embed/prodtest/main.c @@ -79,7 +79,7 @@ static secbool startswith(const char *s, const char *prefix) { static void vcp_intr(void) { display_clear(); - ensure(secfalse, "vcp_intr"); + error_shutdown("vcp_intr"); } static char vcp_getchar(void) { diff --git a/core/embed/trezorhal/stm32f4/i2c.c b/core/embed/trezorhal/stm32f4/i2c.c index 1e0e818b97..319342b765 100644 --- a/core/embed/trezorhal/stm32f4/i2c.c +++ b/core/embed/trezorhal/stm32f4/i2c.c @@ -74,7 +74,7 @@ void i2c_init_instance(uint16_t idx, i2c_instance_t *instance) { i2c_handle[idx].Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; if (HAL_OK != HAL_I2C_Init(&i2c_handle[idx])) { - ensure(secfalse, "I2C was not loaded properly."); + error_shutdown("I2C was not loaded properly."); return; } } diff --git a/core/embed/trezorhal/stm32u5/i2c.c b/core/embed/trezorhal/stm32u5/i2c.c index e66a024a40..70b568b010 100644 --- a/core/embed/trezorhal/stm32u5/i2c.c +++ b/core/embed/trezorhal/stm32u5/i2c.c @@ -99,7 +99,7 @@ void i2c_init_instance(uint16_t idx, i2c_instance_t *instance) { i2c_handle[idx].Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; if (HAL_OK != HAL_I2C_Init(&i2c_handle[idx])) { - ensure(secfalse, "I2C was not loaded properly."); + error_shutdown("I2C was not loaded properly."); return; } } diff --git a/core/embed/trezorhal/unix/display-unix.c b/core/embed/trezorhal/unix/display-unix.c index 0b7f8453df..60bbf1acc2 100644 --- a/core/embed/trezorhal/unix/display-unix.c +++ b/core/embed/trezorhal/unix/display-unix.c @@ -118,7 +118,7 @@ void display_deinit(void) { void display_init(void) { if (SDL_Init(SDL_INIT_VIDEO) != 0) { printf("%s\n", SDL_GetError()); - ensure(secfalse, "SDL_Init error"); + error_shutdown("SDL_Init error"); } atexit(display_deinit); @@ -143,13 +143,13 @@ void display_init(void) { free(window_title_alloc); if (!WINDOW) { printf("%s\n", SDL_GetError()); - ensure(secfalse, "SDL_CreateWindow error"); + error_shutdown("SDL_CreateWindow error"); } RENDERER = SDL_CreateRenderer(WINDOW, -1, SDL_RENDERER_SOFTWARE); if (!RENDERER) { printf("%s\n", SDL_GetError()); SDL_DestroyWindow(WINDOW); - ensure(secfalse, "SDL_CreateRenderer error"); + error_shutdown("SDL_CreateRenderer error"); } SDL_SetRenderDrawColor(RENDERER, 0, 0, 0, 255); SDL_RenderClear(RENDERER); diff --git a/core/embed/trezorhal/unix/display_driver.c b/core/embed/trezorhal/unix/display_driver.c index 3eedcb25ae..ac4d23f2fc 100644 --- a/core/embed/trezorhal/unix/display_driver.c +++ b/core/embed/trezorhal/unix/display_driver.c @@ -83,7 +83,7 @@ void display_init(void) { if (SDL_Init(SDL_INIT_VIDEO) != 0) { printf("%s\n", SDL_GetError()); - ensure(secfalse, "SDL_Init error"); + error_shutdown("SDL_Init error"); } atexit(display_deinit); @@ -108,13 +108,13 @@ void display_init(void) { free(window_title_alloc); if (!drv->window) { printf("%s\n", SDL_GetError()); - ensure(secfalse, "SDL_CreateWindow error"); + error_shutdown("SDL_CreateWindow error"); } drv->renderer = SDL_CreateRenderer(drv->window, -1, SDL_RENDERER_SOFTWARE); if (!drv->renderer) { printf("%s\n", SDL_GetError()); SDL_DestroyWindow(drv->window); - ensure(secfalse, "SDL_CreateRenderer error"); + error_shutdown("SDL_CreateRenderer error"); } SDL_SetRenderDrawColor(drv->renderer, 0, 0, 0, 255); SDL_RenderClear(drv->renderer);