]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_M3_NUCLEO_L152RE_GCC/Projects/GCC/Startup/startup_stm32l152retx.s
commit 9f316c246baafa15c542a5aea81a94f26e3d6507
[freertos] / FreeRTOS / Demo / CORTEX_MPU_M3_NUCLEO_L152RE_GCC / Projects / GCC / Startup / startup_stm32l152retx.s
1 /**\r
2   ******************************************************************************\r
3   * @file      startup_stm32l152xe.s\r
4   * @author    MCD Application Team\r
5   * @brief     STM32L152XE Devices vector table for GCC toolchain.\r
6   *            This module performs:\r
7   *                - Set the initial SP\r
8   *                - Set the initial PC == Reset_Handler,\r
9   *                - Set the vector table entries with the exceptions ISR address\r
10   *                - Configure the clock system\r
11   *                - Branches to main in the C library (which eventually\r
12   *                  calls main()).\r
13   *            After Reset the Cortex-M3 processor is in Thread mode,\r
14   *            priority is Privileged, and the Stack is set to Main.\r
15   ******************************************************************************\r
16   *\r
17   * @attention\r
18   *\r
19   * Copyright (c) 2017 STMicroelectronics. All rights reserved.\r
20   *\r
21   * This software component is licensed by ST under BSD 3-Clause license,\r
22   * the "License"; You may not use this file except in compliance with the \r
23   * License. You may obtain a copy of the License at:\r
24   *                        opensource.org/licenses/BSD-3-Clause\r
25   *\r
26   ******************************************************************************\r
27   */\r
28 \r
29   .syntax unified\r
30   .cpu cortex-m3\r
31   .fpu softvfp\r
32   .thumb\r
33 \r
34 .global g_pfnVectors\r
35 .global Default_Handler\r
36 \r
37 /* start address for the initialization values of the .data section.\r
38 defined in linker script */\r
39 .word _sidata\r
40 /* start address for the .data section. defined in linker script */\r
41 .word _sdata\r
42 /* end address for the .data section. defined in linker script */\r
43 .word _edata\r
44 /* start address for the .bss section. defined in linker script */\r
45 .word _sbss\r
46 /* end address for the .bss section. defined in linker script */\r
47 .word _ebss\r
48 \r
49 .equ  BootRAM, 0xF108F85F\r
50 /**\r
51  * @brief  This is the code that gets called when the processor first\r
52  *          starts execution following a reset event. Only the absolutely\r
53  *          necessary set is performed, after which the application\r
54  *          supplied main() routine is called.\r
55  * @param  None\r
56  * @retval : None\r
57 */\r
58 \r
59   .section .text.Reset_Handler\r
60   .weak Reset_Handler\r
61   .type Reset_Handler, %function\r
62 Reset_Handler:\r
63 \r
64 /* Copy the data segment initializers from flash to SRAM */\r
65   movs r1, #0\r
66   b LoopCopyDataInit\r
67 \r
68 CopyDataInit:\r
69   ldr r3, =_sidata\r
70   ldr r3, [r3, r1]\r
71   str r3, [r0, r1]\r
72   adds r1, r1, #4\r
73 \r
74 LoopCopyDataInit:\r
75   ldr r0, =_sdata\r
76   ldr r3, =_edata\r
77   adds r2, r0, r1\r
78   cmp r2, r3\r
79   bcc CopyDataInit\r
80   ldr r2, =_sbss\r
81   b LoopFillZerobss\r
82 /* Zero fill the bss segment. */\r
83 FillZerobss:\r
84   movs r3, #0\r
85   str r3, [r2], #4\r
86 \r
87 LoopFillZerobss:\r
88   ldr r3, = _ebss\r
89   cmp r2, r3\r
90   bcc FillZerobss\r
91 \r
92 /* Call the clock system intitialization function.*/\r
93     bl  SystemInit\r
94 /* Call static constructors */\r
95     bl __libc_init_array\r
96 /* Call the application's entry point.*/\r
97   bl main\r
98   bx lr\r
99 .size Reset_Handler, .-Reset_Handler\r
100 \r
101 /**\r
102  * @brief  This is the code that gets called when the processor receives an\r
103  *         unexpected interrupt.  This simply enters an infinite loop, preserving\r
104  *         the system state for examination by a debugger.\r
105  *\r
106  * @param  None\r
107  * @retval : None\r
108 */\r
109     .section .text.Default_Handler,"ax",%progbits\r
110 Default_Handler:\r
111 Infinite_Loop:\r
112   b Infinite_Loop\r
113   .size Default_Handler, .-Default_Handler\r
114 /******************************************************************************\r
115 *\r
116 * The minimal vector table for a Cortex M3.  Note that the proper constructs\r
117 * must be placed on this to ensure that it ends up at physical address\r
118 * 0x0000.0000.\r
119 *\r
120 ******************************************************************************/\r
121    .section .isr_vector,"a",%progbits\r
122   .type g_pfnVectors, %object\r
123   .size g_pfnVectors, .-g_pfnVectors\r
124 \r
125 \r
126 g_pfnVectors:\r
127   .word _estack\r
128   .word Reset_Handler\r
129   .word NMI_Handler\r
130   .word HardFault_Handler\r
131   .word MemManage_Handler\r
132   .word BusFault_Handler\r
133   .word UsageFault_Handler\r
134   .word 0\r
135   .word 0\r
136   .word 0\r
137   .word 0\r
138   .word SVC_Handler\r
139   .word DebugMon_Handler\r
140   .word 0\r
141   .word PendSV_Handler\r
142   .word SysTick_Handler\r
143   .word WWDG_IRQHandler\r
144   .word PVD_IRQHandler\r
145   .word TAMPER_STAMP_IRQHandler\r
146   .word RTC_WKUP_IRQHandler\r
147   .word FLASH_IRQHandler\r
148   .word RCC_IRQHandler\r
149   .word EXTI0_IRQHandler\r
150   .word EXTI1_IRQHandler\r
151   .word EXTI2_IRQHandler\r
152   .word EXTI3_IRQHandler\r
153   .word EXTI4_IRQHandler\r
154   .word DMA1_Channel1_IRQHandler\r
155   .word DMA1_Channel2_IRQHandler\r
156   .word DMA1_Channel3_IRQHandler\r
157   .word DMA1_Channel4_IRQHandler\r
158   .word DMA1_Channel5_IRQHandler\r
159   .word DMA1_Channel6_IRQHandler\r
160   .word DMA1_Channel7_IRQHandler\r
161   .word ADC1_IRQHandler\r
162   .word USB_HP_IRQHandler\r
163   .word USB_LP_IRQHandler\r
164   .word DAC_IRQHandler\r
165   .word COMP_IRQHandler\r
166   .word EXTI9_5_IRQHandler\r
167   .word LCD_IRQHandler  \r
168   .word TIM9_IRQHandler\r
169   .word TIM10_IRQHandler\r
170   .word TIM11_IRQHandler\r
171   .word TIM2_IRQHandler\r
172   .word TIM3_IRQHandler\r
173   .word TIM4_IRQHandler\r
174   .word I2C1_EV_IRQHandler\r
175   .word I2C1_ER_IRQHandler\r
176   .word I2C2_EV_IRQHandler\r
177   .word I2C2_ER_IRQHandler\r
178   .word SPI1_IRQHandler\r
179   .word SPI2_IRQHandler\r
180   .word USART1_IRQHandler\r
181   .word USART2_IRQHandler\r
182   .word USART3_IRQHandler\r
183   .word EXTI15_10_IRQHandler\r
184   .word RTC_Alarm_IRQHandler\r
185   .word USB_FS_WKUP_IRQHandler\r
186   .word TIM6_IRQHandler\r
187   .word TIM7_IRQHandler\r
188   .word 0\r
189   .word TIM5_IRQHandler\r
190   .word SPI3_IRQHandler\r
191   .word UART4_IRQHandler\r
192   .word UART5_IRQHandler\r
193   .word DMA2_Channel1_IRQHandler\r
194   .word DMA2_Channel2_IRQHandler\r
195   .word DMA2_Channel3_IRQHandler\r
196   .word DMA2_Channel4_IRQHandler\r
197   .word DMA2_Channel5_IRQHandler\r
198   .word 0\r
199   .word COMP_ACQ_IRQHandler\r
200   .word 0\r
201   .word 0\r
202   .word 0\r
203   .word 0\r
204   .word 0\r
205   .word BootRAM          /* @0x108. This is for boot in RAM mode for \r
206                             STM32L152XE devices. */\r
207 \r
208 /*******************************************************************************\r
209 *\r
210 * Provide weak aliases for each Exception handler to the Default_Handler.\r
211 * As they are weak aliases, any function with the same name will override\r
212 * this definition.\r
213 *\r
214 *******************************************************************************/\r
215 \r
216   .weak NMI_Handler\r
217   .thumb_set NMI_Handler,Default_Handler\r
218 \r
219   .weak HardFault_Handler\r
220   .thumb_set HardFault_Handler,Default_Handler\r
221 \r
222   .weak MemManage_Handler\r
223   .thumb_set MemManage_Handler,Default_Handler\r
224 \r
225   .weak BusFault_Handler\r
226   .thumb_set BusFault_Handler,Default_Handler\r
227 \r
228   .weak UsageFault_Handler\r
229   .thumb_set UsageFault_Handler,Default_Handler\r
230 \r
231   .weak SVC_Handler\r
232   .thumb_set SVC_Handler,Default_Handler\r
233 \r
234   .weak DebugMon_Handler\r
235   .thumb_set DebugMon_Handler,Default_Handler\r
236 \r
237   .weak PendSV_Handler\r
238   .thumb_set PendSV_Handler,Default_Handler\r
239 \r
240   .weak SysTick_Handler\r
241   .thumb_set SysTick_Handler,Default_Handler\r
242 \r
243   .weak WWDG_IRQHandler\r
244   .thumb_set WWDG_IRQHandler,Default_Handler\r
245 \r
246   .weak PVD_IRQHandler\r
247   .thumb_set PVD_IRQHandler,Default_Handler\r
248 \r
249   .weak TAMPER_STAMP_IRQHandler\r
250   .thumb_set TAMPER_STAMP_IRQHandler,Default_Handler\r
251 \r
252   .weak RTC_WKUP_IRQHandler\r
253   .thumb_set RTC_WKUP_IRQHandler,Default_Handler\r
254 \r
255   .weak FLASH_IRQHandler\r
256   .thumb_set FLASH_IRQHandler,Default_Handler\r
257 \r
258   .weak RCC_IRQHandler\r
259   .thumb_set RCC_IRQHandler,Default_Handler\r
260 \r
261   .weak EXTI0_IRQHandler\r
262   .thumb_set EXTI0_IRQHandler,Default_Handler\r
263 \r
264   .weak EXTI1_IRQHandler\r
265   .thumb_set EXTI1_IRQHandler,Default_Handler\r
266 \r
267   .weak EXTI2_IRQHandler\r
268   .thumb_set EXTI2_IRQHandler,Default_Handler\r
269 \r
270   .weak EXTI3_IRQHandler\r
271   .thumb_set EXTI3_IRQHandler,Default_Handler\r
272 \r
273   .weak EXTI4_IRQHandler\r
274   .thumb_set EXTI4_IRQHandler,Default_Handler\r
275 \r
276   .weak DMA1_Channel1_IRQHandler\r
277   .thumb_set DMA1_Channel1_IRQHandler,Default_Handler\r
278 \r
279   .weak DMA1_Channel2_IRQHandler\r
280   .thumb_set DMA1_Channel2_IRQHandler,Default_Handler\r
281 \r
282   .weak DMA1_Channel3_IRQHandler\r
283   .thumb_set DMA1_Channel3_IRQHandler,Default_Handler\r
284 \r
285   .weak DMA1_Channel4_IRQHandler\r
286   .thumb_set DMA1_Channel4_IRQHandler,Default_Handler\r
287 \r
288   .weak DMA1_Channel5_IRQHandler\r
289   .thumb_set DMA1_Channel5_IRQHandler,Default_Handler\r
290 \r
291   .weak DMA1_Channel6_IRQHandler\r
292   .thumb_set DMA1_Channel6_IRQHandler,Default_Handler\r
293 \r
294   .weak DMA1_Channel7_IRQHandler\r
295   .thumb_set DMA1_Channel7_IRQHandler,Default_Handler\r
296 \r
297   .weak ADC1_IRQHandler\r
298   .thumb_set ADC1_IRQHandler,Default_Handler\r
299 \r
300   .weak USB_HP_IRQHandler\r
301   .thumb_set USB_HP_IRQHandler,Default_Handler\r
302 \r
303   .weak USB_LP_IRQHandler\r
304   .thumb_set USB_LP_IRQHandler,Default_Handler\r
305 \r
306   .weak DAC_IRQHandler\r
307   .thumb_set DAC_IRQHandler,Default_Handler\r
308 \r
309   .weak COMP_IRQHandler\r
310   .thumb_set COMP_IRQHandler,Default_Handler\r
311 \r
312   .weak EXTI9_5_IRQHandler\r
313   .thumb_set EXTI9_5_IRQHandler,Default_Handler\r
314 \r
315   .weak LCD_IRQHandler\r
316   .thumb_set LCD_IRQHandler,Default_Handler  \r
317 \r
318   .weak TIM9_IRQHandler\r
319   .thumb_set TIM9_IRQHandler,Default_Handler\r
320 \r
321   .weak TIM10_IRQHandler\r
322   .thumb_set TIM10_IRQHandler,Default_Handler\r
323 \r
324   .weak TIM11_IRQHandler\r
325   .thumb_set TIM11_IRQHandler,Default_Handler\r
326 \r
327   .weak TIM2_IRQHandler\r
328   .thumb_set TIM2_IRQHandler,Default_Handler\r
329 \r
330   .weak TIM3_IRQHandler\r
331   .thumb_set TIM3_IRQHandler,Default_Handler\r
332 \r
333   .weak TIM4_IRQHandler\r
334   .thumb_set TIM4_IRQHandler,Default_Handler\r
335 \r
336   .weak I2C1_EV_IRQHandler\r
337   .thumb_set I2C1_EV_IRQHandler,Default_Handler\r
338 \r
339   .weak I2C1_ER_IRQHandler\r
340   .thumb_set I2C1_ER_IRQHandler,Default_Handler\r
341 \r
342   .weak I2C2_EV_IRQHandler\r
343   .thumb_set I2C2_EV_IRQHandler,Default_Handler\r
344 \r
345   .weak I2C2_ER_IRQHandler\r
346   .thumb_set I2C2_ER_IRQHandler,Default_Handler\r
347 \r
348   .weak SPI1_IRQHandler\r
349   .thumb_set SPI1_IRQHandler,Default_Handler\r
350 \r
351   .weak SPI2_IRQHandler\r
352   .thumb_set SPI2_IRQHandler,Default_Handler\r
353 \r
354   .weak USART1_IRQHandler\r
355   .thumb_set USART1_IRQHandler,Default_Handler\r
356 \r
357   .weak USART2_IRQHandler\r
358   .thumb_set USART2_IRQHandler,Default_Handler\r
359 \r
360   .weak USART3_IRQHandler\r
361   .thumb_set USART3_IRQHandler,Default_Handler\r
362 \r
363   .weak EXTI15_10_IRQHandler\r
364   .thumb_set EXTI15_10_IRQHandler,Default_Handler\r
365 \r
366   .weak RTC_Alarm_IRQHandler\r
367   .thumb_set RTC_Alarm_IRQHandler,Default_Handler\r
368 \r
369   .weak USB_FS_WKUP_IRQHandler\r
370   .thumb_set USB_FS_WKUP_IRQHandler,Default_Handler\r
371 \r
372   .weak TIM6_IRQHandler\r
373   .thumb_set TIM6_IRQHandler,Default_Handler\r
374 \r
375   .weak TIM7_IRQHandler\r
376   .thumb_set TIM7_IRQHandler,Default_Handler\r
377 \r
378   .weak TIM5_IRQHandler\r
379   .thumb_set TIM5_IRQHandler,Default_Handler\r
380   \r
381   .weak SPI3_IRQHandler\r
382   .thumb_set SPI3_IRQHandler,Default_Handler\r
383 \r
384   .weak UART4_IRQHandler\r
385   .thumb_set UART4_IRQHandler,Default_Handler\r
386 \r
387   .weak UART5_IRQHandler\r
388   .thumb_set UART5_IRQHandler,Default_Handler\r
389   \r
390   .weak DMA2_Channel1_IRQHandler\r
391   .thumb_set DMA2_Channel1_IRQHandler,Default_Handler\r
392 \r
393   .weak DMA2_Channel2_IRQHandler\r
394   .thumb_set DMA2_Channel2_IRQHandler,Default_Handler\r
395 \r
396   .weak DMA2_Channel3_IRQHandler\r
397   .thumb_set DMA2_Channel3_IRQHandler,Default_Handler\r
398 \r
399   .weak DMA2_Channel4_IRQHandler\r
400   .thumb_set DMA2_Channel4_IRQHandler,Default_Handler\r
401 \r
402   .weak DMA2_Channel5_IRQHandler\r
403   .thumb_set DMA2_Channel5_IRQHandler,Default_Handler\r
404 \r
405   .weak COMP_ACQ_IRQHandler\r
406    .thumb_set COMP_ACQ_IRQHandler,Default_Handler\r
407 \r
408 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
409 \r