void _BSP_Fatal_error(unsigned int v) { unsigned long flags; const char *err = 0; rtems_interrupt_disable(flags); (void) flags; /* avoid set but not used warning */ printk("%s\n",_RTEMS_version); printk("FATAL ERROR:\n"); printk("Environment:"); switch (THESRC) { case INTERNAL_ERROR_CORE: printk(" RTEMS Core\n"); err = rtems_internal_error_text(THEERR); break; case INTERNAL_ERROR_RTEMS_API: printk(" RTEMS API\n"); err = rtems_status_text(THEERR); break; case INTERNAL_ERROR_POSIX_API: printk(" POSIX API (errno)\n"); /* could use strerror but I'd rather avoid using this here */ break; default: printk(" UNKNOWN (0x%x)\n",THESRC); break; } if ( _Thread_Dispatch_is_enabled() ) printk("enabled\n"); else printk( " Error occurred in a Thread Dispatching DISABLED context (level %i)\n", _Thread_Dispatch_get_disable_level()); if ( _ISR_Nest_level ) { printk( " Error occurred from ISR context (ISR nest level %i)\n", _ISR_Nest_level ); } printk("Error %d",THEERR); if (err) { printk(": %s",err); } printk("\n"); printk("Stack Trace:\n"); CPU_print_stack(); rebootQuestion(); }
void Put_Error( uint32_t source, uint32_t error ) { if ( source == INTERNAL_ERROR_CORE ) { printk( rtems_internal_error_text( error ) ); } else if (source == INTERNAL_ERROR_RTEMS_API ){ if (error > RTEMS_NOT_IMPLEMENTED ) printk("Unknown Internal Rtems Error (0x%08x)", error); else printk( "%s", rtems_status_text( error ) ); } }
void Put_Error( uint32_t source, uint32_t error ) { if ( source == INTERNAL_ERROR_CORE ) { printk( rtems_internal_error_text( error ) ); } else if (source == INTERNAL_ERROR_RTEMS_API ){ if (error > RTEMS_NOT_IMPLEMENTED ) printk("Unknown Internal Rtems Error (%d)", error); else printk( "%s", rtems_status_text( error ) ); } else if (source == INTERNAL_ERROR_POSIX_API ) { printk( "SOURCE=%d ERROR=%d %s", source, error, strerror( error ) ); } }
static void test_internal_error_text(void) { rtems_fatal_code error = 0; const char *text = NULL; const char *text_last; do { text_last = text; text = rtems_internal_error_text( error ); ++error; puts( text ); } while ( text != text_last ); rtems_test_assert( error - 3 == INTERNAL_ERROR_RESOURCE_IN_USE ); }
static void test_internal_error_text(void) { rtems_fatal_code error = 0; const char *text = NULL; const char *text_last; do { text_last = text; text = rtems_internal_error_text( error ); ++error; puts( text ); } while ( text != text_last ); rtems_test_assert( error - 3 == INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL ); }