Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
f953ae81
Commit
f953ae81
authored
9 years ago
by
Kaspar Schleiser
Browse files
Options
Downloads
Patches
Plain Diff
core: optimize panic.c
parent
9ecaea40
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/panic.c
+6
-16
6 additions, 16 deletions
core/panic.c
with
6 additions
and
16 deletions
core/panic.c
+
6
−
16
View file @
f953ae81
/*
* 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
...
...
@@ -17,6 +18,7 @@
* @author Kévin Roussel <Kevin.Roussel@inria.fr>
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @author Joakim Gebart <joakim.gebart@eistec.se>
* @author Kaspar Schleiser <kaspar@schleiser.de>
*/
#include
<string.h>
...
...
@@ -32,27 +34,16 @@
#include
"ps.h"
#endif
#define PANIC_STR_SIZE 80
/* "public" variables holding the crash data */
char
panic_str
[
PANIC_STR_SIZE
];
int
panic_code
;
/* flag preventing "recursive crash printing loop" */
static
int
crashed
=
0
;
/* WARNING: this function NEVER returns! */
NORETURN
void
core_panic
(
int
crash_code
,
const
char
*
message
)
{
/* copy panic datas to "public" global variables */
panic_code
=
crash_code
;
strncpy
(
panic_str
,
message
,
sizeof
(
panic_str
));
/* strncpy does not add any null-termination. */
panic_str
[
sizeof
(
panic_str
)
-
1
]
=
'\0'
;
/* print panic message to console (if possible) */
if
(
crashed
==
0
)
{
/* print panic message to console (if possible) */
crashed
=
1
;
puts
(
"***
***** SYSTEM FAILURE ********
\n
"
);
puts
(
"***
RIOT kernel panic
"
);
puts
(
message
);
#if DEVELHELP
#ifdef MODULE_PS
...
...
@@ -60,11 +51,10 @@ NORETURN void core_panic(int crash_code, const char *message)
puts
(
""
);
#endif
puts
(
"***
***** RIOT HALTS HERE ********
\n
"
);
puts
(
"***
halted.
\n
"
);
#else
puts
(
"***
***** RIOT WILL REBOOT ********
\n
"
);
puts
(
"***
rebooting...
\n
\n
"
);
#endif
puts
(
"
\n\n
"
);
}
/* disable watchdog and all possible sources of interrupts */
disableIRQ
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment