[PATCH 5/5] bsps: Add BSP_VERBOSE_FATAL_EXTENSION

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Nov 21 14:14:22 UTC 2017


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 <bsp.h>
 #include <bsp/bootcard.h>
 #include <rtems/bspIo.h>
+#include <rtems/version.h>
 
 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 );
     }
-- 
2.12.3




More information about the devel mailing list