unleashed-firmware/core/furi/check.c
あく 66f9d946ae
[FL-1490] FuriHal: crypto api. Crypto cli tool. (#702)
* FuriHal: crypto layer
* Furi: add crash routine.
* FuriHal: crypto api. Crypto: cli command to manipulate secure enclave and encrypt/decrypt plain text.
* DeviceInfo: secure enclave verification.
* Rename original to enclave_valid
* Update expected enclave signature to match production keys
* F7: remove unused files
2021-09-15 12:59:49 +03:00

36 lines
927 B
C

#include "check.h"
#include "furi-hal-task.h"
#include <furi-hal-console.h>
#include <stdio.h>
void __furi_print_name(void) {
if(task_is_isr_context()) {
furi_hal_console_puts("[ISR] ");
} else {
const char* name = osThreadGetName(osThreadGetId());
if(name == NULL) {
furi_hal_console_puts("[main] ");
} else {
furi_hal_console_puts("[");
furi_hal_console_puts(name);
furi_hal_console_puts("] ");
}
}
}
void __furi_abort(void) {
__disable_irq();
asm("bkpt 1");
while(1) {
}
}
void furi_crash(const char* message) {
furi_hal_console_puts("\r\n\033[0;31m[CRASH]");
__furi_print_name();
furi_hal_console_puts(message ? message : "Programming Error");
furi_hal_console_puts("\r\nSystem halted. Connect debugger for more info\r\n");
furi_hal_console_puts("\033[0m\r\n");
__furi_abort();
}