1 /* 2 * Copyright (c) 2022, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 #include "cmsis.h" 8 #include "utilities.h" 9 /* "exception_info.h" must be the last include because of the IAR pragma */ 10 #include "exception_info.h" 11 C_HardFault_Handler(void)12void C_HardFault_Handler(void) 13 { 14 /* A HardFault may indicate corruption of secure state, so it is essential 15 * that Non-secure code does not regain control after one is raised. 16 * Returning from this exception could allow a pending NS exception to be 17 * taken, so the current solution is not to return. 18 */ 19 tfm_core_panic(); 20 } 21 HardFault_Handler(void)22__attribute__((naked)) void HardFault_Handler(void) 23 { 24 EXCEPTION_INFO(EXCEPTION_TYPE_HARDFAULT); 25 26 __ASM volatile( 27 "bl C_HardFault_Handler \n" 28 "b . \n" 29 ); 30 } 31 C_MemManage_Handler(void)32void C_MemManage_Handler(void) 33 { 34 /* A MemManage fault may indicate corruption of secure state, so it is 35 * essential that Non-secure code does not regain control after one is 36 * raised. Returning from this exception could allow a pending NS exception 37 * to be taken, so the current solution is to panic. 38 */ 39 tfm_core_panic(); 40 } 41 MemManage_Handler(void)42__attribute__((naked)) void MemManage_Handler(void) 43 { 44 EXCEPTION_INFO(EXCEPTION_TYPE_MEMFAULT); 45 46 __ASM volatile( 47 "bl C_MemManage_Handler \n" 48 "b . \n" 49 ); 50 } 51 C_BusFault_Handler(void)52void C_BusFault_Handler(void) 53 { 54 /* A BusFault may indicate corruption of secure state, so it is essential 55 * that Non-secure code does not regain control after one is raised. 56 * Returning from this exception could allow a pending NS exception to be 57 * taken, so the current solution is to panic. 58 */ 59 tfm_core_panic(); 60 } 61 BusFault_Handler(void)62__attribute__((naked)) void BusFault_Handler(void) 63 { 64 EXCEPTION_INFO(EXCEPTION_TYPE_BUSFAULT); 65 66 __ASM volatile( 67 "bl C_BusFault_Handler \n" 68 "b . \n" 69 ); 70 } 71 C_SecureFault_Handler(void)72void C_SecureFault_Handler(void) 73 { 74 /* A SecureFault may indicate corruption of secure state, so it is essential 75 * that Non-secure code does not regain control after one is raised. 76 * Returning from this exception could allow a pending NS exception to be 77 * taken, so the current solution is to panic. 78 */ 79 tfm_core_panic(); 80 } 81 SecureFault_Handler(void)82__attribute__((naked)) void SecureFault_Handler(void) 83 { 84 EXCEPTION_INFO(EXCEPTION_TYPE_SECUREFAULT); 85 86 __ASM volatile( 87 "bl C_SecureFault_Handler \n" 88 "b . \n" 89 ); 90 } 91 C_UsageFault_Handler(void)92void C_UsageFault_Handler(void) 93 { 94 tfm_core_panic(); 95 } 96 UsageFault_Handler(void)97__attribute__((naked)) void UsageFault_Handler(void) 98 { 99 EXCEPTION_INFO(EXCEPTION_TYPE_USAGEFAULT); 100 101 __ASM volatile( 102 "bl C_UsageFault_Handler \n" 103 "b . \n" 104 ); 105 } 106