[FL-2219, FL-2251] System, FuriCore, FuriHal: various bug fixes and improvements (#986)
* Replace irq shenanigans with critical section * Power: halt system on power off instead of crash. * Gui: properly handle input event on NULL current_view * FuriHal: correct gpio configuration sequence * FuriHal: cleanup uart initialization. Makefile: allow to disable thread support. * Loader: improve locking, fix simultaneous app start crash, full command line args support for gui apps, more consistent insomnia * Loader: correct spelling * FuriHal: increase gpio configuration readability * FuriHal: correct gpio configuration error when mode is GpioModeEventRiseFall Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#include <furi_hal_rtc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
__attribute__((always_inline)) inline static void __furi_print_name() {
|
||||
static void __furi_print_name() {
|
||||
if(task_is_isr_context()) {
|
||||
furi_hal_console_puts("[ISR] ");
|
||||
} else {
|
||||
@@ -19,9 +19,9 @@ __attribute__((always_inline)) inline static void __furi_print_name() {
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((always_inline)) inline static void __furi_halt() {
|
||||
asm volatile("bkpt 0x00 \n"
|
||||
"loop: \n"
|
||||
static void __furi_halt() {
|
||||
asm volatile("loop: \n"
|
||||
"bkpt 0x00 \n"
|
||||
"wfi \n"
|
||||
"b loop \n"
|
||||
:
|
||||
@@ -50,3 +50,18 @@ void furi_crash(const char* message) {
|
||||
NVIC_SystemReset();
|
||||
#endif
|
||||
}
|
||||
|
||||
void furi_halt(const char* message) {
|
||||
__disable_irq();
|
||||
|
||||
if(message == NULL) {
|
||||
message = "System halt requested.";
|
||||
}
|
||||
|
||||
furi_hal_console_puts("\r\n\033[0;31m[HALT]");
|
||||
__furi_print_name();
|
||||
furi_hal_console_puts(message);
|
||||
furi_hal_console_puts("\r\nSystem halted. Bye-bye!\r\n");
|
||||
furi_hal_console_puts("\033[0m\r\n");
|
||||
__furi_halt();
|
||||
}
|
||||
|
@@ -17,6 +17,9 @@ extern "C" {
|
||||
/** Crash system */
|
||||
void furi_crash(const char* message);
|
||||
|
||||
/** Halt system */
|
||||
void furi_halt(const char* message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user