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 
9 #pragma once
10 
24 #include "kernel_defines.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
35 #ifndef CONFIG_CORE_REBOOT_ON_PANIC
36 #ifdef DEVELHELP
37 #define CONFIG_CORE_REBOOT_ON_PANIC (0)
38 #else
39 #define CONFIG_CORE_REBOOT_ON_PANIC (1)
40 #endif
41 #endif
42 
46 typedef enum {
47  PANIC_GENERAL_ERROR,
48  PANIC_SOFT_REBOOT,
49  PANIC_HARD_REBOOT,
50  PANIC_ASSERT_FAIL,
51  PANIC_EXPECT_FAIL,
53 #ifdef MODULE_CORTEXM_COMMON
54  PANIC_NMI_HANDLER,
55  PANIC_HARD_FAULT,
56 #if defined(CPU_CORE_CORTEX_M3) || defined(CPU_CORE_CORTEX_M33) || \
57  defined(CPU_CORE_CORTEX_M4) || defined(CPU_CORE_CORTEX_M4F) || \
58  defined(CPU_CORE_CORTEX_M7)
59  PANIC_BUS_FAULT,
60  PANIC_USAGE_FAULT,
61  PANIC_DEBUG_MON,
62 #endif
63  PANIC_DUMMY_HANDLER,
64 #endif
67  PANIC_UNDEFINED
68 } core_panic_t;
69 
88 NORETURN void core_panic(core_panic_t crash_code, const char *message);
89 
96 void panic_arch(void);
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
#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:46
@ PANIC_SSP
stack smashing protector failure
Definition: panic.h:65
@ PANIC_MEM_MANAGE
memory management fault
Definition: panic.h:52
@ PANIC_STACK_OVERFLOW
stack overflow detected
Definition: panic.h:66