2 * Copyright (C) 2022 ARM Limited or its affiliates. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 #include "RTE_Components.h"
23 #include CMSIS_device_header
25 #ifdef RTE_Compiler_EventRecorder
26 #include "EventRecorder.h"
30 #include "CV_Report.h"
32 //lint -e970 allow using int for main
37 // System Initialization
38 SystemCoreClockUpdate();
40 #ifdef RTE_Compiler_EventRecorder
41 // Initialize and start Event Recorder
42 (void)EventRecorderInitialize(EventRecordError, 1U);
43 (void)EventRecorderEnable(EventRecordAll, 0xFEU, 0xFEU);
55 #if defined(__CORTEX_A)
58 #if (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || \
59 (defined ( __GNUC__ ))
60 #define __IRQ __attribute__((interrupt("IRQ")))
61 #elif defined ( __CC_ARM )
63 #elif defined ( __ICCARM__ )
64 #define __IRQ __irq __arm
66 #error "Unsupported compiler!"
71 void IRQ_Handler(void);
73 void IRQ_Handler(void) {
74 const IRQn_ID_t irqn = IRQ_GetActiveIRQ();
75 IRQHandler_t const handler = IRQ_GetHandler(irqn);
76 if (handler != NULL) {
81 IRQ_EndOfInterrupt(irqn);
85 void Undef_Handler (void);
87 void Undef_Handler (void) {
88 cmsis_cv_abort(__FILENAME__, __LINE__, "Undefined Instruction!");
93 void SVC_Handler (void);
95 void SVC_Handler (void) {
99 void PAbt_Handler (void);
101 void PAbt_Handler (void) {
102 cmsis_cv_abort(__FILENAME__, __LINE__, "Prefetch Abort!");
107 void DAbt_Handler (void);
109 void DAbt_Handler (void) {
110 cmsis_cv_abort(__FILENAME__, __LINE__, "Data Abort!");
115 void FIQ_Handler (void);
117 void FIQ_Handler (void) {
121 #if defined(__CORTEX_M)
123 void HardFault_Handler(void);
125 void HardFault_Handler(void) {
126 cmsis_cv_abort(__FILENAME__, __LINE__, "HardFault!");