[4.4.2] Remove 15 m/s limit on estimated vario (#12788)
[betaflight.git] / src / main / startup / startup_stm32f411xe.s
blob519779e115eb9d7e457aefc06fea65293d6e0d3c
1 /**
2 ******************************************************************************
3 * @file startup_stm32f40_41xxx.s
4 * @author MCD Application Team
5 * @version V1.6.1
6 * @date 21-October-2015
7 * @brief STM32F40xxx/41xxx Devices vector table for Atollic TrueSTUDIO toolchain.
8 * Same as startup_stm32f40_41xxx.s and maintained for legacy purpose
9 * This module performs:
10 * - Set the initial SP
11 * - Set the initial PC == Reset_Handler,
12 * - Set the vector table entries with the exceptions ISR address
13 * - Configure the clock system and the external SRAM mounted on
14 * STM324xG-EVAL board to be used as data memory (optional,
15 * to be enabled by user)
16 * - Branches to main in the C library (which eventually
17 * calls main()).
18 * After Reset the Cortex-M4 processor is in Thread mode,
19 * priority is Privileged, and the Stack is set to Main.
20 ******************************************************************************
21 * @attention
23 * <h2><center>&copy; COPYRIGHT 2015 STMicroelectronics</center></h2>
25 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
26 * You may not use this file except in compliance with the License.
27 * You may obtain a copy of the License at:
29 * http://www.st.com/software_license_agreement_liberty_v2
31 * Unless required by applicable law or agreed to in writing, software
32 * distributed under the License is distributed on an "AS IS" BASIS,
33 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34 * See the License for the specific language governing permissions and
35 * limitations under the License.
37 ******************************************************************************
40 .syntax unified
41 .cpu cortex-m4
42 .fpu softvfp
43 .thumb
45 .global g_pfnVectors
46 .global Default_Handler
48 /* start address for the initialization values of the .data section.
49 defined in linker script */
50 .word _sidata
51 /* start address for the .data section. defined in linker script */
52 .word _sdata
53 /* end address for the .data section. defined in linker script */
54 .word _edata
55 /* start address for the .bss section. defined in linker script */
56 .word _sbss
57 /* end address for the .bss section. defined in linker script */
58 .word _ebss
59 /* stack used for SystemInit_ExtMemCtl; always internal RAM used */
61 /**
62 * @brief This is the code that gets called when the processor first
63 * starts execution following a reset event. Only the absolutely
64 * necessary set is performed, after which the application
65 * supplied main() routine is called.
66 * @param None
67 * @retval : None
70 .section .text.Reset_Handler
71 .weak Reset_Handler
72 .type Reset_Handler, %function
73 Reset_Handler:
74 // Defined in C code
75 bl persistentObjectInit
76 bl checkForBootLoaderRequest
78 /* Copy the data segment initializers from flash to SRAM */
79 movs r1, #0
80 b LoopCopyDataInit
82 CopyDataInit:
83 ldr r3, =_sidata
84 ldr r3, [r3, r1]
85 str r3, [r0, r1]
86 adds r1, r1, #4
88 LoopCopyDataInit:
89 ldr r0, =_sdata
90 ldr r3, =_edata
91 adds r2, r0, r1
92 cmp r2, r3
93 bcc CopyDataInit
94 ldr r2, =_sbss
95 b LoopFillZerobss
96 /* Zero fill the bss segment. */
97 FillZerobss:
98 movs r3, #0
99 str r3, [r2], #4
101 LoopFillZerobss:
102 ldr r3, = _ebss
103 cmp r2, r3
104 bcc FillZerobss
106 /* Mark the heap and stack */
107 ldr r2, =_heap_stack_begin
108 b LoopMarkHeapStack
110 MarkHeapStack:
111 movs r3, 0xa5a5a5a5
112 str r3, [r2], #4
114 LoopMarkHeapStack:
115 ldr r3, = _heap_stack_end
116 cmp r2, r3
117 bcc MarkHeapStack
119 /*FPU settings*/
120 ldr r0, =0xE000ED88 /* Enable CP10,CP11 */
121 ldr r1,[r0]
122 orr r1,r1,#(0xF << 20)
123 str r1,[r0]
125 /* Call the clock system intitialization function.*/
126 bl SystemInit
128 /* Call the application's entry point.*/
129 bl main
130 bx lr
132 LoopForever:
133 b LoopForever
135 .size Reset_Handler, .-Reset_Handler
138 * @brief This is the code that gets called when the processor receives an
139 * unexpected interrupt. This simply enters an infinite loop, preserving
140 * the system state for examination by a debugger.
141 * @param None
142 * @retval None
144 .section .text.Default_Handler,"ax",%progbits
145 Default_Handler:
146 Infinite_Loop:
147 b Infinite_Loop
148 .size Default_Handler, .-Default_Handler
149 /******************************************************************************
151 * The minimal vector table for a Cortex M4. Note that the proper constructs
152 * must be placed on this to ensure that it ends up at physical address
153 * 0x0000.0000.
155 *******************************************************************************/
156 .section .isr_vector,"a",%progbits
157 .type g_pfnVectors, %object
158 .size g_pfnVectors, .-g_pfnVectors
161 g_pfnVectors:
162 .word _estack
163 .word Reset_Handler
164 .word NMI_Handler
165 .word HardFault_Handler
166 .word MemManage_Handler
167 .word BusFault_Handler
168 .word UsageFault_Handler
169 .word 0
170 .word 0
171 .word 0
172 .word 0
173 .word SVC_Handler
174 .word DebugMon_Handler
175 .word 0
176 .word PendSV_Handler
177 .word SysTick_Handler
179 /* External Interrupts */
180 .word WWDG_IRQHandler /* Window WatchDog */
181 .word PVD_IRQHandler /* PVD through EXTI Line detection */
182 .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
183 .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */
184 .word FLASH_IRQHandler /* FLASH */
185 .word RCC_IRQHandler /* RCC */
186 .word EXTI0_IRQHandler /* EXTI Line0 */
187 .word EXTI1_IRQHandler /* EXTI Line1 */
188 .word EXTI2_IRQHandler /* EXTI Line2 */
189 .word EXTI3_IRQHandler /* EXTI Line3 */
190 .word EXTI4_IRQHandler /* EXTI Line4 */
191 .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */
192 .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */
193 .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */
194 .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */
195 .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */
196 .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */
197 .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */
198 .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */
199 .word 0 /* CAN1 TX */
200 .word 0 /* CAN1 RX0 */
201 .word 0 /* CAN1 RX1 */
202 .word 0 /* CAN1 SCE */
203 .word EXTI9_5_IRQHandler /* External Line[9:5]s */
204 .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */
205 .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */
206 .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */
207 .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
208 .word TIM2_IRQHandler /* TIM2 */
209 .word TIM3_IRQHandler /* TIM3 */
210 .word TIM4_IRQHandler /* TIM4 */
211 .word I2C1_EV_IRQHandler /* I2C1 Event */
212 .word I2C1_ER_IRQHandler /* I2C1 Error */
213 .word I2C2_EV_IRQHandler /* I2C2 Event */
214 .word I2C2_ER_IRQHandler /* I2C2 Error */
215 .word SPI1_IRQHandler /* SPI1 */
216 .word SPI2_IRQHandler /* SPI2 */
217 .word USART1_IRQHandler /* USART1 */
218 .word USART2_IRQHandler /* USART2 */
219 .word 0 /* USART3 */
220 .word EXTI15_10_IRQHandler /* External Line[15:10]s */
221 .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */
222 .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */
223 .word 0 /* TIM8 Break and TIM12 */
224 .word 0 /* TIM8 Update and TIM13 */
225 .word 0 /* TIM8 Trigger and Commutation and TIM14 */
226 .word 0 /* TIM8 Capture Compare */
227 .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */
228 .word 0 /* FSMC */
229 .word SDIO_IRQHandler /* SDIO */
230 .word TIM5_IRQHandler /* TIM5 */
231 .word SPI3_IRQHandler /* SPI3 */
232 .word 0 /* UART4 */
233 .word 0 /* UART5 */
234 .word 0 /* TIM6 and DAC1&2 underrun errors */
235 .word 0 /* TIM7 */
236 .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */
237 .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */
238 .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */
239 .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */
240 .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */
241 .word 0 /* Ethernet */
242 .word 0 /* Ethernet Wakeup through EXTI line */
243 .word 0 /* CAN2 TX */
244 .word 0 /* CAN2 RX0 */
245 .word 0 /* CAN2 RX1 */
246 .word 0 /* CAN2 SCE */
247 .word OTG_FS_IRQHandler /* USB OTG FS */
248 .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */
249 .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */
250 .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */
251 .word USART6_IRQHandler /* USART6 */
252 .word I2C3_EV_IRQHandler /* I2C3 event */
253 .word I2C3_ER_IRQHandler /* I2C3 error */
254 .word 0 /* USB OTG HS End Point 1 Out */
255 .word 0 /* USB OTG HS End Point 1 In */
256 .word 0 /* USB OTG HS Wakeup through EXTI */
257 .word 0 /* USB OTG HS */
258 .word 0 /* DCMI */
259 .word 0 /* CRYP crypto */
260 .word 0 /* Hash and Rng */
261 .word FPU_IRQHandler /* FPU */
262 .word 0 /* Reserved */
263 .word 0 /* Reserved */
264 .word SPI4_IRQHandler /* SPI4 */
265 .word SPI5_IRQHandler /* SPI5 */
266 /*******************************************************************************
268 * Provide weak aliases for each Exception handler to the Default_Handler.
269 * As they are weak aliases, any function with the same name will override
270 * this definition.
272 *******************************************************************************/
273 .weak NMI_Handler
274 .thumb_set NMI_Handler,Default_Handler
276 .weak HardFault_Handler
277 .thumb_set HardFault_Handler,Default_Handler
279 .weak MemManage_Handler
280 .thumb_set MemManage_Handler,Default_Handler
282 .weak BusFault_Handler
283 .thumb_set BusFault_Handler,Default_Handler
285 .weak UsageFault_Handler
286 .thumb_set UsageFault_Handler,Default_Handler
288 .weak SVC_Handler
289 .thumb_set SVC_Handler,Default_Handler
291 .weak DebugMon_Handler
292 .thumb_set DebugMon_Handler,Default_Handler
294 .weak PendSV_Handler
295 .thumb_set PendSV_Handler,Default_Handler
297 .weak SysTick_Handler
298 .thumb_set SysTick_Handler,Default_Handler
300 .weak WWDG_IRQHandler
301 .thumb_set WWDG_IRQHandler,Default_Handler
303 .weak PVD_IRQHandler
304 .thumb_set PVD_IRQHandler,Default_Handler
306 .weak TAMP_STAMP_IRQHandler
307 .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
309 .weak RTC_WKUP_IRQHandler
310 .thumb_set RTC_WKUP_IRQHandler,Default_Handler
312 .weak FLASH_IRQHandler
313 .thumb_set FLASH_IRQHandler,Default_Handler
315 .weak RCC_IRQHandler
316 .thumb_set RCC_IRQHandler,Default_Handler
318 .weak EXTI0_IRQHandler
319 .thumb_set EXTI0_IRQHandler,Default_Handler
321 .weak EXTI1_IRQHandler
322 .thumb_set EXTI1_IRQHandler,Default_Handler
324 .weak EXTI2_IRQHandler
325 .thumb_set EXTI2_IRQHandler,Default_Handler
327 .weak EXTI3_IRQHandler
328 .thumb_set EXTI3_IRQHandler,Default_Handler
330 .weak EXTI4_IRQHandler
331 .thumb_set EXTI4_IRQHandler,Default_Handler
333 .weak DMA1_Stream0_IRQHandler
334 .thumb_set DMA1_Stream0_IRQHandler,Default_Handler
336 .weak DMA1_Stream1_IRQHandler
337 .thumb_set DMA1_Stream1_IRQHandler,Default_Handler
339 .weak DMA1_Stream2_IRQHandler
340 .thumb_set DMA1_Stream2_IRQHandler,Default_Handler
342 .weak DMA1_Stream3_IRQHandler
343 .thumb_set DMA1_Stream3_IRQHandler,Default_Handler
345 .weak DMA1_Stream4_IRQHandler
346 .thumb_set DMA1_Stream4_IRQHandler,Default_Handler
348 .weak DMA1_Stream5_IRQHandler
349 .thumb_set DMA1_Stream5_IRQHandler,Default_Handler
351 .weak DMA1_Stream6_IRQHandler
352 .thumb_set DMA1_Stream6_IRQHandler,Default_Handler
354 .weak ADC_IRQHandler
355 .thumb_set ADC_IRQHandler,Default_Handler
357 .weak EXTI9_5_IRQHandler
358 .thumb_set EXTI9_5_IRQHandler,Default_Handler
360 .weak TIM1_BRK_TIM9_IRQHandler
361 .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler
363 .weak TIM1_UP_TIM10_IRQHandler
364 .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler
366 .weak TIM1_TRG_COM_TIM11_IRQHandler
367 .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler
369 .weak TIM1_CC_IRQHandler
370 .thumb_set TIM1_CC_IRQHandler,Default_Handler
372 .weak TIM2_IRQHandler
373 .thumb_set TIM2_IRQHandler,Default_Handler
375 .weak TIM3_IRQHandler
376 .thumb_set TIM3_IRQHandler,Default_Handler
378 .weak TIM4_IRQHandler
379 .thumb_set TIM4_IRQHandler,Default_Handler
381 .weak I2C1_EV_IRQHandler
382 .thumb_set I2C1_EV_IRQHandler,Default_Handler
384 .weak I2C1_ER_IRQHandler
385 .thumb_set I2C1_ER_IRQHandler,Default_Handler
387 .weak I2C2_EV_IRQHandler
388 .thumb_set I2C2_EV_IRQHandler,Default_Handler
390 .weak I2C2_ER_IRQHandler
391 .thumb_set I2C2_ER_IRQHandler,Default_Handler
393 .weak SPI1_IRQHandler
394 .thumb_set SPI1_IRQHandler,Default_Handler
396 .weak SPI2_IRQHandler
397 .thumb_set SPI2_IRQHandler,Default_Handler
399 .weak USART1_IRQHandler
400 .thumb_set USART1_IRQHandler,Default_Handler
402 .weak USART2_IRQHandler
403 .thumb_set USART2_IRQHandler,Default_Handler
405 .weak EXTI15_10_IRQHandler
406 .thumb_set EXTI15_10_IRQHandler,Default_Handler
408 .weak RTC_Alarm_IRQHandler
409 .thumb_set RTC_Alarm_IRQHandler,Default_Handler
411 .weak OTG_FS_WKUP_IRQHandler
412 .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
414 .weak DMA1_Stream7_IRQHandler
415 .thumb_set DMA1_Stream7_IRQHandler,Default_Handler
417 .weak SDIO_IRQHandler
418 .thumb_set SDIO_IRQHandler,Default_Handler
420 .weak TIM5_IRQHandler
421 .thumb_set TIM5_IRQHandler,Default_Handler
423 .weak SPI3_IRQHandler
424 .thumb_set SPI3_IRQHandler,Default_Handler
426 .weak DMA2_Stream0_IRQHandler
427 .thumb_set DMA2_Stream0_IRQHandler,Default_Handler
429 .weak DMA2_Stream1_IRQHandler
430 .thumb_set DMA2_Stream1_IRQHandler,Default_Handler
432 .weak DMA2_Stream2_IRQHandler
433 .thumb_set DMA2_Stream2_IRQHandler,Default_Handler
435 .weak DMA2_Stream3_IRQHandler
436 .thumb_set DMA2_Stream3_IRQHandler,Default_Handler
438 .weak DMA2_Stream4_IRQHandler
439 .thumb_set DMA2_Stream4_IRQHandler,Default_Handler
441 .weak OTG_FS_IRQHandler
442 .thumb_set OTG_FS_IRQHandler,Default_Handler
444 .weak DMA2_Stream5_IRQHandler
445 .thumb_set DMA2_Stream5_IRQHandler,Default_Handler
447 .weak DMA2_Stream6_IRQHandler
448 .thumb_set DMA2_Stream6_IRQHandler,Default_Handler
450 .weak DMA2_Stream7_IRQHandler
451 .thumb_set DMA2_Stream7_IRQHandler,Default_Handler
453 .weak USART6_IRQHandler
454 .thumb_set USART6_IRQHandler,Default_Handler
456 .weak I2C3_EV_IRQHandler
457 .thumb_set I2C3_EV_IRQHandler,Default_Handler
459 .weak I2C3_ER_IRQHandler
460 .thumb_set I2C3_ER_IRQHandler,Default_Handler
462 .weak FPU_IRQHandler
463 .thumb_set FPU_IRQHandler,Default_Handler
465 .weak SPI4_IRQHandler
466 .thumb_set SPI4_IRQHandler,Default_Handler
468 .weak SPI5_IRQHandler
469 .thumb_set SPI5_IRQHandler,Default_Handler
471 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/