panic.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2014-2015 INRIA
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
21 #include "kernel_defines.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
32 #ifndef CONFIG_CORE_REBOOT_ON_PANIC
33 #ifdef DEVELHELP
34 #define CONFIG_CORE_REBOOT_ON_PANIC (0)
35 #else
36 #define CONFIG_CORE_REBOOT_ON_PANIC (1)
37 #endif
38 #endif
39 
43 typedef enum {
44  PANIC_GENERAL_ERROR,
45  PANIC_SOFT_REBOOT,
46  PANIC_HARD_REBOOT,
47  PANIC_ASSERT_FAIL,
48  PANIC_EXPECT_FAIL,
50 #ifdef MODULE_CORTEXM_COMMON
51  PANIC_NMI_HANDLER,
52  PANIC_HARD_FAULT,
53 #if defined(CPU_CORE_CORTEX_M3) || defined(CPU_CORE_CORTEX_M33) || \
54  defined(CPU_CORE_CORTEX_M4) || defined(CPU_CORE_CORTEX_M4F) || \
55  defined(CPU_CORE_CORTEX_M7)
56  PANIC_BUS_FAULT,
57  PANIC_USAGE_FAULT,
58  PANIC_DEBUG_MON,
59 #endif
60  PANIC_DUMMY_HANDLER,
61 #endif
64  PANIC_UNDEFINED
65 } core_panic_t;
66 
85 NORETURN void core_panic(core_panic_t crash_code, const char *message);
86 
93 void panic_arch(void);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
#define NORETURN
The NORETURN keyword tells the compiler to assume that the function cannot return.
Common macros and compiler attributes/pragmas configuration.
NORETURN void core_panic(core_panic_t crash_code, const char *message)
Handle an unrecoverable error by halting or rebooting the system.
void panic_arch(void)
architecture dependent handling of a panic case
core_panic_t
Definition of available panic modes.
Definition: panic.h:43
@ PANIC_SSP
stack smashing protector failure
Definition: panic.h:62
@ PANIC_MEM_MANAGE
memory management fault
Definition: panic.h:49
@ PANIC_STACK_OVERFLOW
stack overflow detected
Definition: panic.h:63