]> begriffs open source - freertos/blob - portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vector_defaults.S
[AUTO][RELEASE]: Bump file header version to "10.4.6"
[freertos] / portable / ThirdParty / GCC / Xtensa_ESP32 / xtensa_vector_defaults.S
1 /*
2  * FreeRTOS Kernel V10.4.6
3  * Copyright (C) 2021 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT AND Apache-2.0
6  *
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:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
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.
23  *
24  * https://www.FreeRTOS.org
25  * https://github.com/FreeRTOS
26  *
27  * Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
28  *
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
32  *
33  *     http://www.apache.org/licenses/LICENSE-2.0
34  *
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.
40  */
41
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"
46 #else
47 #include "esp_private/panic_reason.h"
48 #endif /* ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 2, 0) */
49 #include "sdkconfig.h"
50 #include "soc/soc.h"
51
52 /*
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
55 */
56
57
58 #if XCHAL_HAVE_DEBUG
59     .global    xt_debugexception
60     .weak xt_debugexception
61     .set xt_debugexception, _xt_debugexception
62     .section .iram1,"ax"
63     .type       _xt_debugexception,@function
64     .align      4
65
66 _xt_debugexception:
67     movi    a0,PANIC_RSN_DEBUGEXCEPTION
68     wsr     a0,EXCCAUSE
69     /* _xt_panic assumes a level 1 exception. As we're
70        crashing anyhow, copy EPC & EXCSAVE from DEBUGLEVEL
71        to level 1. */
72     rsr     a0,(EPC + XCHAL_DEBUGLEVEL)
73     wsr     a0,EPC_1
74     rsr     a0,(EXCSAVE + XCHAL_DEBUGLEVEL)
75     wsr     a0,EXCSAVE_1
76     call0   _xt_panic                       /* does not return */
77     rfi     XCHAL_DEBUGLEVEL
78
79 #endif /* Debug exception */
80
81
82 #if XCHAL_NUM_INTLEVELS >=2 && XCHAL_EXCM_LEVEL <2 && XCHAL_DEBUGLEVEL !=2
83     .global    xt_highint2
84     .weak xt_highint2
85     .set xt_highint2, _xt_highint2
86     .section .iram1,"ax"
87     .type       _xt_highint2,@function
88     .align      4
89 _xt_highint2:
90
91     /* Default handler does nothing; just returns */
92     .align  4
93 .L_xt_highint2_exit:
94     rsr     a0, EXCSAVE_2                   /* restore a0 */
95     rfi     2
96
97 #endif  /* Level 2 */
98
99 #if XCHAL_NUM_INTLEVELS >=3 && XCHAL_EXCM_LEVEL <3 && XCHAL_DEBUGLEVEL !=3
100
101     .global    xt_highint3
102     .weak xt_highint3
103     .set xt_highint3, _xt_highint3
104     .section .iram1,"ax"
105     .type       _xt_highint3,@function
106     .align      4
107 _xt_highint3:
108
109     /* Default handler does nothing; just returns */
110
111     .align  4
112 .L_xt_highint3_exit:
113     rsr     a0, EXCSAVE_3                   /* restore a0 */
114     rfi     3
115
116 #endif  /* Level 3 */
117
118 #if XCHAL_NUM_INTLEVELS >=4 && XCHAL_EXCM_LEVEL <4 && XCHAL_DEBUGLEVEL !=4
119
120     .global    xt_highint4
121     .weak xt_highint4
122     .set xt_highint4, _xt_highint4
123     .section .iram1,"ax"
124     .type       _xt_highint4,@function
125     .align      4
126 _xt_highint4:
127
128     /* Default handler does nothing; just returns */
129
130     .align  4
131 .L_xt_highint4_exit:
132     rsr     a0, EXCSAVE_4                   /* restore a0 */
133     rfi     4
134
135 #endif  /* Level 4 */
136
137 #if XCHAL_NUM_INTLEVELS >=5 && XCHAL_EXCM_LEVEL <5 && XCHAL_DEBUGLEVEL !=5
138
139     .global    xt_highint5
140     .weak xt_highint5
141     .set xt_highint5, _xt_highint5
142     .section .iram1,"ax"
143     .type       _xt_highint5,@function
144     .align      4
145 _xt_highint5:
146
147     /* Default handler does nothing; just returns */
148
149     .align  4
150 .L_xt_highint5_exit:
151     rsr     a0, EXCSAVE_5                   /* restore a0 */
152     rfi     5
153
154
155 #endif  /* Level 5 */
156
157 #if XCHAL_NUM_INTLEVELS >=6 && XCHAL_EXCM_LEVEL <6 && XCHAL_DEBUGLEVEL !=6
158
159     .global    _xt_highint6
160     .global    xt_highint6
161     .weak xt_highint6
162     .set xt_highint6, _xt_highint6
163     .section .iram1,"ax"
164     .type       _xt_highint6,@function
165     .align      4
166 _xt_highint6:
167
168     /* Default handler does nothing; just returns */
169
170     .align  4
171 .L_xt_highint6_exit:
172     rsr     a0, EXCSAVE_6                   /* restore a0 */
173     rfi     6
174
175 #endif  /* Level 6 */
176
177 #if XCHAL_HAVE_NMI
178
179     .global    _xt_nmi
180     .global    xt_nmi
181     .weak xt_nmi
182     .set xt_nmi, _xt_nmi
183     .section .iram1,"ax"
184     .type       _xt_nmi,@function
185     .align      4
186 _xt_nmi:
187
188     /* Default handler does nothing; just returns */
189
190     .align  4
191 .L_xt_nmi_exit:
192     rsr     a0, EXCSAVE + XCHAL_NMILEVEL    /* restore a0 */
193     rfi     XCHAL_NMILEVEL
194
195 #endif  /* NMI */
196