DSO138_SourceCodes_v037.rar
[DSO138] / Libraries / CMSIS / CM3 / DeviceSupport / ST / STM32F10x / startup / TrueSTUDIO / startup_stm32f10x_md.s
1 /**\r
2  ******************************************************************************\r
3  * @file      startup_stm32f10x_md.s\r
4  * @author    MCD Application Team\r
5  * @version   V3.3.0\r
6  * @date      04/16/2010\r
7  * @brief     STM32F10x Medium 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  *                - 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 2010 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, 0xF108F85F\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 /* Zero fill the bss segment. */\r
85 FillZerobss:\r
86         movs    r3, #0\r
87         str     r3, [r2], #4\r
88 \r
89 LoopFillZerobss:\r
90         ldr     r3, = _ebss\r
91         cmp     r2, r3\r
92         bcc     FillZerobss\r
93 \r
94 /* Call the clock system intitialization function.*/\r
95     bl  SystemInit\r
96 /* Call static constructors */\r
97     bl __libc_init_array\r
98 /* Call the application's entry point.*/\r
99         bl      main\r
100         bx      lr\r
101 .size   Reset_Handler, .-Reset_Handler\r
102 \r
103 /**\r
104  * @brief  This is the code that gets called when the processor receives an\r
105  *         unexpected interrupt.  This simply enters an infinite loop, preserving\r
106  *         the system state for examination by a debugger.\r
107  *\r
108  * @param  None\r
109  * @retval : None\r
110 */\r
111     .section    .text.Default_Handler,"ax",%progbits\r
112 Default_Handler:\r
113 Infinite_Loop:\r
114         b       Infinite_Loop\r
115         .size   Default_Handler, .-Default_Handler\r
116 /******************************************************************************\r
117 *\r
118 * The minimal vector table for a Cortex M3.  Note that the proper constructs\r
119 * must be placed on this to ensure that it ends up at physical address\r
120 * 0x0000.0000.\r
121 *\r
122 ******************************************************************************/\r
123         .section        .isr_vector,"a",%progbits\r
124         .type   g_pfnVectors, %object\r
125         .size   g_pfnVectors, .-g_pfnVectors\r
126 \r
127 \r
128 g_pfnVectors:\r
129         .word   _estack\r
130         .word   Reset_Handler\r
131         .word   NMI_Handler\r
132         .word   HardFault_Handler\r
133         .word   MemManage_Handler\r
134         .word   BusFault_Handler\r
135         .word   UsageFault_Handler\r
136         .word   0\r
137         .word   0\r
138         .word   0\r
139         .word   0\r
140         .word   SVC_Handler\r
141         .word   DebugMon_Handler\r
142         .word   0\r
143         .word   PendSV_Handler\r
144         .word   SysTick_Handler\r
145         .word   WWDG_IRQHandler\r
146         .word   PVD_IRQHandler\r
147         .word   TAMPER_IRQHandler\r
148         .word   RTC_IRQHandler\r
149         .word   FLASH_IRQHandler\r
150         .word   RCC_IRQHandler\r
151         .word   EXTI0_IRQHandler\r
152         .word   EXTI1_IRQHandler\r
153         .word   EXTI2_IRQHandler\r
154         .word   EXTI3_IRQHandler\r
155         .word   EXTI4_IRQHandler\r
156         .word   DMA1_Channel1_IRQHandler\r
157         .word   DMA1_Channel2_IRQHandler\r
158         .word   DMA1_Channel3_IRQHandler\r
159         .word   DMA1_Channel4_IRQHandler\r
160         .word   DMA1_Channel5_IRQHandler\r
161         .word   DMA1_Channel6_IRQHandler\r
162         .word   DMA1_Channel7_IRQHandler\r
163         .word   ADC1_2_IRQHandler\r
164         .word   USB_HP_CAN1_TX_IRQHandler\r
165         .word   USB_LP_CAN1_RX0_IRQHandler\r
166         .word   CAN1_RX1_IRQHandler\r
167         .word   CAN1_SCE_IRQHandler\r
168         .word   EXTI9_5_IRQHandler\r
169         .word   TIM1_BRK_IRQHandler\r
170         .word   TIM1_UP_IRQHandler\r
171         .word   TIM1_TRG_COM_IRQHandler\r
172         .word   TIM1_CC_IRQHandler\r
173         .word   TIM2_IRQHandler\r
174         .word   TIM3_IRQHandler\r
175         .word   TIM4_IRQHandler\r
176         .word   I2C1_EV_IRQHandler\r
177         .word   I2C1_ER_IRQHandler\r
178         .word   I2C2_EV_IRQHandler\r
179         .word   I2C2_ER_IRQHandler\r
180         .word   SPI1_IRQHandler\r
181         .word   SPI2_IRQHandler\r
182         .word   USART1_IRQHandler\r
183         .word   USART2_IRQHandler\r
184         .word   USART3_IRQHandler\r
185         .word   EXTI15_10_IRQHandler\r
186         .word   RTCAlarm_IRQHandler\r
187         .word   USBWakeUp_IRQHandler\r
188   .word 0\r
189         .word   0\r
190         .word   0\r
191         .word   0\r
192         .word   0\r
193         .word   0\r
194         .word   0\r
195         .word   BootRAM          /* @0x108. This is for boot in RAM mode for\r
196                             STM32F10x Medium Density devices. */\r
197 \r
198 /*******************************************************************************\r
199 *\r
200 * Provide weak aliases for each Exception handler to the Default_Handler.\r
201 * As they are weak aliases, any function with the same name will override\r
202 * this definition.\r
203 *\r
204 *******************************************************************************/\r
205 \r
206   .weak NMI_Handler\r
207         .thumb_set NMI_Handler,Default_Handler\r
208 \r
209   .weak HardFault_Handler\r
210         .thumb_set HardFault_Handler,Default_Handler\r
211 \r
212   .weak MemManage_Handler\r
213         .thumb_set MemManage_Handler,Default_Handler\r
214 \r
215   .weak BusFault_Handler\r
216         .thumb_set BusFault_Handler,Default_Handler\r
217 \r
218         .weak   UsageFault_Handler\r
219         .thumb_set UsageFault_Handler,Default_Handler\r
220 \r
221         .weak   SVC_Handler\r
222         .thumb_set SVC_Handler,Default_Handler\r
223 \r
224         .weak   DebugMon_Handler\r
225         .thumb_set DebugMon_Handler,Default_Handler\r
226 \r
227         .weak   PendSV_Handler\r
228         .thumb_set PendSV_Handler,Default_Handler\r
229 \r
230         .weak   SysTick_Handler\r
231         .thumb_set SysTick_Handler,Default_Handler\r
232 \r
233         .weak   WWDG_IRQHandler\r
234         .thumb_set WWDG_IRQHandler,Default_Handler\r
235 \r
236         .weak   PVD_IRQHandler\r
237         .thumb_set PVD_IRQHandler,Default_Handler\r
238 \r
239         .weak   TAMPER_IRQHandler\r
240         .thumb_set TAMPER_IRQHandler,Default_Handler\r
241 \r
242         .weak   RTC_IRQHandler\r
243         .thumb_set RTC_IRQHandler,Default_Handler\r
244 \r
245         .weak   FLASH_IRQHandler\r
246         .thumb_set FLASH_IRQHandler,Default_Handler\r
247 \r
248         .weak   RCC_IRQHandler\r
249         .thumb_set RCC_IRQHandler,Default_Handler\r
250 \r
251         .weak   EXTI0_IRQHandler\r
252         .thumb_set EXTI0_IRQHandler,Default_Handler\r
253 \r
254         .weak   EXTI1_IRQHandler\r
255         .thumb_set EXTI1_IRQHandler,Default_Handler\r
256 \r
257         .weak   EXTI2_IRQHandler\r
258         .thumb_set EXTI2_IRQHandler,Default_Handler\r
259 \r
260         .weak   EXTI3_IRQHandler\r
261         .thumb_set EXTI3_IRQHandler,Default_Handler\r
262 \r
263         .weak   EXTI4_IRQHandler\r
264         .thumb_set EXTI4_IRQHandler,Default_Handler\r
265 \r
266         .weak   DMA1_Channel1_IRQHandler\r
267         .thumb_set DMA1_Channel1_IRQHandler,Default_Handler\r
268 \r
269         .weak   DMA1_Channel2_IRQHandler\r
270         .thumb_set DMA1_Channel2_IRQHandler,Default_Handler\r
271 \r
272         .weak   DMA1_Channel3_IRQHandler\r
273         .thumb_set DMA1_Channel3_IRQHandler,Default_Handler\r
274 \r
275         .weak   DMA1_Channel4_IRQHandler\r
276         .thumb_set DMA1_Channel4_IRQHandler,Default_Handler\r
277 \r
278         .weak   DMA1_Channel5_IRQHandler\r
279         .thumb_set DMA1_Channel5_IRQHandler,Default_Handler\r
280 \r
281         .weak   DMA1_Channel6_IRQHandler\r
282         .thumb_set DMA1_Channel6_IRQHandler,Default_Handler\r
283 \r
284         .weak   DMA1_Channel7_IRQHandler\r
285         .thumb_set DMA1_Channel7_IRQHandler,Default_Handler\r
286 \r
287         .weak   ADC1_2_IRQHandler\r
288         .thumb_set ADC1_2_IRQHandler,Default_Handler\r
289 \r
290         .weak   USB_HP_CAN1_TX_IRQHandler\r
291         .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler\r
292 \r
293         .weak   USB_LP_CAN1_RX0_IRQHandler\r
294         .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler\r
295 \r
296         .weak   CAN1_RX1_IRQHandler\r
297         .thumb_set CAN1_RX1_IRQHandler,Default_Handler\r
298 \r
299         .weak   CAN1_SCE_IRQHandler\r
300         .thumb_set CAN1_SCE_IRQHandler,Default_Handler\r
301 \r
302         .weak   EXTI9_5_IRQHandler\r
303         .thumb_set EXTI9_5_IRQHandler,Default_Handler\r
304 \r
305         .weak   TIM1_BRK_IRQHandler\r
306         .thumb_set TIM1_BRK_IRQHandler,Default_Handler\r
307 \r
308         .weak   TIM1_UP_IRQHandler\r
309         .thumb_set TIM1_UP_IRQHandler,Default_Handler\r
310 \r
311         .weak   TIM1_TRG_COM_IRQHandler\r
312         .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler\r
313 \r
314         .weak   TIM1_CC_IRQHandler\r
315         .thumb_set TIM1_CC_IRQHandler,Default_Handler\r
316 \r
317         .weak   TIM2_IRQHandler\r
318         .thumb_set TIM2_IRQHandler,Default_Handler\r
319 \r
320         .weak   TIM3_IRQHandler\r
321         .thumb_set TIM3_IRQHandler,Default_Handler\r
322 \r
323         .weak   TIM4_IRQHandler\r
324         .thumb_set TIM4_IRQHandler,Default_Handler\r
325 \r
326         .weak   I2C1_EV_IRQHandler\r
327         .thumb_set I2C1_EV_IRQHandler,Default_Handler\r
328 \r
329         .weak   I2C1_ER_IRQHandler\r
330         .thumb_set I2C1_ER_IRQHandler,Default_Handler\r
331 \r
332         .weak   I2C2_EV_IRQHandler\r
333         .thumb_set I2C2_EV_IRQHandler,Default_Handler\r
334 \r
335         .weak   I2C2_ER_IRQHandler\r
336         .thumb_set I2C2_ER_IRQHandler,Default_Handler\r
337 \r
338         .weak   SPI1_IRQHandler\r
339         .thumb_set SPI1_IRQHandler,Default_Handler\r
340 \r
341         .weak   SPI2_IRQHandler\r
342         .thumb_set SPI2_IRQHandler,Default_Handler\r
343 \r
344         .weak   USART1_IRQHandler\r
345         .thumb_set USART1_IRQHandler,Default_Handler\r
346 \r
347         .weak   USART2_IRQHandler\r
348         .thumb_set USART2_IRQHandler,Default_Handler\r
349 \r
350         .weak   USART3_IRQHandler\r
351         .thumb_set USART3_IRQHandler,Default_Handler\r
352 \r
353         .weak   EXTI15_10_IRQHandler\r
354         .thumb_set EXTI15_10_IRQHandler,Default_Handler\r
355 \r
356         .weak   RTCAlarm_IRQHandler\r
357         .thumb_set RTCAlarm_IRQHandler,Default_Handler\r
358 \r
359         .weak   USBWakeUp_IRQHandler\r
360         .thumb_set USBWakeUp_IRQHandler,Default_Handler\r
361 \r
362 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/\r
363 \r