Jelajahi Sumber

CoreValidation: Implemented all unhandled exceptions to abort the test run
... with a proper error message.

Change-Id: I1e6ef40991cb8805add4c0b9a75a1149dcea5e57

Jonatan Antoni 7 tahun lalu
induk
melakukan
7cd9150812

+ 1 - 0
CMSIS/CoreValidation/Include/cmsis_cv.h

@@ -24,6 +24,7 @@ extern void (*TST_IRQHandler)(void);
 
 // Test main function
 extern void cmsis_cv (void);
+extern void cmsis_cv_abort (const char *fn, uint32_t ln, char *desc);
 
 // Test cases
 extern void TC_CoreInstr_NOP (void);

+ 7 - 0
CMSIS/CoreValidation/Source/CV_Framework.c

@@ -91,6 +91,13 @@ void cmsis_cv (void) {
   ts_cmsis_cv();
 }
 
+void cmsis_cv_abort (const char *fn, uint32_t ln, char *desc) {
+  (void)__set_result(fn, ln, FAILED, desc);
+  (void)ritf.Close_TC();
+  (void)ritf.Close();
+  closeDebug();
+}
+
 /**
 @}
 */ 

+ 34 - 3
CMSIS/CoreValidation/Tests/main.c

@@ -15,6 +15,7 @@
 #endif
 
 #include "cmsis_cv.h"
+#include "CV_Report.h"
 
 //lint -e970 allow using int for main
 
@@ -48,16 +49,19 @@ int main (void)
 
 #if defined(__CORTEX_A)
 #include "irq_ctrl.h"
+
 #if (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || \
   (defined ( __GNUC__ ))
-__attribute__((interrupt("IRQ")))
+#define __IRQ __attribute__((interrupt("IRQ")))
 #elif defined ( __CC_ARM )
-__irq
+#define __IRQ __irq
 #elif defined ( __ICCARM__ )
-__irq __arm
+#define __IRQ __irq __arm
 #else
 #error "Unsupported compiler!"
 #endif
+
+__IRQ
 void IRQ_Handler(void) {
   const IRQn_ID_t irqn = IRQ_GetActiveIRQ();
   IRQHandler_t const handler = IRQ_GetHandler(irqn);
@@ -68,12 +72,39 @@ void IRQ_Handler(void) {
   }
   IRQ_EndOfInterrupt(irqn);
 }
+
+__IRQ
+void Undef_Handler (void) {
+  cmsis_cv_abort(__FILENAME__, __LINE__, "Undefined Instruction!");
+  exit(0);
+}
+
+__IRQ
+void SVC_Handler   (void) {
+}
+
+__IRQ
+void PAbt_Handler  (void) {
+  cmsis_cv_abort(__FILENAME__, __LINE__, "Prefetch Abort!");
+  exit(0);
+}
+
+__IRQ
+void DAbt_Handler  (void) {
+  cmsis_cv_abort(__FILENAME__, __LINE__, "Data Abort!");
+  exit(0);
+}
+
+__IRQ
+void FIQ_Handler   (void) {
+}
 #endif
 
 #if defined(__CORTEX_M)
 __NO_RETURN
 extern void HardFault_Handler(void);
 void HardFault_Handler(void) {
+  cmsis_cv_abort(__FILENAME__, __LINE__, "HardFault!");
   #ifdef __MICROLIB
   for(;;) {}
   #else