Skip to content

Commit

Permalink
Merge pull request #20630 from benpicco/core_panic-reboot
Browse files Browse the repository at this point in the history
core/panic: make reboot on panic configurable
  • Loading branch information
maribu authored Apr 26, 2024
2 parents 70c70e2 + 9e0a32e commit 420ee3f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions core/lib/include/panic.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
extern "C" {
#endif

/**
* @brief Automatically reboot the system on panic()
*
* By default this is on when @ref DEVELHELP is disabled.
*/
#ifndef CONFIG_CORE_REBOOT_ON_PANIC
#ifdef DEVELHELP
#define CONFIG_CORE_REBOOT_ON_PANIC (0)
#else
#define CONFIG_CORE_REBOOT_ON_PANIC (1)
#endif
#endif

/**
* @brief Definition of available panic modes
*/
Expand Down
2 changes: 1 addition & 1 deletion core/lib/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ NORETURN void core_panic(core_panic_t crash_code, const char *message)
/* disable watchdog and all possible sources of interrupts */
irq_disable();
panic_arch();
#if !defined(DEVELHELP) && defined(MODULE_PERIPH_PM)
#if CONFIG_CORE_REBOOT_ON_PANIC && defined(MODULE_PERIPH_PM)
/* DEVELHELP not set => reboot system */
pm_reboot();
#else
Expand Down

0 comments on commit 420ee3f

Please sign in to comment.