1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

core/panic: launch USB bootloader for easy recovery

If a board was flashed via USB bootloader, a crash means the user has to
perform a procedure to manually enter the bootloader again for recovery.

To allow for easier recovery, automatically lauch the bootloader on crash
if `DEVELHELP` is enabled.
This commit is contained in:
Benjamin Valentin 2020-06-27 16:17:42 +02:00 committed by Benjamin Valentin
parent e8d8fd2f32
commit b71fde68e9

View File

@ -36,6 +36,13 @@
#include "ps.h"
#endif
/* If a device is flashed over USB bootloader, try to launch
* the bootloader again on crash so the user can re-flash it.
*/
#if defined(DEVELHELP) && defined(MODULE_USB_BOARD_RESET)
#include "usb_board_reset.h"
#endif
const char assert_crash_message[] = "FAILED ASSERTION.";
/* flag preventing "recursive crash printing loop" */
@ -81,8 +88,13 @@ NORETURN void core_panic(core_panic_t crash_code, const char *message)
pm_reboot();
#else
/* DEVELHELP set => power off system */
/* or start bootloader */
#ifdef MODULE_USB_BOARD_RESET
usb_board_reset_in_bootloader();
#else
pm_off();
#endif
#endif /* DEVELHELP */
/* tell the compiler that we won't return from this function
(even if we actually won't even get here...) */