[PATCH] score: Split _Terminate and call _Terminate_CPU_Fatal_halt.

Chris Johns chrisj at rtems.org
Sun Apr 27 12:13:41 UTC 2014


Splitting the call to _CPU_Fatal_halt out into a separate function
allows the rtems-test gdb support the ability to halt once the
_Terminate function has completed it's work.

This change allows the BeagleBoard xM BSP to pass a number of
important tests.
---
 cpukit/score/include/rtems/score/basedefs.h | 14 +++++++++++++-
 cpukit/score/include/rtems/score/interr.h   | 18 ++++++++++++++++++
 cpukit/score/src/interr.c                   |  9 ++++++++-
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h
index a0bebdd..bab9a33 100644
--- a/cpukit/score/include/rtems/score/basedefs.h
+++ b/cpukit/score/include/rtems/score/basedefs.h
@@ -174,6 +174,18 @@
 #endif
 
 /**
+ *  The following defines a compiler specific attribute which makes a
+ *  function weak. Weak symbols can be overriden by normal symbols and
+ *  provide a way for users to override symbols that are weak.
+ */
+#ifdef __GNUC__
+  #define RTEMS_COMPILER_WEAK_ATTRIBUTE \
+     __attribute__ ((weak))
+#else
+  #define RTEMS_COMPILER_WEAK_ATTRIBUTE
+#endif
+
+/**
  *  Instructs the compiler to issue a warning whenever a variable or function
  *  with this attribute will be used.
  */
@@ -189,7 +201,7 @@
  *  This can occur when reading volatile device memory or skipping arguments
  *  in a variable argument method.
  */
-#if defined(__GNUC__)        
+#if defined(__GNUC__)
   #define RTEMS_COMPILER_UNUSED_ATTRIBUTE __attribute__((unused))
 #else
   #define RTEMS_COMPILER_UNUSED_ATTRIBUTE
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index 2100c13..0627a1f 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -217,6 +217,24 @@ void _Terminate(
   Internal_errors_t       the_error
 ) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
 
+/**
+ * @brief Invoke CPU fatal halt.
+ *
+ * The @ref _Terminate function's final step is to call this function and
+ * it invokes the CPU fatal halt code. The function's attribute is weak
+ * allowing a BSP the ability to override this function and provide a
+ * suitable reset.
+ *
+ * This function allows a test harness the ability to see the terminate
+ * function has completed.
+ *
+ * @param[in] the_error The fatal error code.  This value must be interpreted
+ * with respect to the source.
+ */
+void _Terminate_CPU_Fatal_halt(
+  Internal_errors_t the_error
+) RTEMS_COMPILER_WEAK_ATTRIBUTE;
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/cpukit/score/src/interr.c b/cpukit/score/src/interr.c
index 97ca3c7..48cd26b 100644
--- a/cpukit/score/src/interr.c
+++ b/cpukit/score/src/interr.c
@@ -28,6 +28,13 @@ System_state_Codes _System_state_Current;
 
 Internal_errors_Information _Internal_errors_What_happened;
 
+void _Terminate_CPU_Fatal_halt(
+  Internal_errors_t the_error
+)
+{
+  _CPU_Fatal_halt( the_error );
+}
+
 void _Terminate(
   Internal_errors_Source  the_source,
   bool                    is_internal,
@@ -49,7 +56,7 @@ void _Terminate(
 
   _System_state_Set( SYSTEM_STATE_TERMINATED );
 
-  _CPU_Fatal_halt( the_error );
+  _Terminate_CPU_Fatal_halt( the_error );
 
   /* will not return from this routine */
   while (true);
-- 
1.9.0




More information about the devel mailing list