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