fb11e647
vrobic
reseau statique a...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/*
* Copyright (C) 2015 INRIA
* Copyright (C) 2015 Eistec AB
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/
/**
* @ingroup core_util
* @{
*
* @file
* @brief Crash handling functions
*
* @author Kévin Roussel <Kevin.Roussel@inria.fr>
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @author Joakim Nohlgård <joakim.nohlgard@eistec.se>
* @author Kaspar Schleiser <kaspar@schleiser.de>
*/
#include <string.h>
#include <stdio.h>
#include "assert.h"
#include "kernel_defines.h"
#include "cpu.h"
#include "irq.h"
#include "lpm.h"
#include "panic.h"
#include "arch/panic_arch.h"
#include "reboot.h"
#include "log.h"
#if defined(DEVELHELP) && defined(MODULE_PS)
#include "ps.h"
#endif
const char assert_crash_message[] = "FAILED ASSERTION.";
/* flag preventing "recursive crash printing loop" */
static int crashed = 0;
/* WARNING: this function NEVER returns! */
NORETURN void core_panic(core_panic_t crash_code, const char *message)
{
#ifdef NDEBUG
(void) crash_code;
#endif
if (crashed == 0) {
/* print panic message to console (if possible) */
crashed = 1;
#ifndef NDEBUG
if (crash_code == PANIC_ASSERT_FAIL) {
cpu_print_last_instruction();
}
#endif
LOG_ERROR("*** RIOT kernel panic:\n%s\n\n", message);
#ifdef DEVELHELP
#ifdef MODULE_PS
ps();
LOG_ERROR("\n");
#endif
LOG_ERROR("*** halted.\n\n");
#else
LOG_ERROR("*** rebooting...\n\n");
#endif
}
/* disable watchdog and all possible sources of interrupts */
irq_disable();
panic_arch();
#ifndef DEVELHELP
/* DEVELHELP not set => reboot system */
reboot();
#endif
/* tell the compiler that we won't return from this function
(even if we actually won't even get here...) */
UNREACHABLE();
}
|