[FL-2892] Gui: update statusbar attention icon and better crash handling (#1908)
* Gui: update statusbar attention icon * Furi: snapshot registers on crash and restore in halt * Furi: document check routines
This commit is contained in:
+38
-11
@@ -8,25 +8,52 @@ extern "C" {
|
||||
#define FURI_NORETURN noreturn
|
||||
#endif
|
||||
|
||||
/** Pointer to pass message to __furi_crash and __furi_halt */
|
||||
extern const char* __furi_check_message;
|
||||
|
||||
/** Crash system */
|
||||
FURI_NORETURN void __furi_crash();
|
||||
|
||||
/** Halt system */
|
||||
FURI_NORETURN void __furi_halt();
|
||||
|
||||
/** Crash system with message. Show message after reboot. */
|
||||
#define furi_crash(message) \
|
||||
do { \
|
||||
__furi_check_message = message; \
|
||||
__furi_crash(); \
|
||||
} while(0)
|
||||
|
||||
/** Halt system with message. */
|
||||
#define furi_halt(message) \
|
||||
do { \
|
||||
__furi_check_message = message; \
|
||||
__furi_halt(); \
|
||||
} while(0)
|
||||
|
||||
/** Check condition and crash if check failed */
|
||||
#define furi_check(__e) ((__e) ? (void)0 : furi_crash("furi_check failed\r\n"))
|
||||
#define furi_check(__e) \
|
||||
do { \
|
||||
if ((__e) == 0) { \
|
||||
furi_crash("furi_check failed\r\n"); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/** Only in debug build: Assert condition and crash if assert failed */
|
||||
#ifdef FURI_DEBUG
|
||||
#define furi_assert(__e) ((__e) ? (void)0 : furi_crash("furi_assert failed\r\n"))
|
||||
#define furi_assert(__e) \
|
||||
do { \
|
||||
if ((__e) == 0) { \
|
||||
furi_crash("furi_assert failed\r\n"); \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define furi_assert(__e) \
|
||||
do { \
|
||||
((void)(__e)); \
|
||||
#define furi_assert(__e) \
|
||||
do { \
|
||||
((void)(__e)); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
/** Crash system */
|
||||
FURI_NORETURN void furi_crash(const char* message);
|
||||
|
||||
/** Halt system */
|
||||
FURI_NORETURN void furi_halt(const char* message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user