Paparazzi UAS  v4.2.2_stable-4-gcc32f65
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
stm32_vector_table.c
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2010 The Paparazzi Team
5  *
6  * This file is part of Paparazzi.
7  *
8  * Paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * Paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
24 #include "stm32_vector_table.h"
25 
26 #include <cmsis/stm32.h>
27 
28 #include "stm32_exceptions.h"
29 
30 #ifdef USE_SYS_TIME
31 #include "mcu_periph/sys_time.h"
32 #define SYS_TICK_IRQ_HANDLER sys_tick_irq_handler
33 #else
34 #define SYS_TICK_IRQ_HANDLER null_handler
35 #endif
36 
37 #if defined USE_UART1 || OVERRIDE_UART1_IRQ_HANDLER
38 #include "mcu_periph/uart.h"
39 #define USART1_IRQ_HANDLER usart1_irq_handler
40 #else
41 #define USART1_IRQ_HANDLER null_handler
42 #endif
43 
44 #if defined USE_UART2 || OVERRIDE_UART2_IRQ_HANDLER
45 #include "mcu_periph/uart.h"
46 #define USART2_IRQ_HANDLER usart2_irq_handler
47 #else
48 #define USART2_IRQ_HANDLER null_handler
49 #endif
50 
51 #if defined USE_UART3 || OVERRIDE_UART3_IRQ_HANDLER
52 #include "mcu_periph/uart.h"
53 #define USART3_IRQ_HANDLER usart3_irq_handler
54 #else
55 #define USART3_IRQ_HANDLER null_handler
56 #endif
57 
58 #if defined USE_UART5 || OVERRIDE_UART5_IRQ_HANDLER
59 #include "mcu_periph/uart.h"
60 #define USART5_IRQ_HANDLER usart5_irq_handler
61 #else
62 #define USART5_IRQ_HANDLER null_handler
63 #endif
64 
65 
66 #ifdef USE_I2C1
67 #include "mcu_periph/i2c_arch.h"
68 #define I2C1_EV_IRQ_HANDLER i2c1_ev_irq_handler
69 #define I2C1_ER_IRQ_HANDLER i2c1_er_irq_handler
70 #else
71 #define I2C1_EV_IRQ_HANDLER null_handler
72 #define I2C1_ER_IRQ_HANDLER null_handler
73 #endif
74 
75 #ifdef USE_I2C2
76 #include "mcu_periph/i2c_arch.h"
77 #define I2C2_EV_IRQ_HANDLER i2c2_ev_irq_handler
78 #define I2C2_ER_IRQ_HANDLER i2c2_er_irq_handler
79 #else
80 #define I2C2_EV_IRQ_HANDLER null_handler
81 #define I2C2_ER_IRQ_HANDLER null_handler
82 #endif
83 
84 #ifdef USE_SPI1_IRQ
85 extern void spi1_irq_handler(void);
86 #define SPI1_IRQ_HANDLER spi1_irq_handler
87 #else
88 #define SPI1_IRQ_HANDLER null_handler
89 #endif
90 
91 #ifdef USE_SPI2_IRQ
92 extern void spi2_irq_handler(void);
93 #define SPI2_IRQ_HANDLER spi2_irq_handler
94 #else
95 #define SPI2_IRQ_HANDLER null_handler
96 #endif
97 
98 #ifdef USE_EXTI0_IRQ
99 extern void exti0_irq_handler(void);
100 #define EXTI0_IRQ_HANDLER exti0_irq_handler
101 #else
102 #define EXTI0_IRQ_HANDLER null_handler
103 #endif
104 
105 #ifdef USE_EXTI2_IRQ
106 extern void exti2_irq_handler(void);
107 #define EXTI2_IRQ_HANDLER exti2_irq_handler
108 #else
109 #define EXTI2_IRQ_HANDLER null_handler
110 #endif
111 
112 #ifdef USE_EXTI3_IRQ
113 extern void exti3_irq_handler(void);
114 #define EXTI3_IRQ_HANDLER exti3_irq_handler
115 #else
116 #define EXTI3_IRQ_HANDLER null_handler
117 #endif
118 
119 #ifdef USE_EXTI4_IRQ
120 extern void exti4_irq_handler(void);
121 #define EXTI4_IRQ_HANDLER exti4_irq_handler
122 #else
123 #define EXTI4_IRQ_HANDLER null_handler
124 #endif
125 
126 #ifdef USE_EXTI9_5_IRQ
127 extern void exti9_5_irq_handler(void);
128 #define EXTI9_5_IRQ_HANDLER exti9_5_irq_handler
129 #else
130 #define EXTI9_5_IRQ_HANDLER null_handler
131 #endif
132 
133 #ifdef USE_EXTI15_10_IRQ
134 extern void exti15_10_irq_handler(void);
135 #define EXTI15_10_IRQ_HANDLER exti15_10_irq_handler
136 #else
137 #define EXTI15_10_IRQ_HANDLER null_handler
138 #endif
139 
140 
141 #ifdef USE_DMA1_C2_IRQ
142 extern void dma1_c2_irq_handler(void);
143 #define DMA1_C2_IRQ_HANDLER dma1_c2_irq_handler
144 #else
145 #define DMA1_C2_IRQ_HANDLER null_handler
146 #endif
147 
148 #ifdef USE_DMA1_C4_IRQ
149 extern void dma1_c4_irq_handler(void);
150 #define DMA1_C4_IRQ_HANDLER dma1_c4_irq_handler
151 #else
152 #define DMA1_C4_IRQ_HANDLER null_handler
153 #endif
154 
155 #ifdef USE_ADC1_2_IRQ_HANDLER
156 extern void adc1_2_irq_handler(void);
157 #define ADC1_2_IRQ_HANDLER adc1_2_irq_handler
158 #else
159 #define ADC1_2_IRQ_HANDLER null_handler
160 #endif
161 
162 #ifdef USE_TIM1_IRQ
163 extern void tim1_up_irq_handler(void);
164 extern void tim1_cc_irq_handler(void);
165 #define TIM1_UP_IRQ_HANDLER tim1_up_irq_handler
166 #define TIM1_CC_IRQ_HANDLER tim1_cc_irq_handler
167 #else
168 #define TIM1_UP_IRQ_HANDLER null_handler
169 #define TIM1_CC_IRQ_HANDLER null_handler
170 #endif
171 
172 #ifdef USE_TIM2_IRQ
173 extern void tim2_irq_handler(void);
174 #define TIM2_IRQ_HANDLER tim2_irq_handler
175 #else
176 #define TIM2_IRQ_HANDLER null_handler
177 #endif
178 
179 #ifdef USE_TIM6_IRQ
180 extern void tim6_irq_handler(void);
181 #define TIM6_IRQ_HANDLER tim6_irq_handler
182 #else
183 #define TIM6_IRQ_HANDLER null_handler
184 #endif
185 
186 #ifdef USE_USB_HP_CAN1_TX_IRQ
187 extern void usb_hp_can1_tx_irq_handler(void);
188 #define USB_HP_CAN1_TX_IRQ_HANDLER usb_hp_can1_tx_irq_handler
189 #else
190 #define USB_HP_CAN1_TX_IRQ_HANDLER null_handler
191 #endif
192 
193 #ifdef USE_USB_LP_CAN1_RX0_IRQ
194 extern void usb_lp_can1_rx0_irq_handler(void);
195 #define USB_LP_CAN1_RX0_IRQ_HANDLER usb_lp_can1_rx0_irq_handler
196 #else
197 #define USB_LP_CAN1_RX0_IRQ_HANDLER null_handler
198 #endif
199 
200 /* addresses defined in the linker script */
201 extern unsigned long _etext; /* end addr of .text section */
202 extern unsigned long _sidata; /* init values for .data section */
203 extern unsigned long _sdata; /* start addr of .data section */
204 extern unsigned long _edata; /* end addr of .data section */
205 extern unsigned long _sbss; /* start addr of .bss section */
206 extern unsigned long _ebss; /* end addr of .bss section */
207 extern void _estack; /* stack pointer init value */
208 
209 void reset_handler_stage1(void) __attribute__((__interrupt__));
210 void reset_handler_stage2(void);
211 void null_handler(void);
212 
213 /* interrupt vector */
214 __attribute__ ((section(".isr_vector")))
215 void (* const vector_table[])(void) = {
216  &_estack, /* stack pointer init value*/
217  reset_handler_stage1, /* pc init value */
223  0, 0, 0, 0, /* reserved */
224  null_handler, /* svc_handler */
225  null_handler, /* debug_monitor */
226  0, /* reserved */
227  null_handler, /* pend_svc */
228  SYS_TICK_IRQ_HANDLER, /* sys_tick_handler, */
229  null_handler, /* wwdg_irq_handler */
230  null_handler, /* pvd_irq_handler */
231  null_handler, /* tamper_irq_handler */
232  null_handler, /* rtc_irq_handler */
233  null_handler, /* flash_irq_handler */
234  null_handler, /* rcc_irq_handler */
235  EXTI0_IRQ_HANDLER, /* exti0_irq_handler */
236  null_handler, /* exti1_irq_handler */
237  EXTI2_IRQ_HANDLER, /* exti2_irq_handler */
238  EXTI3_IRQ_HANDLER, /* exti3_irq_handler */
239  EXTI4_IRQ_HANDLER, /* exti4_irq_handler */
240  null_handler, /* dma1_channel1_irq_handler */
241  DMA1_C2_IRQ_HANDLER, /* dma1_channel2_irq_handler */
242  null_handler, /* dma1_channel3_irq_handler */
243  DMA1_C4_IRQ_HANDLER, /* dma1_channel4_irq_handler */
244  null_handler, /* dma1_channel5_irq_handler */
245  null_handler, /* dma1_channel6_irq_handler */
246  null_handler, /* dma1_channel7_irq_handler */
247  ADC1_2_IRQ_HANDLER, /* adc1_2_irq_handler */
248  USB_HP_CAN1_TX_IRQ_HANDLER, /* usb_hp_can_tx_irq_handler */
249  USB_LP_CAN1_RX0_IRQ_HANDLER, /* usb_lp_can_rx0_irq_handler */
250  null_handler, /* can_rx1_irq_handler */
251  null_handler, /* can_sce_irq_handler */
252  EXTI9_5_IRQ_HANDLER, /* exti9_5_irq_handler */
253  null_handler, /* tim1_brk_irq_handler */
254  TIM1_UP_IRQ_HANDLER, /* tim1_up_irq_handler */
255  null_handler, /* tim1_trg_com_irq_handler */
256  TIM1_CC_IRQ_HANDLER, /* tim1_cc_irq_handler */
257  TIM2_IRQ_HANDLER, /* tim2_irq_handler */
258  null_handler, /* tim3_irq_handler */
259  null_handler, /* tim4_irq_handler */
260  I2C1_EV_IRQ_HANDLER, /* i2c1_ev_irq_handler */
261  I2C1_ER_IRQ_HANDLER, /* i2c1_er_irq_handler */
262  I2C2_EV_IRQ_HANDLER, /* i2c2_ev_irq_handler */
263  I2C2_ER_IRQ_HANDLER, /* i2c2_er_irq_handler */
264  SPI1_IRQ_HANDLER, /* spi1_irq_handler */
265  SPI2_IRQ_HANDLER, /* spi2_irq_handler */
266  USART1_IRQ_HANDLER, /* usart1_irq_handler */
267  USART2_IRQ_HANDLER, /* usart2_irq_handler */
268  USART3_IRQ_HANDLER, /* usart3_irq_handler */
269  EXTI15_10_IRQ_HANDLER, /* exti15_10_irq_handler */
270  null_handler, /* rtc_alarm_irq_handler */
271  null_handler, /* usb_wake_up_irq_handler */
272  null_handler, /* tim8_brk_irq_handler */
273  null_handler, /* tim8_up_irq_handler */
274  null_handler, /* tim8_trg_com_irq_handler */
275  null_handler, /* tim8_cc_irq_handler */
276  null_handler, /* adc3_irq_handler */
277  null_handler, /* fsmc_irq_handler */
278  null_handler, /* sdio_irq_handler */
279  null_handler, /* tim5_irq_handler */
280  null_handler, /* spi3_irq_handler */
281  null_handler, /* uart4_irq_handler */
282  USART5_IRQ_HANDLER, /* uart5_irq_handler */
283  TIM6_IRQ_HANDLER, /* tim6_irq_handler */
284  null_handler, /* tim7_irq_handler */
285  null_handler, /* dma2_channel1_irq_handler */
286  null_handler, /* dma2_channel2_irq_handler */
287  null_handler, /* dma2_channel3_irq_handler */
288  null_handler, /* dma2_channel4_5_irq_handler */
289 };
290 
291 /* Get's called directly after mcu reset */
292 void reset_handler_stage1(void){
293  /* set stack align */
294  SCB->CCR = SCB->CCR | SCB_CCR_STKALIGN;
295 
297 }
298 
299 //extern int main(int argc, char** argv);
300 extern void main( void);
301 
303  unsigned long *pul_src, *pul_dest;
304 
305  /* Copy the data segment initializers from flash to SRAM */
306  pul_src = &_sidata;
307  for(pul_dest = &_sdata; pul_dest < &_edata; ){
308  *(pul_dest++) = *(pul_src++);
309  }
310  /* Zero fill the bss segment. */
311  for(pul_dest = &_sbss; pul_dest < &_ebss; ){
312  *(pul_dest++) = 0;
313  }
314 
315  /* Call the application's entry point.*/
316  main();
317 }
318 
319 void null_handler(void){
320 }
321 
322 /* FIXME: look deeper into what that is doing
323  *
324  */
325 
326 void assert_param(void);
327 
328 void assert_param(void){
329 
330 }
331 
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define EXTI3_IRQ_HANDLER
#define USART3_IRQ_HANDLER
#define I2C2_ER_IRQ_HANDLER
#define SPI1_IRQ_HANDLER
void dma1_c4_irq_handler(void)
void adc1_2_irq_handler(void)
This is the driver for the analog to digital converters on STM32.
Definition: adc_arch.c:463
void mem_manage_exception(void)
#define USART1_IRQ_HANDLER
void exti4_irq_handler(void)
unsigned long _sidata
#define SPI2_IRQ_HANDLER
#define DMA1_C4_IRQ_HANDLER
unsigned long _sbss
#define EXTI2_IRQ_HANDLER
#define EXTI9_5_IRQ_HANDLER
void main(void)
Definition: usb_tunnel.c:43
#define TIM1_CC_IRQ_HANDLER
#define TIM1_UP_IRQ_HANDLER
void tim6_irq_handler(void)
unsigned long _sdata
void reset_handler_stage1(void)
void null_handler(void)
#define SCB
Definition: LPC21xx.h:362
Architecture independent timing functions.
void assert_param(void)
void bus_fault_exception(void)
void spi2_irq_handler(void)
Definition: imu_b2_arch.c:119
#define USB_HP_CAN1_TX_IRQ_HANDLER
#define USB_LP_CAN1_RX0_IRQ_HANDLER
void exti3_irq_handler(void)
#define DMA1_C2_IRQ_HANDLER
void exti15_10_irq_handler(void)
#define EXTI15_10_IRQ_HANDLER
unsigned long _etext
void exti9_5_irq_handler(void)
Definition: hmc5843_arch.c:66
#define EXTI0_IRQ_HANDLER
#define USART5_IRQ_HANDLER
#define TIM6_IRQ_HANDLER
#define EXTI4_IRQ_HANDLER
unsigned long _ebss
void exti2_irq_handler(void)
unsigned long _edata
void hard_fault_exception(void)
void usb_lp_can1_rx0_irq_handler(void)
Definition: can_arch.c:146
void _estack
#define TIM2_IRQ_HANDLER
#define I2C1_ER_IRQ_HANDLER
void spi1_irq_handler(void)
#define I2C1_EV_IRQ_HANDLER
#define ADC1_2_IRQ_HANDLER
#define I2C2_EV_IRQ_HANDLER
void usage_fault_exception(void)
void reset_handler_stage2(void)
__attribute__((always_inline))
Definition: i2c_arch.c:35
#define SYS_TICK_IRQ_HANDLER
void nmi_exception(void)
#define USART2_IRQ_HANDLER