flipperzero-firmware/core/furi/check.c
SG 153666f73f
F6: USB glue cleanup and fixes (#666)
* USB-CDC: accepting the next data packet only if we process previous data
* USB-CDC: use USB FS packet size
* HAL-console: puts method
* Check: print assertion data
* FuriHal: rx stream free space aware CDC confirmation.
* Bootloader: pull down USB lines, leave the rest to the firmware or bootloader
* F6: cleanup and move USB code to usb-glue folder, add USB suspend/resume events to VCP, cleanup target.mk, fix missing motd message in cli when using minicom.
* F5: cleanup the rest of USB glue code, adjust LPM and Power info data in descriptor.

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-22 13:43:45 +03:00

36 lines
830 B
C

#include "check.h"
#include "furi-hal-task.h"
#include <furi-hal-console.h>
#include <stdio.h>
void __furi_abort(void);
void __furi_print_name(void) {
furi_hal_console_puts("\r\n\033[0;31m[E]");
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("] ");
}
}
furi_hal_console_puts("\033[0m");
}
void __furi_check(void) {
__furi_print_name();
furi_hal_console_puts("assertion failed\r\n");
__furi_abort();
}
void __furi_abort(void) {
__disable_irq();
asm("bkpt 1");
while(1) {
}
}