blob: 8c15a84501d6e3eb61154b0af5c1f72e5d2f22bb [file] [log] [blame]
Ken Liu2e434892022-02-16 12:10:16 +08001/*
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
10__attribute__((naked)) void HardFault_Handler(void)
11{
12 EXCEPTION_INFO(EXCEPTION_TYPE_HARDFAULT);
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 __ASM volatile("b .");
20}
21
22__attribute__((naked)) void MemManage_Handler(void)
23{
24 EXCEPTION_INFO(EXCEPTION_TYPE_MEMFAULT);
25
26 /* A MemManage fault may indicate corruption of secure state, so it is
27 * essential that Non-secure code does not regain control after one is
28 * raised. Returning from this exception could allow a pending NS exception
29 * to be taken, so the current solution is not to return.
30 */
31 __ASM volatile("b .");
32}
33
34__attribute__((naked)) void BusFault_Handler(void)
35{
36 EXCEPTION_INFO(EXCEPTION_TYPE_BUSFAULT);
37
38 /* A BusFault may indicate corruption of secure state, so it is essential
39 * that Non-secure code does not regain control after one is raised.
40 * Returning from this exception could allow a pending NS exception to be
41 * taken, so the current solution is not to return.
42 */
43 __ASM volatile("b .");
44}
45
46__attribute__((naked)) void SecureFault_Handler(void)
47{
48 EXCEPTION_INFO(EXCEPTION_TYPE_SECUREFAULT);
49
50 /* A SecureFault may indicate corruption of secure state, so it is essential
51 * that Non-secure code does not regain control after one is raised.
52 * Returning from this exception could allow a pending NS exception to be
53 * taken, so the current solution is not to return.
54 */
55 __ASM volatile("b .");
56}
57
58__attribute__((naked)) void UsageFault_Handler(void)
59{
60 EXCEPTION_INFO(EXCEPTION_TYPE_USAGEFAULT);
61 __ASM volatile("b .");
62}