parent
e1ee7b78d2
commit
416676120b
@ -0,0 +1,25 @@
|
||||
#include STM32_HAL_H
|
||||
|
||||
#include "display.h"
|
||||
|
||||
#define FATAL_FGCOLOR 0xFFFF
|
||||
#define FATAL_BGCOLOR 0x001F
|
||||
|
||||
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");
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
#ifndef __TREZORHAL_COMMON_H__
|
||||
#define __TREZORHAL_COMMON_H__
|
||||
|
||||
void SystemClock_Config(void); // defined in stm32_system.c
|
||||
|
||||
void __attribute__((noreturn)) nlr_jump_fail(void *val);
|
||||
|
||||
void __attribute__((noreturn)) __fatal_error(const char *msg);
|
||||
|
||||
#endif
|
Loading…
Reference in new issue