source: rtems/bsps/shared/start/bspfatal-default.c @ 762fa62

5
Last change on this file since 762fa62 was 43bda786, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 17, 2018 at 4:18:02 AM

bsps: Move bspclean.c to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-1999.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#include <bsp.h>
11#include <bsp/bootcard.h>
12#include <rtems/bspIo.h>
13#include <rtems/version.h>
14#include <rtems/score/threadimpl.h>
15#include <inttypes.h>
16
17void bsp_fatal_extension(
18  rtems_fatal_source source,
19  bool always_set_to_false,
20  rtems_fatal_code code
21)
22{
23  #if BSP_VERBOSE_FATAL_EXTENSION
24    Thread_Control *executing;
25
26    printk(
27      "\n"
28      "*** FATAL ***\n"
29      "fatal source: %i (%s)\n",
30      source,
31      rtems_fatal_source_text( source )
32    );
33  #endif
34
35  #if (BSP_PRINT_EXCEPTION_CONTEXT) || BSP_VERBOSE_FATAL_EXTENSION
36    if ( source == RTEMS_FATAL_SOURCE_EXCEPTION ) {
37      rtems_exception_frame_print( (const rtems_exception_frame *) code );
38    }
39  #endif
40
41  #if BSP_VERBOSE_FATAL_EXTENSION
42    else if ( source == INTERNAL_ERROR_CORE ) {
43      printk(
44        "fatal code: %ju (%s)\n",
45        (uintmax_t) code,
46        rtems_internal_error_text( code )
47      );
48    } else {
49      printk(
50        "fatal code: %ju (0x%08jx)\n",
51        (uintmax_t) code,
52        (uintmax_t) code
53      );
54    }
55
56    printk(
57      "RTEMS version: %s\n"
58      "RTEMS tools: %s\n",
59      rtems_version(),
60      __VERSION__
61    );
62
63    executing = _Thread_Get_executing();
64
65    if ( executing != NULL ) {
66      char name[ 32 ];
67
68      _Thread_Get_name( executing, name, sizeof( name ) );
69      printk(
70        "executing thread ID: 0x08%" PRIx32 "\n"
71        "executing thread name: %s\n",
72        executing->Object.id,
73        name
74      );
75    } else {
76      printk( "executing thread is NULL\n" );
77    }
78  #endif
79
80  #if (BSP_PRESS_KEY_FOR_RESET)
81    printk( "\nFATAL ERROR - Executive shutdown! Any key to reboot..." );
82
83    /*
84     * Wait for a key to be pressed
85     */
86    while ( getchark() == -1 )
87      ;
88
89    printk("\n");
90  #endif
91
92  /*
93   *  Check both conditions -- if you want to ask for reboot, then
94   *  you must have meant to reset the board.
95   */
96  #if (BSP_PRESS_KEY_FOR_RESET) || (BSP_RESET_BOARD_AT_EXIT)
97    bsp_reset();
98  #endif
99}
Note: See TracBrowser for help on using the repository browser.