2 ******************************************************************************
3 * @addtogroup PIOS PIOS Core hardware abstraction layer
6 * @file vectors_stm32f30x.c
7 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
8 * Tau Labs, http://taulabs.org, Copyright (C) 2012-2013
9 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
10 * @brief C based vectors for F3
11 * @see The GNU Public License (GPL) Version 3
13 *****************************************************************************/
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 3 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful, but
21 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 /** interrupt handler */
31 typedef void (vector
)(void);
33 /** default interrupt handler */
34 static void default_io_handler(void)
36 asm volatile ("BKPT #01");
42 /** prototypes an interrupt handler */
43 #define HANDLER(_name) extern vector _name __attribute__((weak, alias("default_io_handler")))
45 HANDLER(Reserved_IRQHandler
); // Reserved
46 HANDLER(WWDG_IRQHandler
); // Window WatchDog
47 HANDLER(PVD_IRQHandler
); // PVD through EXTI Line detection
48 HANDLER(TAMP_STAMP_IRQHandler
); // Tamper and TimeStamps through the EXTI line
49 HANDLER(RTC_WKUP_IRQHandler
); // RTC Wakeup through the EXTI line
50 HANDLER(FLASH_IRQHandler
); // FLASH
51 HANDLER(RCC_IRQHandler
); // RCC
52 HANDLER(EXTI0_IRQHandler
); // EXTI Line0
53 HANDLER(EXTI1_IRQHandler
); // EXTI Line1
54 HANDLER(EXTI2_TS_IRQHandler
); // EXTI Line2 and Touch Sense Interrupt
55 HANDLER(EXTI3_IRQHandler
); // EXTI Line3
56 HANDLER(EXTI4_IRQHandler
); // EXTI Line4
57 HANDLER(DMA1_Channel1_IRQHandler
); // DMA1 Channel 1
58 HANDLER(DMA1_Channel2_IRQHandler
); // DMA1 Channel 2
59 HANDLER(DMA1_Channel3_IRQHandler
); // DMA1 Channel 3
60 HANDLER(DMA1_Channel4_IRQHandler
); // DMA1 Channel 4
61 HANDLER(DMA1_Channel5_IRQHandler
); // DMA1 Channel 5
62 HANDLER(DMA1_Channel6_IRQHandler
); // DMA1 Channel 6
63 HANDLER(DMA1_Channel7_IRQHandler
); // DMA1 Channel 7
64 HANDLER(ADC1_2_IRQHandler
); // ADC1 and ADC2
65 HANDLER(USB_HP_CAN1_TX_IRQHandler
); // USB Device High Priority or CAN1 TX
66 HANDLER(USB_LP_CAN1_RX0_IRQHandler
); // USB Device Low Priority or CAN1 RX0
67 HANDLER(CAN1_RX1_IRQHandler
); // CAN1 RX1
68 HANDLER(CAN1_SCE_IRQHandler
); // CAN1 SCE
69 HANDLER(EXTI9_5_IRQHandler
); // External Line[9:5]s
70 HANDLER(TIM1_BRK_TIM15_IRQHandler
); // TIM1 Break and TIM15
71 HANDLER(TIM1_UP_TIM16_IRQHandler
); // TIM1 Update and TIM16
72 HANDLER(TIM1_TRG_COM_TIM17_IRQHandler
); // TIM1 Trigger and Commutation and TIM17
73 HANDLER(TIM1_CC_IRQHandler
); // TIM1 Capture Compare
74 HANDLER(TIM2_IRQHandler
); // TIM2
75 HANDLER(TIM3_IRQHandler
); // TIM3
76 HANDLER(TIM4_IRQHandler
); // TIM4
77 HANDLER(I2C1_EV_EXTI23_IRQHandler
); // I2C1 Event and EXTI23
78 HANDLER(I2C1_ER_IRQHandler
); // I2C1 Error
79 HANDLER(I2C2_EV_EXTI24_IRQHandler
); // I2C2 Event and EXTI24
80 HANDLER(I2C2_ER_IRQHandler
); // I2C2 Error
81 HANDLER(SPI1_IRQHandler
); // SPI1
82 HANDLER(SPI2_IRQHandler
); // SPI2
83 HANDLER(USART1_EXTI25_IRQHandler
); // USART1 and EXTI25
84 HANDLER(USART2_EXTI26_IRQHandler
); // USART2 and EXTI26
85 HANDLER(USART3_EXTI28_IRQHandler
); // USART3 and EXTI28
86 HANDLER(EXTI15_10_IRQHandler
); // External Line[15:10]s
87 HANDLER(RTC_Alarm_IRQHandler
); // RTC Alarm (A and B) through EXTI Line
88 HANDLER(USB_WKUP_IRQHandler
); // USB FS Wakeup through EXTI line
89 HANDLER(TIM8_BRK_IRQHandler
); // TIM8 Break
90 HANDLER(TIM8_UP_IRQHandler
); // TIM8 Update
91 HANDLER(TIM8_TRG_COM_IRQHandler
); // TIM8 Trigger and Commutation
92 HANDLER(TIM8_CC_IRQHandler
); // TIM8 Capture Compare
93 HANDLER(ADC3_IRQHandler
); // ADC3
94 HANDLER(SPI3_IRQHandler
); // SPI3
95 HANDLER(UART4_EXTI34_IRQHandler
); // UART4 and EXTI34
96 HANDLER(UART5_EXTI35_IRQHandler
); // UART5 and EXTI35
97 HANDLER(TIM6_DAC_IRQHandler
); // TIM6 and DAC1&2 underrun errors
98 HANDLER(TIM7_IRQHandler
); // TIM7
99 HANDLER(DMA2_Channel1_IRQHandler
); // DMA2 Channel 1
100 HANDLER(DMA2_Channel2_IRQHandler
); // DMA2 Channel 2
101 HANDLER(DMA2_Channel3_IRQHandler
); // DMA2 Channel 3
102 HANDLER(DMA2_Channel4_IRQHandler
); // DMA2 Channel 4
103 HANDLER(DMA2_Channel5_IRQHandler
); // DMA2 Channel 5
104 HANDLER(ADC4_IRQHandler
); // ADC4
105 HANDLER(COMP1_2_3_IRQHandler
); // COMP1, COMP2 and COMP3
106 HANDLER(COMP4_5_6_IRQHandler
); // COMP4, COMP5 and COMP6
107 HANDLER(COMP7_IRQHandler
); // COMP7
108 HANDLER(USB_HP_IRQHandler
); // USB High Priority remap
109 HANDLER(USB_LP_IRQHandler
); // USB Low Priority remap
110 HANDLER(USB_WKUP_RMP_IRQHandler
); // USB Wakup remap
111 HANDLER(FPU_IRQHandler
); // FPU
113 #if defined(STM32F303xD) || defined(STM32F303xE)
114 HANDLER(FMC_IRQHandler
);
115 HANDLER(I2C3_EV_IRQHandler
);
116 HANDLER(I2C3_ER_IRQHandler
);
117 HANDLER(TIM20_BRK_IRQHandler
);
118 HANDLER(TIM20_UP_IRQHandler
);
119 HANDLER(TIM20_TRG_COM_IRQHandler
);
120 HANDLER(TIM20_CC_IRQHandler
);
121 HANDLER(SPI4_IRQHandler
);
122 #endif /* defined(STM32F303xD) || defined(STM32F303xE) */
124 /** stm32f30x interrupt vector table */
125 vector
*io_vectors
[] __attribute__((section(".io_vectors"))) = {
126 WWDG_IRQHandler
, // Window WatchDog
127 PVD_IRQHandler
, // PVD through EXTI Line detection
128 TAMP_STAMP_IRQHandler
, // Tamper and TimeStamps through the EXTI line
129 RTC_WKUP_IRQHandler
, // RTC Wakeup through the EXTI line
130 FLASH_IRQHandler
, // FLASH
131 RCC_IRQHandler
, // RCC
132 EXTI0_IRQHandler
, // EXTI Line0
133 EXTI1_IRQHandler
, // EXTI Line1
134 EXTI2_TS_IRQHandler
, // EXTI Line2 and Touch Sense Interrupt
135 EXTI3_IRQHandler
, // EXTI Line3
136 EXTI4_IRQHandler
, // EXTI Line4
137 DMA1_Channel1_IRQHandler
, // DMA1 Channel 1
138 DMA1_Channel2_IRQHandler
, // DMA1 Channel 2
139 DMA1_Channel3_IRQHandler
, // DMA1 Channel 3
140 DMA1_Channel4_IRQHandler
, // DMA1 Channel 4
141 DMA1_Channel5_IRQHandler
, // DMA1 Channel 5
142 DMA1_Channel6_IRQHandler
, // DMA1 Channel 6
143 DMA1_Channel7_IRQHandler
, // DMA1 Channel 7
144 ADC1_2_IRQHandler
, // ADC1 and ADC2
145 USB_HP_CAN1_TX_IRQHandler
, // USB Device High Priority or CAN1 TX
146 USB_LP_CAN1_RX0_IRQHandler
, // USB Device Low Priority or CAN1 RX0
147 CAN1_RX1_IRQHandler
, // CAN1 RX1
148 CAN1_SCE_IRQHandler
, // CAN1 SCE
149 EXTI9_5_IRQHandler
, // External Line[9:5]s
150 TIM1_BRK_TIM15_IRQHandler
, // TIM1 Break and TIM15
151 TIM1_UP_TIM16_IRQHandler
, // TIM1 Update and TIM16
152 TIM1_TRG_COM_TIM17_IRQHandler
, // TIM1 Trigger and Commutation and TIM17
153 TIM1_CC_IRQHandler
, // TIM1 Capture Compare
154 TIM2_IRQHandler
, // TIM2
155 TIM3_IRQHandler
, // TIM3
156 TIM4_IRQHandler
, // TIM4
157 I2C1_EV_EXTI23_IRQHandler
, // I2C1 Event and EXTI23
158 I2C1_ER_IRQHandler
, // I2C1 Error
159 I2C2_EV_EXTI24_IRQHandler
, // I2C2 Event and EXTI24
160 I2C2_ER_IRQHandler
, // I2C2 Error
161 SPI1_IRQHandler
, // SPI1
162 SPI2_IRQHandler
, // SPI2
163 USART1_EXTI25_IRQHandler
, // USART1 and EXTI25
164 USART2_EXTI26_IRQHandler
, // USART2 and EXTI26
165 USART3_EXTI28_IRQHandler
, // USART3 and EXTI28
166 EXTI15_10_IRQHandler
, // External Line[15:10]s
167 RTC_Alarm_IRQHandler
, // RTC Alarm (A and B) through EXTI Line
168 USB_WKUP_IRQHandler
, // USB FS Wakeup through EXTI line
169 TIM8_BRK_IRQHandler
, // TIM8 Break
170 TIM8_UP_IRQHandler
, // TIM8 Update
171 TIM8_TRG_COM_IRQHandler
, // TIM8 Trigger and Commutation
172 TIM8_CC_IRQHandler
, // TIM8 Capture Compare
173 ADC3_IRQHandler
, // ADC3
174 #if defined(STM32F303xD) || defined(STM32F303xE)
175 FMC_IRQHandler
, // FMC_IRQHandler (Available in STM32F303xD/E only)
177 Reserved_IRQHandler
, // reserved
179 Reserved_IRQHandler
, // reserved
180 Reserved_IRQHandler
, // reserved
181 SPI3_IRQHandler
, // SPI3
182 UART4_EXTI34_IRQHandler
, // UART4 and EXTI34
183 UART5_EXTI35_IRQHandler
, // UART5 and EXTI35
184 TIM6_DAC_IRQHandler
, // TIM6 and DAC1&2 underrun errors
185 TIM7_IRQHandler
, // TIM7
186 DMA2_Channel1_IRQHandler
, // DMA2 Channel 1
187 DMA2_Channel2_IRQHandler
, // DMA2 Channel 2
188 DMA2_Channel3_IRQHandler
, // DMA2 Channel 3
189 DMA2_Channel4_IRQHandler
, // DMA2 Channel 4
190 DMA2_Channel5_IRQHandler
, // DMA2 Channel 5
191 ADC4_IRQHandler
, // ADC4
192 Reserved_IRQHandler
, // reserved
193 Reserved_IRQHandler
, // reserved
194 COMP1_2_3_IRQHandler
, // COMP1, COMP2 and COMP3
195 COMP4_5_6_IRQHandler
, // COMP4, COMP5 and COMP6
196 COMP7_IRQHandler
, // COMP7
197 Reserved_IRQHandler
, // reserved
198 Reserved_IRQHandler
, // reserved
199 Reserved_IRQHandler
, // reserved
200 Reserved_IRQHandler
, // reserved
201 Reserved_IRQHandler
, // reserved
202 #if defined(STM32F303xD) || defined(STM32F303xE)
203 I2C3_EV_IRQHandler
, /*!< I2C3 event interrupt */
204 I2C3_ER_IRQHandler
, /*!< I2C3 error interrupt */
206 Reserved_IRQHandler
, // reserved
207 Reserved_IRQHandler
, // reserved
209 USB_HP_IRQHandler
, // USB High Priority remap
210 USB_LP_IRQHandler
, // USB Low Priority remap
211 USB_WKUP_RMP_IRQHandler
, // USB Wakup remap
212 #if defined(STM32F303xD) || defined(STM32F303xE)
213 TIM20_BRK_IRQHandler
, /*!< TIM20 Break Interrupt */
214 TIM20_UP_IRQHandler
, /*!< TIM20 Update Interrupt */
215 TIM20_TRG_COM_IRQHandler
, /*!< TIM20 Trigger and Commutation Interrupt */
216 TIM20_CC_IRQHandler
, /*!< TIM20 Capture Compare Interrupt */
218 Reserved_IRQHandler
, // reserved
219 Reserved_IRQHandler
, // reserved
220 Reserved_IRQHandler
, // reserved
221 Reserved_IRQHandler
, // reserved
223 FPU_IRQHandler
, // FPU
224 #if defined(STM32F303xD) || defined(STM32F303xE)
227 SPI4_IRQHandler
/*!< SPI4 global Interrupt */