From 86a80ee1af0fedb3b575ae95db7e80f80d46b533 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 21 Nov 2017 13:30:26 +0100 Subject: 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. --- c/src/aclocal/bsp-bspcleanup-options.m4 | 7 ++++++- c/src/lib/libbsp/shared/bspclean.c | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/c/src/aclocal/bsp-bspcleanup-options.m4 b/c/src/aclocal/bsp-bspcleanup-options.m4 index 1c2ac586b1..60be886070 100644 --- a/c/src/aclocal/bsp-bspcleanup-options.m4 +++ b/c/src/aclocal/bsp-bspcleanup-options.m4 @@ -21,4 +21,9 @@ RTEMS_BSPOPTS_HELP([BSP_RESET_BOARD_AT_EXIT], RTEMS_BSPOPTS_SET([BSP_PRINT_EXCEPTION_CONTEXT],[*],[1]) RTEMS_BSPOPTS_HELP([BSP_PRINT_EXCEPTION_CONTEXT], [If defined to a non-zero value, prints the exception context when an -unexpected exception occurs.])]) +unexpected exception occurs.]) + +RTEMS_BSPOPTS_SET([BSP_VERBOSE_FATAL_EXTENSION],[*],[1]) +RTEMS_BSPOPTS_HELP([BSP_VERBOSE_FATAL_EXTENSION], +[If defined to a non-zero value, prints the some information in case of a fatal +error.])]) diff --git a/c/src/lib/libbsp/shared/bspclean.c b/c/src/lib/libbsp/shared/bspclean.c index e045512da0..bae9d21889 100644 --- a/c/src/lib/libbsp/shared/bspclean.c +++ b/c/src/lib/libbsp/shared/bspclean.c @@ -10,6 +10,7 @@ #include #include #include +#include void bsp_fatal_extension( rtems_fatal_source source, @@ -17,7 +18,24 @@ void bsp_fatal_extension( rtems_fatal_code code ) { - #if (BSP_PRINT_EXCEPTION_CONTEXT) + #if BSP_VERBOSE_FATAL_EXTENSION + printk( + "\n" + "*** FATAL ***\n" + "fatal source: %i (%s)\n" + "fatal code: %ju (0x%08jx)\n" + "RTEMS version: %s\n" + "RTEMS tools: %s\n", + source, + rtems_fatal_source_text( source ), + (uintmax_t) code, + (uintmax_t) code, + rtems_version(), + __VERSION__ + ); + #endif + + #if (BSP_PRINT_EXCEPTION_CONTEXT) || BSP_VERBOSE_FATAL_EXTENSION if ( source == RTEMS_FATAL_SOURCE_EXCEPTION ) { rtems_exception_frame_print( (const rtems_exception_frame *) code ); } -- cgit v1.2.3