]> mj.ucw.cz Git - home-hw.git/blob - startup_stm32f030x8.s
Files auto-generated by Cube MX
[home-hw.git] / startup_stm32f030x8.s
1 /**\r
2   ******************************************************************************\r
3   * @file      startup_stm32f030x8.s\r
4   * @author    MCD Application Team\r
5   * @brief     STM32F030x8 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   *                - Branches to main in the C library (which eventually\r
11   *                  calls main()).\r
12   *            After Reset the Cortex-M0 processor is in Thread mode,\r
13   *            priority is Privileged, and the Stack is set to Main.\r
14   ******************************************************************************\r
15   * \r
16   * Redistribution and use in source and binary forms, with or without modification,\r
17   * are permitted provided that the following conditions are met:\r
18   *   1. Redistributions of source code must retain the above copyright notice,\r
19   *      this list of conditions and the following disclaimer.\r
20   *   2. Redistributions in binary form must reproduce the above copyright notice,\r
21   *      this list of conditions and the following disclaimer in the documentation\r
22   *      and/or other materials provided with the distribution.\r
23   *   3. Neither the name of STMicroelectronics nor the names of its contributors\r
24   *      may be used to endorse or promote products derived from this software\r
25   *      without specific prior written permission.\r
26   *\r
27   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
28   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
29   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
30   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\r
31   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
32   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
33   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
34   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\r
35   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
36   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
37   *\r
38   ******************************************************************************\r
39   */\r
40 \r
41   .syntax unified\r
42   .cpu cortex-m0\r
43   .fpu softvfp\r
44   .thumb\r
45 \r
46 .global g_pfnVectors\r
47 .global Default_Handler\r
48 \r
49 /* start address for the initialization values of the .data section.\r
50 defined in linker script */\r
51 .word _sidata\r
52 /* start address for the .data section. defined in linker script */\r
53 .word _sdata\r
54 /* end address for the .data section. defined in linker script */\r
55 .word _edata\r
56 /* start address for the .bss section. defined in linker script */\r
57 .word _sbss\r
58 /* end address for the .bss section. defined in linker script */\r
59 .word _ebss\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   ldr   r0, =_estack\r
66   mov   sp, r0          /* set stack pointer */\r
67 \r
68 /* Copy the data segment initializers from flash to SRAM */\r
69   ldr r0, =_sdata\r
70   ldr r1, =_edata\r
71   ldr r2, =_sidata\r
72   movs r3, #0\r
73   b LoopCopyDataInit\r
74 \r
75 CopyDataInit:\r
76   ldr r4, [r2, r3]\r
77   str r4, [r0, r3]\r
78   adds r3, r3, #4\r
79 \r
80 LoopCopyDataInit:\r
81   adds r4, r0, r3\r
82   cmp r4, r1\r
83   bcc CopyDataInit\r
84   \r
85 /* Zero fill the bss segment. */\r
86   ldr r2, =_sbss\r
87   ldr r4, =_ebss\r
88   movs r3, #0\r
89   b LoopFillZerobss\r
90 \r
91 FillZerobss:\r
92   str  r3, [r2]\r
93   adds r2, r2, #4\r
94 \r
95 LoopFillZerobss:\r
96   cmp r2, r4\r
97   bcc FillZerobss\r
98 \r
99 /* Call the clock system intitialization function.*/\r
100   bl  SystemInit\r
101 /* Call static constructors */\r
102   bl __libc_init_array\r
103 /* Call the application's entry point.*/\r
104   bl main\r
105 \r
106 LoopForever:\r
107     b LoopForever\r
108 \r
109 \r
110 .size Reset_Handler, .-Reset_Handler\r
111 \r
112 /**\r
113  * @brief  This is the code that gets called when the processor receives an\r
114  *         unexpected interrupt.  This simply enters an infinite loop, preserving\r
115  *         the system state for examination by a debugger.\r
116  *\r
117  * @param  None\r
118  * @retval : None\r
119 */\r
120     .section .text.Default_Handler,"ax",%progbits\r
121 Default_Handler:\r
122 Infinite_Loop:\r
123   b Infinite_Loop\r
124   .size Default_Handler, .-Default_Handler\r
125 /******************************************************************************\r
126 *\r
127 * The minimal vector table for a Cortex M0.  Note that the proper constructs\r
128 * must be placed on this to ensure that it ends up at physical address\r
129 * 0x0000.0000.\r
130 *\r
131 ******************************************************************************/\r
132    .section .isr_vector,"a",%progbits\r
133   .type g_pfnVectors, %object\r
134   .size g_pfnVectors, .-g_pfnVectors\r
135 \r
136 \r
137 g_pfnVectors:\r
138   .word  _estack\r
139   .word  Reset_Handler\r
140   .word  NMI_Handler\r
141   .word  HardFault_Handler\r
142   .word  0\r
143   .word  0\r
144   .word  0\r
145   .word  0\r
146   .word  0\r
147   .word  0\r
148   .word  0\r
149   .word  SVC_Handler\r
150   .word  0\r
151   .word  0\r
152   .word  PendSV_Handler\r
153   .word  SysTick_Handler\r
154   .word  WWDG_IRQHandler                   /* Window WatchDog              */\r
155   .word  0                                 /* Reserved                     */\r
156   .word  RTC_IRQHandler                    /* RTC through the EXTI line    */\r
157   .word  FLASH_IRQHandler                  /* FLASH                        */\r
158   .word  RCC_IRQHandler                    /* RCC                          */\r
159   .word  EXTI0_1_IRQHandler                /* EXTI Line 0 and 1            */\r
160   .word  EXTI2_3_IRQHandler                /* EXTI Line 2 and 3            */\r
161   .word  EXTI4_15_IRQHandler               /* EXTI Line 4 to 15            */\r
162   .word  0                                 /* Reserved                     */\r
163   .word  DMA1_Channel1_IRQHandler          /* DMA1 Channel 1               */\r
164   .word  DMA1_Channel2_3_IRQHandler        /* DMA1 Channel 2 and Channel 3 */\r
165   .word  DMA1_Channel4_5_IRQHandler        /* DMA1 Channel 4 and Channel 5 */\r
166   .word  ADC1_IRQHandler                   /* ADC1                         */\r
167   .word  TIM1_BRK_UP_TRG_COM_IRQHandler    /* TIM1 Break, Update, Trigger and Commutation */\r
168   .word  TIM1_CC_IRQHandler                /* TIM1 Capture Compare         */\r
169   .word  0                                 /* Reserved                     */\r
170   .word  TIM3_IRQHandler                   /* TIM3                         */\r
171   .word  TIM6_IRQHandler                   /* TIM6                         */\r
172   .word  0                                 /* Reserved                     */\r
173   .word  TIM14_IRQHandler                  /* TIM14                        */\r
174   .word  TIM15_IRQHandler                  /* TIM15                        */\r
175   .word  TIM16_IRQHandler                  /* TIM16                        */\r
176   .word  TIM17_IRQHandler                  /* TIM17                        */\r
177   .word  I2C1_IRQHandler                   /* I2C1                         */\r
178   .word  I2C2_IRQHandler                   /* I2C2                         */\r
179   .word  SPI1_IRQHandler                   /* SPI1                         */\r
180   .word  SPI2_IRQHandler                   /* SPI2                         */\r
181   .word  USART1_IRQHandler                 /* USART1                       */\r
182   .word  USART2_IRQHandler                 /* USART2                       */\r
183   .word  0                                 /* Reserved                     */\r
184   .word  0                                 /* Reserved                     */\r
185   .word  0                                 /* Reserved                     */\r
186 \r
187 /*******************************************************************************\r
188 *\r
189 * Provide weak aliases for each Exception handler to the Default_Handler.\r
190 * As they are weak aliases, any function with the same name will override\r
191 * this definition.\r
192 *\r
193 *******************************************************************************/\r
194 \r
195   .weak      NMI_Handler\r
196   .thumb_set NMI_Handler,Default_Handler\r
197 \r
198   .weak      HardFault_Handler\r
199   .thumb_set HardFault_Handler,Default_Handler\r
200 \r
201   .weak      SVC_Handler\r
202   .thumb_set SVC_Handler,Default_Handler\r
203 \r
204   .weak      PendSV_Handler\r
205   .thumb_set PendSV_Handler,Default_Handler\r
206 \r
207   .weak      SysTick_Handler\r
208   .thumb_set SysTick_Handler,Default_Handler\r
209 \r
210   .weak      WWDG_IRQHandler\r
211   .thumb_set WWDG_IRQHandler,Default_Handler\r
212 \r
213   .weak      RTC_IRQHandler\r
214   .thumb_set RTC_IRQHandler,Default_Handler\r
215 \r
216   .weak      FLASH_IRQHandler\r
217   .thumb_set FLASH_IRQHandler,Default_Handler\r
218 \r
219   .weak      RCC_IRQHandler\r
220   .thumb_set RCC_IRQHandler,Default_Handler\r
221 \r
222   .weak      EXTI0_1_IRQHandler\r
223   .thumb_set EXTI0_1_IRQHandler,Default_Handler\r
224 \r
225   .weak      EXTI2_3_IRQHandler\r
226   .thumb_set EXTI2_3_IRQHandler,Default_Handler\r
227 \r
228   .weak      EXTI4_15_IRQHandler\r
229   .thumb_set EXTI4_15_IRQHandler,Default_Handler\r
230 \r
231   .weak      DMA1_Channel1_IRQHandler\r
232   .thumb_set DMA1_Channel1_IRQHandler,Default_Handler\r
233 \r
234   .weak      DMA1_Channel2_3_IRQHandler\r
235   .thumb_set DMA1_Channel2_3_IRQHandler,Default_Handler\r
236 \r
237   .weak      DMA1_Channel4_5_IRQHandler\r
238   .thumb_set DMA1_Channel4_5_IRQHandler,Default_Handler\r
239 \r
240   .weak      ADC1_IRQHandler\r
241   .thumb_set ADC1_IRQHandler,Default_Handler\r
242 \r
243   .weak      TIM1_BRK_UP_TRG_COM_IRQHandler\r
244   .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler\r
245 \r
246   .weak      TIM1_CC_IRQHandler\r
247   .thumb_set TIM1_CC_IRQHandler,Default_Handler\r
248 \r
249   .weak      TIM3_IRQHandler\r
250   .thumb_set TIM3_IRQHandler,Default_Handler\r
251 \r
252   .weak      TIM6_IRQHandler\r
253   .thumb_set TIM6_IRQHandler,Default_Handler\r
254 \r
255   .weak      TIM14_IRQHandler\r
256   .thumb_set TIM14_IRQHandler,Default_Handler\r
257 \r
258   .weak      TIM15_IRQHandler\r
259   .thumb_set TIM15_IRQHandler,Default_Handler\r
260 \r
261   .weak      TIM16_IRQHandler\r
262   .thumb_set TIM16_IRQHandler,Default_Handler\r
263 \r
264   .weak      TIM17_IRQHandler\r
265   .thumb_set TIM17_IRQHandler,Default_Handler\r
266 \r
267   .weak      I2C1_IRQHandler\r
268   .thumb_set I2C1_IRQHandler,Default_Handler\r
269 \r
270   .weak      I2C2_IRQHandler\r
271   .thumb_set I2C2_IRQHandler,Default_Handler\r
272 \r
273   .weak      SPI1_IRQHandler\r
274   .thumb_set SPI1_IRQHandler,Default_Handler\r
275 \r
276   .weak      SPI2_IRQHandler\r
277   .thumb_set SPI2_IRQHandler,Default_Handler\r
278 \r
279   .weak      USART1_IRQHandler\r
280   .thumb_set USART1_IRQHandler,Default_Handler\r
281 \r
282   .weak      USART2_IRQHandler\r
283   .thumb_set USART2_IRQHandler,Default_Handler\r
284 \r
285 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r
286 \r