1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-11 07:02:41 +00:00
trezor-firmware/micropython/trezorhal/common.c

26 lines
627 B
C
Raw Normal View History

#include STM32_HAL_H
#include "display.h"
#define FATAL_FGCOLOR 0xFFFF
2017-03-21 15:06:22 +00:00
#define FATAL_BGCOLOR 0x7800
void __attribute__((noreturn)) __fatal_error(const char *msg) {
for (volatile uint32_t delay = 0; delay < 10000000; delay++) {
}
display_print("FATAL ERROR:\n", -1);
display_print(msg, -1);
display_print("\n", -1);
display_print_out(FATAL_FGCOLOR, FATAL_BGCOLOR);
for (;;) {
display_backlight(255);
HAL_Delay(950);
display_backlight(128);
HAL_Delay(50);
}
}
void __attribute__((noreturn)) nlr_jump_fail(void *val) {
__fatal_error("uncaught exception");
}