示例#1
0
文件: panic.c 项目: Alex-Gramm/RIOT
/* WARNING: this function NEVER returns! */
NORETURN void core_panic(int crash_code, const char *message)
{
    if (crashed == 0) {
        /* print panic message to console (if possible) */
        crashed = 1;
        puts("*** RIOT kernel panic");
        puts(message);
#if DEVELHELP
#ifdef MODULE_PS
        ps();
        puts("");
#endif

        puts("*** halted.\n");
#else
        puts("*** rebooting...\n\n");
#endif
    }
    /* disable watchdog and all possible sources of interrupts */
    disableIRQ();
    panic_arch();
#ifndef DEVELHELP
    /* DEVELHELP not set => reboot system */
    (void) reboot(RB_AUTOBOOT);
#endif

    /* tell the compiler that we won't return from this function
       (even if we actually won't even get here...) */
    UNREACHABLE();
}
示例#2
0
文件: panic.c 项目: aethaniel/RIOT
/* 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) {
        crashed = 1;
        puts("******** SYSTEM FAILURE ********\n");
        puts(message);
#if DEVELHELP
#ifdef MODULE_PS
        ps();
        puts("");
#endif

        puts("******** RIOT HALTS HERE ********\n");
#else
        puts("******** RIOT WILL REBOOT ********\n");
#endif
        puts("\n\n");
    }
    /* disable watchdog and all possible sources of interrupts */
    disableIRQ();
    panic_arch();
#ifndef DEVELHELP
    /* DEVELHELP not set => reboot system */
    (void) reboot(RB_AUTOBOOT);
#endif

    /* tell the compiler that we won't return from this function
       (even if we actually won't even get here...) */
    UNREACHABLE();
}