]> rtime.felk.cvut.cz Git - arc.git/blob - arch/arm/arm_cm3/kernel/startup_stm32f10x_cl.s
Initial commit.
[arc.git] / arch / arm / arm_cm3 / kernel / startup_stm32f10x_cl.s
1 /**\r
2   ******************************************************************************\r
3   * @file    startup_stm32f10x_cl.s\r
4   * @author  MCD Application Team\r
5  * @version  V3.1.0\r
6  * @date     06/19/2009\r
7   * @brief   STM32F10x Connectivity line Devices vector table for RIDE7 toolchain.\r
8   *          This module performs:\r
9   *                - Set the initial SP\r
10   *                - Set the initial PC == Reset_Handler,\r
11   *                - Set the vector table entries with the exceptions ISR \r
12   *                  address.\r
13   *                - Branches to main in the C library (which eventually\r
14   *                  calls main()).\r
15   *          After Reset the Cortex-M3 processor is in Thread mode,\r
16   *          priority is Privileged, and the Stack is set to Main.\r
17   *******************************************************************************\r
18  * @copy\r
19  *\r
20  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
21  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE\r
22  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY\r
23  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING\r
24  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE\r
25  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
26  *\r
27  * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>\r
28  */     \r
29     \r
30   .syntax unified\r
31         .cpu cortex-m3\r
32         .fpu softvfp\r
33         .thumb\r
34 \r
35 .global g_pfnVectors\r
36 .global SystemInit_ExtMemCtl_Dummy\r
37 .global Default_Handler\r
38 \r
39 /* start address for the initialization values of the .data section. \r
40 defined in linker script */\r
41 .word   _sidata\r
42 /* start address for the .data section. defined in linker script */  \r
43 .word   _sdata\r
44 /* end address for the .data section. defined in linker script */\r
45 .word   _edata\r
46 /* start address for the .bss section. defined in linker script */\r
47 .word   _sbss\r
48 /* end address for the .bss section. defined in linker script */\r
49 .word   _ebss\r
50 \r
51 .equ  BootRAM, 0xF1E0F85F\r
52 /**\r
53  * @brief  This is the code that gets called when the processor first\r
54  *          starts execution following a reset event. Only the absolutely\r
55  *          necessary set is performed, after which the application\r
56  *          supplied main() routine is called. \r
57  * @param  None\r
58  * @retval : None\r
59 */\r
60 \r
61     .section    .text.Reset_Handler\r
62         .weak   Reset_Handler\r
63         .type   Reset_Handler, %function\r
64 Reset_Handler:  \r
65 \r
66 /* Copy the data segment initializers from flash to SRAM */  \r
67   movs  r1, #0\r
68   b     LoopCopyDataInit\r
69 \r
70 CopyDataInit:\r
71         ldr     r3, =_sidata\r
72         ldr     r3, [r3, r1]\r
73         str     r3, [r0, r1]\r
74         adds    r1, r1, #4\r
75     \r
76 LoopCopyDataInit:\r
77         ldr     r0, =_sdata\r
78         ldr     r3, =_edata\r
79         adds    r2, r0, r1\r
80         cmp     r2, r3\r
81         bcc     CopyDataInit\r
82         ldr     r2, =_sbss\r
83         b       LoopFillZerobss\r
84 \r
85 /* Zero fill the bss segment. */  \r
86 FillZerobss:\r
87         movs    r3, #0\r
88         str     r3, [r2], #4\r
89     \r
90 LoopFillZerobss:\r
91         ldr     r3, = _ebss\r
92         cmp     r2, r3\r
93         bcc     FillZerobss\r
94 /* Call the application's entry point.*/\r
95         bl      main\r
96         bx      lr    \r
97 .size   Reset_Handler, .-Reset_Handler\r
98 \r
99 /**\r
100  * @brief  This is the code that gets called when the processor receives an \r
101  *         unexpected interrupt.  This simply enters an infinite loop, preserving\r
102  *         the system state for examination by a debugger.\r
103  *\r
104  * @param  None     \r
105  * @retval : None       \r
106 */\r
107     .section    .text.Default_Handler,"ax",%progbits\r
108 Default_Handler:\r
109 Infinite_Loop:\r
110         b       Infinite_Loop\r
111         .size   Default_Handler, .-Default_Handler\r
112 \r
113 /******************************************************************************\r
114 *\r
115 * The minimal vector table for a Cortex M3.  Note that the proper constructs\r
116 * must be placed on this to ensure that it ends up at physical address\r
117 * 0x0000.0000.\r
118 *\r
119 ******************************************************************************/    \r
120         .section        .isr_vector,"a",%progbits\r
121         .type   g_pfnVectors, %object\r
122         .size   g_pfnVectors, .-g_pfnVectors\r
123     \r
124     \r
125 g_pfnVectors:\r
126         .word   _estack\r
127         .word   Reset_Handler\r
128         .word   NMI_Handler\r
129         .word   HardFault_Handler\r
130         .word   MemManage_Handler\r
131         .word   BusFault_Handler\r
132         .word   UsageFault_Handler\r
133         .word   0\r
134         .word   0\r
135         .word   0\r
136         .word   0\r
137         .word   SVC_Handler\r
138         .word   DebugMon_Handler\r
139         .word   0\r
140         .word   PendSV_Handler\r
141         .word   SysTick_Handler\r
142         .word   WWDG_IRQHandler\r
143         .word   PVD_IRQHandler\r
144         .word   TAMPER_IRQHandler\r
145         .word   RTC_IRQHandler\r
146         .word   FLASH_IRQHandler\r
147         .word   RCC_IRQHandler\r
148         .word   EXTI0_IRQHandler\r
149         .word   EXTI1_IRQHandler\r
150         .word   EXTI2_IRQHandler\r
151         .word   EXTI3_IRQHandler\r
152         .word   EXTI4_IRQHandler\r
153         .word   DMA1_Channel1_IRQHandler\r
154         .word   DMA1_Channel2_IRQHandler\r
155         .word   DMA1_Channel3_IRQHandler\r
156         .word   DMA1_Channel4_IRQHandler\r
157         .word   DMA1_Channel5_IRQHandler\r
158         .word   DMA1_Channel6_IRQHandler\r
159         .word   DMA1_Channel7_IRQHandler\r
160         .word   ADC1_2_IRQHandler\r
161   .word CAN1_TX_IRQHandler\r
162   .word CAN1_RX0_IRQHandler\r
163         .word   CAN1_RX1_IRQHandler\r
164         .word   CAN1_SCE_IRQHandler\r
165         .word   EXTI9_5_IRQHandler\r
166         .word   TIM1_BRK_IRQHandler\r
167         .word   TIM1_UP_IRQHandler\r
168         .word   TIM1_TRG_COM_IRQHandler\r
169         .word   TIM1_CC_IRQHandler\r
170         .word   TIM2_IRQHandler\r
171         .word   TIM3_IRQHandler\r
172         .word   TIM4_IRQHandler\r
173         .word   I2C1_EV_IRQHandler\r
174         .word   I2C1_ER_IRQHandler\r
175         .word   I2C2_EV_IRQHandler\r
176         .word   I2C2_ER_IRQHandler\r
177         .word   SPI1_IRQHandler\r
178         .word   SPI2_IRQHandler\r
179         .word   USART1_IRQHandler\r
180         .word   USART2_IRQHandler\r
181         .word   USART3_IRQHandler\r
182         .word   EXTI15_10_IRQHandler\r
183         .word   RTCAlarm_IRQHandler\r
184         .word   OTG_FS_WKUP_IRQHandler  \r
185   .word 0\r
186         .word   0\r
187         .word   0\r
188         .word   0\r
189         .word   0\r
190         .word   0\r
191         .word   0\r
192         .word TIM5_IRQHandler            \r
193   .word SPI3_IRQHandler            \r
194   .word UART4_IRQHandler           \r
195   .word UART5_IRQHandler           \r
196   .word TIM6_IRQHandler           \r
197   .word TIM7_IRQHandler            \r
198   .word DMA2_Channel1_IRQHandler   \r
199   .word DMA2_Channel2_IRQHandler   \r
200   .word DMA2_Channel3_IRQHandler   \r
201   .word DMA2_Channel4_IRQHandler  \r
202   .word DMA2_Channel5_IRQHandler   \r
203   .word ETH_IRQHandler            \r
204   .word ETH_WKUP_IRQHandler        \r
205   .word CAN2_TX_IRQHandler         \r
206   .word CAN2_RX0_IRQHandler        \r
207   .word CAN2_RX1_IRQHandler        \r
208   .word CAN2_SCE_IRQHandler        \r
209   .word OTG_FS_IRQHandler          \r
210   .word 0\r
211   .word 0\r
212   .word 0\r
213   .word 0\r
214   .word 0\r
215   .word 0\r
216   .word 0\r
217   .word 0           \r
218   .word 0\r
219   .word 0\r
220   .word 0\r
221   .word 0\r
222   .word 0\r
223   .word 0\r
224   .word 0\r
225   .word 0            \r
226   .word 0\r
227   .word 0\r
228   .word 0\r
229   .word 0\r
230   .word 0\r
231   .word 0\r
232   .word 0\r
233   .word 0            \r
234   .word 0\r
235   .word 0\r
236   .word 0\r
237   .word 0\r
238   .word 0\r
239   .word 0\r
240   .word 0\r
241   .word 0            \r
242   .word 0\r
243   .word 0\r
244   .word 0\r
245   .word 0               \r
246   .word BootRAM     /* @0x1E0. This is for boot in RAM mode for \r
247                          STM32F10x Connectivity line Devices. */\r
248     \r
249 /*******************************************************************************\r
250 *\r
251 * Provide weak aliases for each Exception handler to the Default_Handler. \r
252 * As they are weak aliases, any function with the same name will override \r
253 * this definition.\r
254 *\r
255 *******************************************************************************/\r
256   .weak NMI_Handler\r
257         .thumb_set NMI_Handler,Default_Handler\r
258         \r
259   .weak HardFault_Handler\r
260         .thumb_set HardFault_Handler,Default_Handler\r
261         \r
262   .weak MemManage_Handler\r
263         .thumb_set MemManage_Handler,Default_Handler\r
264         \r
265   .weak BusFault_Handler\r
266         .thumb_set BusFault_Handler,Default_Handler\r
267 \r
268         .weak   UsageFault_Handler\r
269         .thumb_set UsageFault_Handler,Default_Handler\r
270 \r
271         .weak   SVC_Handler\r
272         .thumb_set SVC_Handler,Default_Handler\r
273 \r
274         .weak   DebugMon_Handler\r
275         .thumb_set DebugMon_Handler,Default_Handler\r
276 \r
277         .weak   PendSV_Handler\r
278         .thumb_set PendSV_Handler,Default_Handler\r
279 \r
280         .weak   SysTick_Handler\r
281         .thumb_set SysTick_Handler,Default_Handler\r
282 \r
283         .weak   WWDG_IRQHandler\r
284         .thumb_set WWDG_IRQHandler,Default_Handler\r
285 \r
286         .weak   PVD_IRQHandler\r
287         .thumb_set PVD_IRQHandler,Default_Handler\r
288 \r
289         .weak   TAMPER_IRQHandler\r
290         .thumb_set TAMPER_IRQHandler,Default_Handler\r
291 \r
292         .weak   RTC_IRQHandler\r
293         .thumb_set RTC_IRQHandler,Default_Handler\r
294 \r
295         .weak   FLASH_IRQHandler\r
296         .thumb_set FLASH_IRQHandler,Default_Handler\r
297 \r
298         .weak   RCC_IRQHandler\r
299         .thumb_set RCC_IRQHandler,Default_Handler\r
300 \r
301         .weak   EXTI0_IRQHandler\r
302         .thumb_set EXTI0_IRQHandler,Default_Handler\r
303 \r
304         .weak   EXTI1_IRQHandler\r
305         .thumb_set EXTI1_IRQHandler,Default_Handler\r
306 \r
307         .weak   EXTI2_IRQHandler\r
308         .thumb_set EXTI2_IRQHandler,Default_Handler\r
309 \r
310         .weak   EXTI3_IRQHandler\r
311         .thumb_set EXTI3_IRQHandler,Default_Handler\r
312 \r
313         .weak   EXTI4_IRQHandler\r
314         .thumb_set EXTI4_IRQHandler,Default_Handler\r
315 \r
316         .weak   DMA1_Channel1_IRQHandler\r
317         .thumb_set DMA1_Channel1_IRQHandler,Default_Handler\r
318 \r
319         .weak   DMA1_Channel2_IRQHandler\r
320         .thumb_set DMA1_Channel2_IRQHandler,Default_Handler\r
321 \r
322         .weak   DMA1_Channel3_IRQHandler\r
323         .thumb_set DMA1_Channel3_IRQHandler,Default_Handler\r
324 \r
325         .weak   DMA1_Channel4_IRQHandler\r
326         .thumb_set DMA1_Channel4_IRQHandler,Default_Handler\r
327 \r
328         .weak   DMA1_Channel5_IRQHandler\r
329         .thumb_set DMA1_Channel5_IRQHandler,Default_Handler\r
330 \r
331         .weak   DMA1_Channel6_IRQHandler\r
332         .thumb_set DMA1_Channel6_IRQHandler,Default_Handler\r
333 \r
334         .weak   DMA1_Channel7_IRQHandler\r
335         .thumb_set DMA1_Channel7_IRQHandler,Default_Handler\r
336 \r
337         .weak   ADC1_2_IRQHandler\r
338         .thumb_set ADC1_2_IRQHandler,Default_Handler\r
339 \r
340         .weak   CAN1_TX_IRQHandler\r
341         .thumb_set CAN1_TX_IRQHandler,Default_Handler\r
342 \r
343         .weak   CAN1_RX0_IRQHandler\r
344         .thumb_set CAN1_RX0_IRQHandler,Default_Handler\r
345 \r
346         .weak   CAN1_RX1_IRQHandler\r
347         .thumb_set CAN1_RX1_IRQHandler,Default_Handler\r
348 \r
349         .weak   CAN1_SCE_IRQHandler\r
350         .thumb_set CAN1_SCE_IRQHandler,Default_Handler\r
351 \r
352         .weak   EXTI9_5_IRQHandler\r
353         .thumb_set EXTI9_5_IRQHandler,Default_Handler\r
354 \r
355         .weak   TIM1_BRK_IRQHandler\r
356         .thumb_set TIM1_BRK_IRQHandler,Default_Handler\r
357 \r
358         .weak   TIM1_UP_IRQHandler\r
359         .thumb_set TIM1_UP_IRQHandler,Default_Handler\r
360 \r
361         .weak   TIM1_TRG_COM_IRQHandler\r
362         .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler\r
363 \r
364         .weak   TIM1_CC_IRQHandler\r
365         .thumb_set TIM1_CC_IRQHandler,Default_Handler\r
366 \r
367         .weak   TIM2_IRQHandler\r
368         .thumb_set TIM2_IRQHandler,Default_Handler\r
369 \r
370         .weak   TIM3_IRQHandler\r
371         .thumb_set TIM3_IRQHandler,Default_Handler\r
372 \r
373         .weak   TIM4_IRQHandler\r
374         .thumb_set TIM4_IRQHandler,Default_Handler\r
375 \r
376         .weak   I2C1_EV_IRQHandler\r
377         .thumb_set I2C1_EV_IRQHandler,Default_Handler\r
378 \r
379         .weak   I2C1_ER_IRQHandler\r
380         .thumb_set I2C1_ER_IRQHandler,Default_Handler\r
381 \r
382         .weak   I2C2_EV_IRQHandler\r
383         .thumb_set I2C2_EV_IRQHandler,Default_Handler\r
384 \r
385         .weak   I2C2_ER_IRQHandler\r
386         .thumb_set I2C2_ER_IRQHandler,Default_Handler\r
387 \r
388         .weak   SPI1_IRQHandler\r
389         .thumb_set SPI1_IRQHandler,Default_Handler\r
390 \r
391         .weak   SPI2_IRQHandler\r
392         .thumb_set SPI2_IRQHandler,Default_Handler\r
393 \r
394         .weak   USART1_IRQHandler\r
395         .thumb_set USART1_IRQHandler,Default_Handler\r
396 \r
397         .weak   USART2_IRQHandler\r
398         .thumb_set USART2_IRQHandler,Default_Handler\r
399 \r
400         .weak   USART3_IRQHandler\r
401         .thumb_set USART3_IRQHandler,Default_Handler\r
402 \r
403         .weak   EXTI15_10_IRQHandler\r
404         .thumb_set EXTI15_10_IRQHandler,Default_Handler\r
405 \r
406         .weak   RTCAlarm_IRQHandler\r
407         .thumb_set RTCAlarm_IRQHandler,Default_Handler\r
408 \r
409         .weak   OTG_FS_WKUP_IRQHandler\r
410         .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler\r
411 \r
412         .weak   TIM5_IRQHandler\r
413         .thumb_set TIM5_IRQHandler,Default_Handler\r
414 \r
415         .weak   SPI3_IRQHandler \r
416         .thumb_set SPI3_IRQHandler,Default_Handler\r
417 \r
418         .weak   UART4_IRQHandler        \r
419         .thumb_set UART4_IRQHandler,Default_Handler\r
420 \r
421         .weak   UART5_IRQHandler        \r
422         .thumb_set UART5_IRQHandler,Default_Handler\r
423 \r
424         .weak   TIM6_IRQHandler \r
425         .thumb_set TIM6_IRQHandler,Default_Handler\r
426 \r
427         .weak   TIM7_IRQHandler \r
428         .thumb_set TIM7_IRQHandler,Default_Handler\r
429 \r
430         .weak   DMA2_Channel1_IRQHandler        \r
431         .thumb_set DMA2_Channel1_IRQHandler,Default_Handler\r
432 \r
433         .weak   DMA2_Channel2_IRQHandler        \r
434         .thumb_set DMA2_Channel2_IRQHandler,Default_Handler\r
435 \r
436         .weak   DMA2_Channel3_IRQHandler        \r
437         .thumb_set DMA2_Channel3_IRQHandler,Default_Handler\r
438 \r
439         .weak   DMA2_Channel4_IRQHandler        \r
440         .thumb_set DMA2_Channel4_IRQHandler,Default_Handler\r
441 \r
442         .weak   DMA2_Channel5_IRQHandler        \r
443         .thumb_set DMA2_Channel5_IRQHandler,Default_Handler\r
444 \r
445         .weak   ETH_IRQHandler  \r
446         .thumb_set ETH_IRQHandler,Default_Handler\r
447 \r
448         .weak   ETH_WKUP_IRQHandler     \r
449         .thumb_set ETH_WKUP_IRQHandler,Default_Handler\r
450 \r
451         .weak   CAN2_TX_IRQHandler      \r
452         .thumb_set CAN2_TX_IRQHandler,Default_Handler\r
453 \r
454         .weak   CAN2_RX0_IRQHandler     \r
455         .thumb_set CAN2_RX0_IRQHandler,Default_Handler\r
456 \r
457         .weak   CAN2_RX1_IRQHandler     \r
458         .thumb_set CAN2_RX1_IRQHandler,Default_Handler\r
459 \r
460         .weak   CAN2_SCE_IRQHandler     \r
461         .thumb_set CAN2_SCE_IRQHandler,Default_Handler\r
462 \r
463         .weak   OTG_FS_IRQHandler       \r
464         .thumb_set OTG_FS_IRQHandler ,Default_Handler\r
465  \r