2 * FreeRTOS Kernel V10.4.6
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT AND Apache-2.0
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
27 * Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
29 * Licensed under the Apache License, Version 2.0 (the "License");
30 * you may not use this file except in compliance with the License.
31 * You may obtain a copy of the License at
33 * http://www.apache.org/licenses/LICENSE-2.0
35 * Unless required by applicable law or agreed to in writing, software
36 * distributed under the License is distributed on an "AS IS" BASIS,
37 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38 * See the License for the specific language governing permissions and
39 * limitations under the License.
42 #include "xtensa_rtos.h"
43 #include "esp_idf_version.h"
44 #if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 2, 0))
45 #include "esp_panic.h"
47 #include "esp_private/panic_reason.h"
48 #endif /* ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 2, 0) */
49 #include "sdkconfig.h"
53 This file contains the default handlers for the high interrupt levels as well as some specialized exceptions.
54 The default behaviour is to just exit the interrupt or call the panic handler on the exceptions
59 .global xt_debugexception
60 .weak xt_debugexception
61 .set xt_debugexception, _xt_debugexception
63 .type _xt_debugexception,@function
67 movi a0,PANIC_RSN_DEBUGEXCEPTION
69 /* _xt_panic assumes a level 1 exception. As we're
70 crashing anyhow, copy EPC & EXCSAVE from DEBUGLEVEL
72 rsr a0,(EPC + XCHAL_DEBUGLEVEL)
74 rsr a0,(EXCSAVE + XCHAL_DEBUGLEVEL)
76 call0 _xt_panic /* does not return */
79 #endif /* Debug exception */
82 #if XCHAL_NUM_INTLEVELS >=2 && XCHAL_EXCM_LEVEL <2 && XCHAL_DEBUGLEVEL !=2
85 .set xt_highint2, _xt_highint2
87 .type _xt_highint2,@function
91 /* Default handler does nothing; just returns */
94 rsr a0, EXCSAVE_2 /* restore a0 */
99 #if XCHAL_NUM_INTLEVELS >=3 && XCHAL_EXCM_LEVEL <3 && XCHAL_DEBUGLEVEL !=3
103 .set xt_highint3, _xt_highint3
105 .type _xt_highint3,@function
109 /* Default handler does nothing; just returns */
113 rsr a0, EXCSAVE_3 /* restore a0 */
118 #if XCHAL_NUM_INTLEVELS >=4 && XCHAL_EXCM_LEVEL <4 && XCHAL_DEBUGLEVEL !=4
122 .set xt_highint4, _xt_highint4
124 .type _xt_highint4,@function
128 /* Default handler does nothing; just returns */
132 rsr a0, EXCSAVE_4 /* restore a0 */
137 #if XCHAL_NUM_INTLEVELS >=5 && XCHAL_EXCM_LEVEL <5 && XCHAL_DEBUGLEVEL !=5
141 .set xt_highint5, _xt_highint5
143 .type _xt_highint5,@function
147 /* Default handler does nothing; just returns */
151 rsr a0, EXCSAVE_5 /* restore a0 */
157 #if XCHAL_NUM_INTLEVELS >=6 && XCHAL_EXCM_LEVEL <6 && XCHAL_DEBUGLEVEL !=6
162 .set xt_highint6, _xt_highint6
164 .type _xt_highint6,@function
168 /* Default handler does nothing; just returns */
172 rsr a0, EXCSAVE_6 /* restore a0 */
184 .type _xt_nmi,@function
188 /* Default handler does nothing; just returns */
192 rsr a0, EXCSAVE + XCHAL_NMILEVEL /* restore a0 */