]> begriffs open source - cmsis/blob - CMSIS/CoreValidation/Tests/main.c
CoreValidation: Fixed/enhanced core and intrinsic function tests.
[cmsis] / CMSIS / CoreValidation / Tests / main.c
1 /*----------------------------------------------------------------------------
2  * Name:    main.c
3  *----------------------------------------------------------------------------*/
4
5 /* Includes ------------------------------------------------------------------*/
6
7 #include <stdio.h>
8 #include <stdlib.h>
9
10 #include "RTE_Components.h"
11 #include  CMSIS_device_header
12  
13 #ifdef RTE_Compiler_EventRecorder
14 #include "EventRecorder.h"
15 #endif
16
17 #include "cmsis_cv.h"
18
19 //lint -e970 allow using int for main
20
21 /* Private functions ---------------------------------------------------------*/
22 int main (void);
23
24 /**
25   * @brief  Main program
26   * @param  None
27   * @retval None
28   */
29 int main (void)
30 {  
31
32   // System Initialization
33   SystemCoreClockUpdate();
34 #ifdef RTE_Compiler_EventRecorder
35   // Initialize and start Event Recorder
36   (void)EventRecorderInitialize(EventRecordError, 1U);
37   (void)EventRecorderEnable    (EventRecordAll, 0xFEU, 0xFEU);
38 #endif
39   
40   cmsis_cv();
41   
42   #ifdef __MICROLIB
43   for(;;) {}
44   #else
45   exit(0);
46   #endif
47 }
48
49 #if defined(__CORTEX_A)
50 #include "irq_ctrl.h"
51 #if (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || \
52         (defined ( __GNUC__ ))
53 __attribute__((interrupt("IRQ")))
54 #elif defined ( __CC_ARM )
55 __irq
56 #elif defined ( __ICCARM__ )
57 __irq __arm
58 #else
59 #error "Unsupported compiler!"
60 #endif
61 void IRQ_Handler(void) {
62   const IRQn_ID_t irqn = IRQ_GetActiveIRQ();
63   IRQHandler_t const handler = IRQ_GetHandler(irqn);
64   if (handler != NULL) {
65     __enable_irq();
66     handler();
67     __disable_irq();
68   }
69   IRQ_EndOfInterrupt(irqn);
70 }
71 #endif