blob: d3a61e5ba8089333174d60fb05b5ca5fe716bc87 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001/*
2 * Copyright (c) 2012 Travis Geiselbrecht
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files
6 * (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge,
8 * publish, distribute, sublicense, and/or sell copies of the Software,
9 * and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23#include <debug.h>
24#include <compiler.h>
25#include <stm32f2xx.h>
26#include <arch/arm/cm.h>
27#include <platform/stm32.h>
28#include <target/debugconfig.h>
29#include <lib/cbuf.h>
30
31/* un-overridden irq handler */
32void stm32_dummy_irq(void)
33{
34 arm_cm_irq_entry();
35
36 panic("unhandled irq\n");
37}
38
39/* a list of default handlers that are simply aliases to the dummy handler */
40#define DEFAULT_HANDLER(x) \
41void stm32_##x(void) __WEAK_ALIAS("stm32_dummy_irq");
42
43DEFAULT_HANDLER(WWDG_IRQ);
44DEFAULT_HANDLER(PVD_IRQ);
45DEFAULT_HANDLER(TAMP_STAMP_IRQ);
46DEFAULT_HANDLER(RTC_WKUP_IRQ);
47DEFAULT_HANDLER(FLASH_IRQ);
48DEFAULT_HANDLER(RCC_IRQ);
49DEFAULT_HANDLER(EXTI0_IRQ);
50DEFAULT_HANDLER(EXTI1_IRQ);
51DEFAULT_HANDLER(EXTI2_IRQ);
52DEFAULT_HANDLER(EXTI3_IRQ);
53DEFAULT_HANDLER(EXTI4_IRQ);
54
55DEFAULT_HANDLER(DMA1_Stream0_IRQ);
56DEFAULT_HANDLER(DMA1_Stream1_IRQ);
57DEFAULT_HANDLER(DMA1_Stream2_IRQ);
58DEFAULT_HANDLER(DMA1_Stream3_IRQ);
59DEFAULT_HANDLER(DMA1_Stream4_IRQ);
60DEFAULT_HANDLER(DMA1_Stream5_IRQ);
61DEFAULT_HANDLER(DMA1_Stream6_IRQ);
62
63DEFAULT_HANDLER(ADC_IRQ);
64DEFAULT_HANDLER(CAN1_TX_IRQ);
65DEFAULT_HANDLER(CAN1_RX0_IRQ);
66DEFAULT_HANDLER(CAN1_RX1_IRQ);
67DEFAULT_HANDLER(CAN1_SCE_IRQ);
68DEFAULT_HANDLER(EXTI9_5_IRQ);
69
70DEFAULT_HANDLER(TIM1_BRK_TIM9_IRQ);
71DEFAULT_HANDLER(TIM1_UP_TIM10_IRQ);
72DEFAULT_HANDLER(TIM1_TRG_COM_TIM11_IRQ);
73DEFAULT_HANDLER(TIM1_CC_IRQ);
74DEFAULT_HANDLER(TIM2_IRQ);
75DEFAULT_HANDLER(TIM3_IRQ);
76DEFAULT_HANDLER(TIM4_IRQ);
77
78DEFAULT_HANDLER(I2C1_EV_IRQ);
79DEFAULT_HANDLER(I2C1_ER_IRQ);
80DEFAULT_HANDLER(I2C2_EV_IRQ);
81DEFAULT_HANDLER(I2C2_ER_IRQ);
82
83DEFAULT_HANDLER(SPI1_IRQ);
84DEFAULT_HANDLER(SPI2_IRQ);
85
86DEFAULT_HANDLER(USART1_IRQ);
87DEFAULT_HANDLER(USART2_IRQ);
88DEFAULT_HANDLER(USART3_IRQ);
89
90DEFAULT_HANDLER(EXTI15_10_IRQ);
91DEFAULT_HANDLER(RTC_Alarm_IRQ);
92DEFAULT_HANDLER(OTG_FS_WKUP_IRQ);
93DEFAULT_HANDLER(TIM8_BRK_TIM12_IRQ);
94DEFAULT_HANDLER(TIM8_UP_TIM13_IRQ);
95DEFAULT_HANDLER(TIM8_TRG_COM_TIM14_IRQ);
96DEFAULT_HANDLER(TIM8_CC_IRQ);
97DEFAULT_HANDLER(DMA1_Stream7_IRQ);
98DEFAULT_HANDLER(FSMC_IRQ);
99DEFAULT_HANDLER(SDIO_IRQ);
100DEFAULT_HANDLER(TIM5_IRQ);
101DEFAULT_HANDLER(SPI3_IRQ);
102DEFAULT_HANDLER(UART4_IRQ);
103DEFAULT_HANDLER(UART5_IRQ);
104DEFAULT_HANDLER(TIM6_DAC_IRQ);
105DEFAULT_HANDLER(TIM7_IRQ);
106
107DEFAULT_HANDLER(DMA2_Stream0_IRQ);
108DEFAULT_HANDLER(DMA2_Stream1_IRQ);
109DEFAULT_HANDLER(DMA2_Stream2_IRQ);
110DEFAULT_HANDLER(DMA2_Stream3_IRQ);
111DEFAULT_HANDLER(DMA2_Stream4_IRQ);
112
113DEFAULT_HANDLER(ETH_IRQ);
114DEFAULT_HANDLER(ETH_WKUP_IRQ);
115DEFAULT_HANDLER(CAN2_TX_IRQ);
116DEFAULT_HANDLER(CAN2_RX0_IRQ);
117DEFAULT_HANDLER(CAN2_RX1_IRQ);
118DEFAULT_HANDLER(CAN2_SCE_IRQ);
119DEFAULT_HANDLER(OTG_FS_IRQ);
120DEFAULT_HANDLER(DMA2_Stream5_IRQ);
121DEFAULT_HANDLER(DMA2_Stream6_IRQ);
122DEFAULT_HANDLER(DMA2_Stream7_IRQ);
123DEFAULT_HANDLER(USART6_IRQ);
124DEFAULT_HANDLER(I2C3_EV_IRQ);
125DEFAULT_HANDLER(I2C3_ER_IRQ);
126DEFAULT_HANDLER(OTG_HS_EP1_OUT_IRQ);
127DEFAULT_HANDLER(OTG_HS_EP1_IN_IRQ);
128DEFAULT_HANDLER(OTG_HS_WKUP_IRQ);
129DEFAULT_HANDLER(OTG_HS_IRQ);
130DEFAULT_HANDLER(DCMI_IRQ);
131DEFAULT_HANDLER(CRYP_IRQ);
132DEFAULT_HANDLER(HASH_RNG_IRQ);
133
134#define VECTAB_ENTRY(x) [x##n] = stm32_##x
135
136/* appended to the end of the main vector table */
137const void * const __SECTION(".text.boot.vectab2") vectab2[] = {
138 VECTAB_ENTRY(WWDG_IRQ), /* Window WatchDog Interrupt */
139 VECTAB_ENTRY(PVD_IRQ), /* PVD through EXTI Line detection Interrupt */
140 VECTAB_ENTRY(TAMP_STAMP_IRQ), /* Tamper and TimeStamp interrupts through the EXTI line */
141 VECTAB_ENTRY(RTC_WKUP_IRQ), /* RTC Wakeup interrupt through the EXTI line */
142 VECTAB_ENTRY(FLASH_IRQ), /* FLASH global Interrupt */
143 VECTAB_ENTRY(RCC_IRQ), /* RCC global Interrupt */
144 VECTAB_ENTRY(EXTI0_IRQ), /* EXTI Line0 Interrupt */
145 VECTAB_ENTRY(EXTI1_IRQ), /* EXTI Line1 Interrupt */
146 VECTAB_ENTRY(EXTI2_IRQ), /* EXTI Line2 Interrupt */
147 VECTAB_ENTRY(EXTI3_IRQ), /* EXTI Line3 Interrupt */
148 VECTAB_ENTRY(EXTI4_IRQ), /* EXTI Line4 Interrupt */
149 VECTAB_ENTRY(DMA1_Stream0_IRQ), /* DMA1 Stream 0 global Interrupt */
150 VECTAB_ENTRY(DMA1_Stream1_IRQ), /* DMA1 Stream 1 global Interrupt */
151 VECTAB_ENTRY(DMA1_Stream2_IRQ), /* DMA1 Stream 2 global Interrupt */
152 VECTAB_ENTRY(DMA1_Stream3_IRQ), /* DMA1 Stream 3 global Interrupt */
153 VECTAB_ENTRY(DMA1_Stream4_IRQ), /* DMA1 Stream 4 global Interrupt */
154 VECTAB_ENTRY(DMA1_Stream5_IRQ), /* DMA1 Stream 5 global Interrupt */
155 VECTAB_ENTRY(DMA1_Stream6_IRQ), /* DMA1 Stream 6 global Interrupt */
156 VECTAB_ENTRY(ADC_IRQ), /* ADC1, ADC2 and ADC3 global Interrupts */
157 VECTAB_ENTRY(CAN1_TX_IRQ), /* CAN1 TX Interrupt */
158 VECTAB_ENTRY(CAN1_RX0_IRQ), /* CAN1 RX0 Interrupt */
159 VECTAB_ENTRY(CAN1_RX1_IRQ), /* CAN1 RX1 Interrupt */
160 VECTAB_ENTRY(CAN1_SCE_IRQ), /* CAN1 SCE Interrupt */
161 VECTAB_ENTRY(EXTI9_5_IRQ), /* External Line[9:5] Interrupts */
162 VECTAB_ENTRY(TIM1_BRK_TIM9_IRQ), /* TIM1 Break interrupt and TIM9 global interrupt */
163 VECTAB_ENTRY(TIM1_UP_TIM10_IRQ), /* TIM1 Update Interrupt and TIM10 global interrupt */
164 VECTAB_ENTRY(TIM1_TRG_COM_TIM11_IRQ), /* TIM1 Trigger and Commutation Interrupt and TIM11 global interrupt */
165 VECTAB_ENTRY(TIM1_CC_IRQ), /* TIM1 Capture Compare Interrupt */
166 VECTAB_ENTRY(TIM2_IRQ), /* TIM2 global Interrupt */
167 VECTAB_ENTRY(TIM3_IRQ), /* TIM3 global Interrupt */
168 VECTAB_ENTRY(TIM4_IRQ), /* TIM4 global Interrupt */
169 VECTAB_ENTRY(I2C1_EV_IRQ), /* I2C1 Event Interrupt */
170 VECTAB_ENTRY(I2C1_ER_IRQ), /* I2C1 Error Interrupt */
171 VECTAB_ENTRY(I2C2_EV_IRQ), /* I2C2 Event Interrupt */
172 VECTAB_ENTRY(I2C2_ER_IRQ), /* I2C2 Error Interrupt */
173 VECTAB_ENTRY(SPI1_IRQ), /* SPI1 global Interrupt */
174 VECTAB_ENTRY(SPI2_IRQ), /* SPI2 global Interrupt */
175 VECTAB_ENTRY(USART1_IRQ), /* USART1 global Interrupt */
176 VECTAB_ENTRY(USART2_IRQ), /* USART2 global Interrupt */
177 VECTAB_ENTRY(USART3_IRQ), /* USART3 global Interrupt */
178 VECTAB_ENTRY(EXTI15_10_IRQ), /* External Line[15:10] Interrupts */
179 VECTAB_ENTRY(RTC_Alarm_IRQ), /* RTC Alarm (A and B) through EXTI Line Interrupt */
180 VECTAB_ENTRY(OTG_FS_WKUP_IRQ), /* USB OTG FS Wakeup through EXTI line interrupt */
181 VECTAB_ENTRY(TIM8_BRK_TIM12_IRQ), /* TIM8 Break Interrupt and TIM12 global interrupt */
182 VECTAB_ENTRY(TIM8_UP_TIM13_IRQ), /* TIM8 Update Interrupt and TIM13 global interrupt */
183 VECTAB_ENTRY(TIM8_TRG_COM_TIM14_IRQ), /* TIM8 Trigger and Commutation Interrupt and TIM14 global interrupt */
184 VECTAB_ENTRY(TIM8_CC_IRQ), /* TIM8 Capture Compare Interrupt */
185 VECTAB_ENTRY(DMA1_Stream7_IRQ), /* DMA1 Stream7 Interrupt */
186 VECTAB_ENTRY(FSMC_IRQ), /* FSMC global Interrupt */
187 VECTAB_ENTRY(SDIO_IRQ), /* SDIO global Interrupt */
188 VECTAB_ENTRY(TIM5_IRQ), /* TIM5 global Interrupt */
189 VECTAB_ENTRY(SPI3_IRQ), /* SPI3 global Interrupt */
190 VECTAB_ENTRY(UART4_IRQ), /* UART4 global Interrupt */
191 VECTAB_ENTRY(UART5_IRQ), /* UART5 global Interrupt */
192 VECTAB_ENTRY(TIM6_DAC_IRQ), /* TIM6 global and DAC1&2 underrun error interrupts */
193 VECTAB_ENTRY(TIM7_IRQ), /* TIM7 global interrupt */
194 VECTAB_ENTRY(DMA2_Stream0_IRQ), /* DMA2 Stream 0 global Interrupt */
195 VECTAB_ENTRY(DMA2_Stream1_IRQ), /* DMA2 Stream 1 global Interrupt */
196 VECTAB_ENTRY(DMA2_Stream2_IRQ), /* DMA2 Stream 2 global Interrupt */
197 VECTAB_ENTRY(DMA2_Stream3_IRQ), /* DMA2 Stream 3 global Interrupt */
198 VECTAB_ENTRY(DMA2_Stream4_IRQ), /* DMA2 Stream 4 global Interrupt */
199 VECTAB_ENTRY(ETH_IRQ), /* Ethernet global Interrupt */
200 VECTAB_ENTRY(ETH_WKUP_IRQ), /* Ethernet Wakeup through EXTI line Interrupt */
201 VECTAB_ENTRY(CAN2_TX_IRQ), /* CAN2 TX Interrupt */
202 VECTAB_ENTRY(CAN2_RX0_IRQ), /* CAN2 RX0 Interrupt */
203 VECTAB_ENTRY(CAN2_RX1_IRQ), /* CAN2 RX1 Interrupt */
204 VECTAB_ENTRY(CAN2_SCE_IRQ), /* CAN2 SCE Interrupt */
205 VECTAB_ENTRY(OTG_FS_IRQ), /* USB OTG FS global Interrupt */
206 VECTAB_ENTRY(DMA2_Stream5_IRQ), /* DMA2 Stream 5 global interrupt */
207 VECTAB_ENTRY(DMA2_Stream6_IRQ), /* DMA2 Stream 6 global interrupt */
208 VECTAB_ENTRY(DMA2_Stream7_IRQ), /* DMA2 Stream 7 global interrupt */
209 VECTAB_ENTRY(USART6_IRQ), /* USART6 global interrupt */
210 VECTAB_ENTRY(I2C3_EV_IRQ), /* I2C3 event interrupt */
211 VECTAB_ENTRY(I2C3_ER_IRQ), /* I2C3 error interrupt */
212 VECTAB_ENTRY(OTG_HS_EP1_OUT_IRQ), /* USB OTG HS End Point 1 Out global interrupt */
213 VECTAB_ENTRY(OTG_HS_EP1_IN_IRQ), /* USB OTG HS End Point 1 In global interrupt */
214 VECTAB_ENTRY(OTG_HS_WKUP_IRQ), /* USB OTG HS Wakeup through EXTI interrupt */
215 VECTAB_ENTRY(OTG_HS_IRQ), /* USB OTG HS global interrupt */
216 VECTAB_ENTRY(DCMI_IRQ), /* DCMI global interrupt */
217 VECTAB_ENTRY(CRYP_IRQ), /* CRYP crypto global interrupt */
218 VECTAB_ENTRY(HASH_RNG_IRQ), /* Hash and Rng global interrupt */
219};
220