panic.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014, 2015 INRIA
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef PANIC_H
23 #define PANIC_H
24 
25 #include "kernel_defines.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
36 #ifndef CONFIG_CORE_REBOOT_ON_PANIC
37 #ifdef DEVELHELP
38 #define CONFIG_CORE_REBOOT_ON_PANIC (0)
39 #else
40 #define CONFIG_CORE_REBOOT_ON_PANIC (1)
41 #endif
42 #endif
43 
47 typedef enum {
48  PANIC_GENERAL_ERROR,
49  PANIC_SOFT_REBOOT,
50  PANIC_HARD_REBOOT,
51  PANIC_ASSERT_FAIL,
52  PANIC_EXPECT_FAIL,
54 #ifdef MODULE_CORTEXM_COMMON
55  PANIC_NMI_HANDLER,
56  PANIC_HARD_FAULT,
57 #if defined(CPU_CORE_CORTEX_M3) || defined(CPU_CORE_CORTEX_M33) || \
58  defined(CPU_CORE_CORTEX_M4) || defined(CPU_CORE_CORTEX_M4F) || \
59  defined(CPU_CORE_CORTEX_M7)
60  PANIC_BUS_FAULT,
61  PANIC_USAGE_FAULT,
62  PANIC_DEBUG_MON,
63 #endif
64  PANIC_DUMMY_HANDLER,
65 #endif
68  PANIC_UNDEFINED
69 } core_panic_t;
70 
91 NORETURN void core_panic(core_panic_t crash_code, const char *message);
92 
99 void panic_arch(void);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* PANIC_H */
#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:47
@ PANIC_SSP
stack smashing protector failure
Definition: panic.h:66
@ PANIC_MEM_MANAGE
memory management fault
Definition: panic.h:53
@ PANIC_STACK_OVERFLOW
stack overflow detected
Definition: panic.h:67