void up_assert(const uint8_t *filename, int lineno) { #if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_DEBUG_ALERT) struct tcb_s *rtcb = this_task(); #endif board_autoled_on(LED_ASSERTION); #if CONFIG_TASK_NAME_SIZE > 0 _alert("Assertion failed at file:%s line: %d task: %s\n", filename, lineno, rtcb->name); #else _alert("Assertion failed at file:%s line: %d\n", filename, lineno); #endif up_dumpstate(); #ifdef CONFIG_BOARD_CRASHDUMP board_crashdump(up_getsp(), this_task(), filename, lineno); #endif #ifdef CONFIG_ARCH_USBDUMP /* Dump USB trace data */ (void)usbtrace_enumerate(assert_tracecallback, NULL); #endif _up_assert(EXIT_FAILURE); }
static void up_stackdump(void) { _TCB *rtcb = (_TCB*)g_readytorun.head; chipreg_t sp = up_getsp(); chipreg_t stack_base = (chipreg_t)rtcb->adj_stack_ptr; chipreg_t stack_size = (chipreg_t)rtcb->adj_stack_size; lldbg("stack_base: %08x\n", stack_base); lldbg("stack_size: %08x\n", stack_size); lldbg("sp: %08x\n", sp); if (sp >= stack_base || sp < stack_base - stack_size) { lldbg("ERROR: Stack pointer is not within allocated stack\n"); return; } else { chipreg_t stack = sp & ~0x0f; for (stack = sp & ~0x0f; stack < stack_base; stack += 8*sizeof(chipreg_t)) { chipreg_t *ptr = (chipreg_t*)stack; lldbg("%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n", stack, ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], ptr[7]); } } }
void up_assert(const uint8_t *filename, int line) { fprintf(stderr, "Assertion failed at file:%s line: %d\n", filename, line); #ifdef CONFIG_BOARD_CRASHDUMP board_crashdump(up_getsp(), g_readytorun.head, filename, line); #endif longjmp(sim_abort, 1); }
void up_assert(const uint8_t *filename, int line) { /* Show the location of the failed assertion */ fprintf(stderr, "Assertion failed at file:%s line: %d\n", filename, line); /* Allow for any board/configuration specific crash information */ #ifdef CONFIG_BOARD_CRASHDUMP board_crashdump(up_getsp(), this_task(), filename, line); #endif /* Exit the simulation */ g_exitcode = EXIT_FAILURE; longjmp(g_simabort, 1); }
void up_assert(const uint8_t *filename, int line) { fprintf(stderr, "Assertion failed at file:%s line: %d\n", filename, line); #ifdef CONFIG_BOARD_CRASHDUMP board_crashdump(up_getsp(), this_task(), filename, line); #endif // in interrupt context or idle task means kernel error // which will stop the OS // if in user space just terminate the task if (up_interrupt_context() || current_task->pid == 0) { panic("%s: %d\n", __func__, __LINE__); } else { exit(EXIT_FAILURE); } }
void up_assert(void) #endif { #if CONFIG_TASK_NAME_SIZE > 0 struct tcb_s *rtcb = this_task(); #endif board_autoled_on(LED_ASSERTION); #ifdef CONFIG_HAVE_FILENAME #if CONFIG_TASK_NAME_SIZE > 0 lldbg("Assertion failed at file:%s line: %d task: %s\n", filename, lineno, rtcb->name); #else lldbg("Assertion failed at file:%s line: %d\n", filename, lineno); #endif #else #if CONFIG_TASK_NAME_SIZE > 0 lldbg("Assertion failed: task: %s\n", rtcb->name); #else lldbg("Assertion failed\n"); #endif #endif up_stackdump(); up_registerdump(); #ifdef CONFIG_ARCH_USBDUMP /* Dump USB trace data */ (void)usbtrace_enumerate(assert_tracecallback, NULL); #endif #ifdef CONFIG_BOARD_CRASHDUMP board_crashdump(up_getsp(), this_task(), filename, lineno); #endif _up_assert(EXIT_FAILURE); }
void up_assert(const uint8_t *filename, int lineno) { #ifdef CONFIG_PRINT_TASKNAME struct tcb_s *rtcb = this_task(); #endif board_autoled_on(LED_ASSERTION); #ifdef CONFIG_PRINT_TASKNAME lldbg("Assertion failed at file:%s line: %d task: %s\n", filename, lineno, rtcb->name); #else lldbg("Assertion failed at file:%s line: %d\n", filename, lineno); #endif up_dumpstate(); #ifdef CONFIG_BOARD_CRASHDUMP board_crashdump(up_getsp(), this_task(), filename, lineno); #endif _up_assert(EXIT_FAILURE); }
static void up_dumpstate(void) { struct tcb_s *rtcb = this_task(); uint16_t sp = up_getsp(); uint16_t ustackbase; uint16_t ustacksize; #if CONFIG_ARCH_INTERRUPTSTACK > 3 uint16_t istackbase; uint16_t istacksize; #endif /* Get the limits on the user stack memory */ if (rtcb->pid == 0) { ustackbase = g_idle_topstack - 4; ustacksize = CONFIG_IDLETHREAD_STACKSIZE; } else { ustackbase = (uint16_t)rtcb->adj_stack_ptr; ustacksize = (uint16_t)rtcb->adj_stack_size; } /* Get the limits on the interrupt stack memory */ #if CONFIG_ARCH_INTERRUPTSTACK > 3 istackbase = (uint16_t)&g_intstackbase; istacksize = (CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4; /* Show interrupt stack info */ lldbg("sp: %04x\n", sp); lldbg("IRQ stack:\n"); lldbg(" base: %04x\n", istackbase); lldbg(" size: %04x\n", istacksize); /* Does the current stack pointer lie within the interrupt * stack? */ if (sp <= istackbase && sp > istackbase - istacksize) { /* Yes.. dump the interrupt stack */ up_stackdump(sp, istackbase); /* Extract the user stack pointer which should lie * at the base of the interrupt stack. */ sp = g_intstackbase; lldbg("sp: %04x\n", sp); } /* Show user stack info */ lldbg("User stack:\n"); lldbg(" base: %04x\n", ustackbase); lldbg(" size: %04x\n", ustacksize); #else lldbg("sp: %04x\n", sp); lldbg("stack base: %04x\n", ustackbase); lldbg("stack size: %04x\n", ustacksize); #endif /* Dump the user stack if the stack pointer lies within the allocated user * stack memory. */ if (sp > ustackbase || sp <= ustackbase - ustacksize) { #if !defined(CONFIG_ARCH_INTERRUPTSTACK) || CONFIG_ARCH_INTERRUPTSTACK < 4 lldbg("ERROR: Stack pointer is not within allocated stack\n"); #endif } else { up_stackdump(sp, ustackbase); } /* Then dump the registers (if available) */ up_registerdump(); #ifdef CONFIG_ARCH_USBDUMP /* Dump USB trace data */ (void)usbtrace_enumerate(assert_tracecallback, NULL); #endif }