Paparazzi UAS  v4.0.4_stable-3-gf39211a
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_TIM2_IRQ
163 extern void tim2_irq_handler(void);
164 #define TIM2_IRQ_HANDLER tim2_irq_handler
165 #else
166 #define TIM2_IRQ_HANDLER null_handler
167 #endif
168 
169 #ifdef USE_TIM6_IRQ
170 extern void tim6_irq_handler(void);
171 #define TIM6_IRQ_HANDLER tim6_irq_handler
172 #else
173 #define TIM6_IRQ_HANDLER null_handler
174 #endif
175 
176 #ifdef USE_USB_HP_CAN1_TX_IRQ
177 extern void usb_hp_can1_tx_irq_handler(void);
178 #define USB_HP_CAN1_TX_IRQ_HANDLER usb_hp_can1_tx_irq_handler
179 #else
180 #define USB_HP_CAN1_TX_IRQ_HANDLER null_handler
181 #endif
182 
183 #ifdef USE_USB_LP_CAN1_RX0_IRQ
184 extern void usb_lp_can1_rx0_irq_handler(void);
185 #define USB_LP_CAN1_RX0_IRQ_HANDLER usb_lp_can1_rx0_irq_handler
186 #else
187 #define USB_LP_CAN1_RX0_IRQ_HANDLER null_handler
188 #endif
189 
190 /* addresses defined in the linker script */
191 extern unsigned long _etext; /* end addr of .text section */
192 extern unsigned long _sidata; /* init values for .data section */
193 extern unsigned long _sdata; /* start addr of .data section */
194 extern unsigned long _edata; /* end addr of .data section */
195 extern unsigned long _sbss; /* start addr of .bss section */
196 extern unsigned long _ebss; /* end addr of .bss section */
197 extern void _estack; /* stack pointer init value */
198 
199 void reset_handler_stage1(void) __attribute__((__interrupt__));
200 void reset_handler_stage2(void);
201 void null_handler(void);
202 
203 /* interrupt vector */
204 __attribute__ ((section(".isr_vector")))
205 void (* const vector_table[])(void) = {
206  &_estack, /* stack pointer init value*/
207  reset_handler_stage1, /* pc init value */
213  0, 0, 0, 0, /* reserved */
214  null_handler, /* svc_handler */
215  null_handler, /* debug_monitor */
216  0, /* reserved */
217  null_handler, /* pend_svc */
218  SYS_TICK_IRQ_HANDLER, /* sys_tick_handler, */
219  null_handler, /* wwdg_irq_handler */
220  null_handler, /* pvd_irq_handler */
221  null_handler, /* tamper_irq_handler */
222  null_handler, /* rtc_irq_handler */
223  null_handler, /* flash_irq_handler */
224  null_handler, /* rcc_irq_handler */
225  EXTI0_IRQ_HANDLER, /* exti0_irq_handler */
226  null_handler, /* exti1_irq_handler */
227  EXTI2_IRQ_HANDLER, /* exti2_irq_handler */
228  EXTI3_IRQ_HANDLER, /* exti3_irq_handler */
229  EXTI4_IRQ_HANDLER, /* exti4_irq_handler */
230  null_handler, /* dma1_channel1_irq_handler */
231  DMA1_C2_IRQ_HANDLER, /* dma1_channel2_irq_handler */
232  null_handler, /* dma1_channel3_irq_handler */
233  DMA1_C4_IRQ_HANDLER, /* dma1_channel4_irq_handler */
234  null_handler, /* dma1_channel5_irq_handler */
235  null_handler, /* dma1_channel6_irq_handler */
236  null_handler, /* dma1_channel7_irq_handler */
237  ADC1_2_IRQ_HANDLER, /* adc1_2_irq_handler */
238  USB_HP_CAN1_TX_IRQ_HANDLER, /* usb_hp_can_tx_irq_handler */
239  USB_LP_CAN1_RX0_IRQ_HANDLER, /* usb_lp_can_rx0_irq_handler */
240  null_handler, /* can_rx1_irq_handler */
241  null_handler, /* can_sce_irq_handler */
242  EXTI9_5_IRQ_HANDLER, /* exti9_5_irq_handler */
243  null_handler, /* tim1_brk_irq_handler */
244  null_handler, /* tim1_up_irq_handler */
245  null_handler, /* tim1_trg_com_irq_handler */
246  null_handler, /* tim1_cc_irq_handler */
247  TIM2_IRQ_HANDLER, /* tim2_irq_handler */
248  null_handler, /* tim3_irq_handler */
249  null_handler, /* tim4_irq_handler */
250  I2C1_EV_IRQ_HANDLER, /* i2c1_ev_irq_handler */
251  I2C1_ER_IRQ_HANDLER, /* i2c1_er_irq_handler */
252  I2C2_EV_IRQ_HANDLER, /* i2c2_ev_irq_handler */
253  I2C2_ER_IRQ_HANDLER, /* i2c2_er_irq_handler */
254  SPI1_IRQ_HANDLER, /* spi1_irq_handler */
255  SPI2_IRQ_HANDLER, /* spi2_irq_handler */
256  USART1_IRQ_HANDLER, /* usart1_irq_handler */
257  USART2_IRQ_HANDLER, /* usart2_irq_handler */
258  USART3_IRQ_HANDLER, /* usart3_irq_handler */
259  EXTI15_10_IRQ_HANDLER, /* exti15_10_irq_handler */
260  null_handler, /* rtc_alarm_irq_handler */
261  null_handler, /* usb_wake_up_irq_handler */
262  null_handler, /* tim8_brk_irq_handler */
263  null_handler, /* tim8_up_irq_handler */
264  null_handler, /* tim8_trg_com_irq_handler */
265  null_handler, /* tim8_cc_irq_handler */
266  null_handler, /* adc3_irq_handler */
267  null_handler, /* fsmc_irq_handler */
268  null_handler, /* sdio_irq_handler */
269  null_handler, /* tim5_irq_handler */
270  null_handler, /* spi3_irq_handler */
271  null_handler, /* uart4_irq_handler */
272  USART5_IRQ_HANDLER, /* uart5_irq_handler */
273  TIM6_IRQ_HANDLER, /* tim6_irq_handler */
274  null_handler, /* tim7_irq_handler */
275  null_handler, /* dma2_channel1_irq_handler */
276  null_handler, /* dma2_channel2_irq_handler */
277  null_handler, /* dma2_channel3_irq_handler */
278  null_handler, /* dma2_channel4_5_irq_handler */
279 };
280 
281 /* Get's called directly after mcu reset */
282 void reset_handler_stage1(void){
283  /* set stack align */
284  SCB->CCR = SCB->CCR | SCB_CCR_STKALIGN;
285 
287 }
288 
289 //extern int main(int argc, char** argv);
290 extern void main( void);
291 
293  unsigned long *pul_src, *pul_dest;
294 
295  /* Copy the data segment initializers from flash to SRAM */
296  pul_src = &_sidata;
297  for(pul_dest = &_sdata; pul_dest < &_edata; ){
298  *(pul_dest++) = *(pul_src++);
299  }
300  /* Zero fill the bss segment. */
301  for(pul_dest = &_sbss; pul_dest < &_ebss; ){
302  *(pul_dest++) = 0;
303  }
304 
305  /* Call the application's entry point.*/
306  main();
307 }
308 
309 void null_handler(void){
310 }
311 
312 /* FIXME: look deeper into what that is doing
313  *
314  */
315 
316 void assert_param(void);
317 
318 void assert_param(void){
319 
320 }
321 
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
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 tim2_irq_handler(void)
Definition: ppm_arch.c:104
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