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

Merge pull request #14378 from benpicco/core/panic_usb-bootloader

core/panic: launch USB bootloader on crash for easy recovery
This commit is contained in:
Martine Lenders 2020-07-01 22:51:38 +02:00 committed by GitHub
commit 77bf3d4484
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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...) */