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