source: rtems/c/src/lib/libbsp/shared/bspclean.c @ 86a80ee1

5
Last change on this file since 86a80ee1 was 86a80ee1, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 21, 2017 at 12:30:26 PM

bsps: Add BSP_VERBOSE_FATAL_EXTENSION

Add BSP_VERBOSE_FATAL_EXTENSION to RTEMS_BSP_CLEANUP_OPTIONS to
optionally print the RTEMS version, the fatal source and the fatal code
in the shared bsp_fatal_extension().

Close #3248.

  • Property mode set to 100644
File size: 1.4 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
15void bsp_fatal_extension(
16  rtems_fatal_source source,
17  bool always_set_to_false,
18  rtems_fatal_code code
19)
20{
21  #if BSP_VERBOSE_FATAL_EXTENSION
22    printk(
23      "\n"
24      "*** FATAL ***\n"
25      "fatal source: %i (%s)\n"
26      "fatal code: %ju (0x%08jx)\n"
27      "RTEMS version: %s\n"
28      "RTEMS tools: %s\n",
29      source,
30      rtems_fatal_source_text( source ),
31      (uintmax_t) code,
32      (uintmax_t) code,
33      rtems_version(),
34      __VERSION__
35    );
36  #endif
37
38  #if (BSP_PRINT_EXCEPTION_CONTEXT) || BSP_VERBOSE_FATAL_EXTENSION
39    if ( source == RTEMS_FATAL_SOURCE_EXCEPTION ) {
40      rtems_exception_frame_print( (const rtems_exception_frame *) code );
41    }
42  #endif
43
44  #if (BSP_PRESS_KEY_FOR_RESET)
45    printk( "\nFATAL ERROR - Executive shutdown! Any key to reboot..." );
46
47    /*
48     * Wait for a key to be pressed
49     */
50    while ( getchark() == -1 )
51      ;
52
53    printk("\n");
54  #endif
55
56  /*
57   *  Check both conditions -- if you want to ask for reboot, then
58   *  you must have meant to reset the board.
59   */
60  #if (BSP_PRESS_KEY_FOR_RESET) || (BSP_RESET_BOARD_AT_EXIT)
61    bsp_reset();
62  #endif
63}
Note: See TracBrowser for help on using the repository browser.