2 ******************************************************************************
3 * @file startup_stm32f10x_hd.s
4 * @author MCD Application Team / David Ankers: Vector table for FreeRTOS
7 * @brief STM32F10x High Density Devices vector table for RIDE7 toolchain.
8 * This module performs:
10 * - Set the initial PC == Reset_Handler,
11 * - Set the vector table entries with the exceptions ISR address,
12 * - Configure external SRAM mounted on STM3210E-EVAL board
13 * to be used as data memory (optional, to be enabled by user)
14 * - Branches to main in the C library (which eventually
16 * After Reset the Cortex-M3 processor is in Thread mode,
17 * priority is Privileged, and the Stack is set to Main.
18 ******************************************************************************
21 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
22 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
23 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
24 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
25 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
26 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
28 * <h2><center>© COPYRIGHT 2009 STMicroelectronics</center></h2>
37 .global SystemInit_ExtMemCtl_Dummy
38 .global Default_Handler
39 .global xPortIncreaseHeapSize
42 /* start address for the initialization values of the .data section.
43 defined in linker script */
45 /* start address for the .data section. defined in linker script */
47 /* end address for the .data section. defined in linker script */
49 /* start address for the .bss section. defined in linker script */
51 /* end address for the .bss section. defined in linker script */
53 /* stack used for SystemInit_ExtMemCtl; always internal RAM used */
55 .equ BootRAM, 0xF1E0F85F
57 * @brief This is the code that gets called when the processor first
58 * starts execution following a reset event. Only the absolutely
59 * necessary set is performed, after which the application
60 * supplied main() routine is called.
65 .section .text.Reset_Handler
67 .type Reset_Handler, %function
70 /* FSMC Bank1 NOR/SRAM3 is used for the STM3210E-EVAL, if another Bank is
71 required, then adjust the Register Addresses */
72 bl SystemInit_ExtMemCtl
73 /* restore original stack pointer */
74 LDR r0, =_irq_stack_top
76 LDR r2, =_init_stack_top
78 /* check if irq and init stack are the same */
79 /* if they are, we don't do stack swap */
80 /* and lets bypass the monitoring as well for now */
84 * - stay in thread process mode
85 * - stay in privilege level
91 /* Fill IRQ stack for watermark monitoring */
92 ldr r2, =_irq_stack_end
100 ldr r3, = _irq_stack_top
105 /* Copy the data segment initializers from flash to SRAM */
123 /* Zero fill the bss segment. */
132 /* Call the application's entry point.*/
134 /* will never return here */
136 .size Reset_Handler, .-Reset_Handler
139 * @brief This is the code that swaps stack (from end of heap to irq_stack).
140 * Also reclaim the heap that was used as a stack.
144 .section .text.Stack_Change
146 .type Stack_Change, %function
149 /* Switches stack back momentarily to MSP */
153 /* add heap_post_rtos to the heap (if the capability/function exist) */
154 /* Also claim the unused memory (between end of heap to end of memory */
155 /* CAREFULL: the heap section must be the last section in RAM in order this to work */
156 ldr r0, = _init_stack_size
157 ldr r1, = _eheap_post_rtos
161 bl xPortIncreaseHeapSize
163 .size Stack_Change, .-Stack_Change
166 * @brief Dummy SystemInit_ExtMemCtl function
170 .section .text.SystemInit_ExtMemCtl_Dummy,"ax",%progbits
171 SystemInit_ExtMemCtl_Dummy:
173 .size SystemInit_ExtMemCtl_Dummy, .-SystemInit_ExtMemCtl_Dummy
176 * @brief This is the code that gets called when the processor receives an
177 * unexpected interrupt. This simply enters an infinite loop, preserving
178 * the system state for examination by a debugger.
183 .section .text.Default_Handler,"ax",%progbits
187 .size Default_Handler, .-Default_Handler
188 /******************************************************************************
190 * The minimal vector table for a Cortex M3. Note that the proper constructs
191 * must be placed on this to ensure that it ends up at physical address
194 ******************************************************************************/
195 .section .isr_vector,"a",%progbits
196 .type g_pfnVectors, %object
197 .size g_pfnVectors, .-g_pfnVectors
204 .word HardFault_Handler
205 .word MemManage_Handler
206 .word BusFault_Handler
207 .word UsageFault_Handler
212 .word vPortSVCHandler
213 .word DebugMon_Handler
215 .word xPortPendSVHandler
216 .word xPortSysTickHandler
217 .word WWDG_IRQHandler
219 .word TAMPER_IRQHandler
221 .word FLASH_IRQHandler
223 .word EXTI0_IRQHandler
224 .word EXTI1_IRQHandler
225 .word EXTI2_IRQHandler
226 .word EXTI3_IRQHandler
227 .word EXTI4_IRQHandler
228 .word DMA1_Channel1_IRQHandler
229 .word DMA1_Channel2_IRQHandler
230 .word DMA1_Channel3_IRQHandler
231 .word DMA1_Channel4_IRQHandler
232 .word DMA1_Channel5_IRQHandler
233 .word DMA1_Channel6_IRQHandler
234 .word DMA1_Channel7_IRQHandler
235 .word ADC1_2_IRQHandler
236 .word USB_HP_CAN1_TX_IRQHandler
237 .word USB_LP_CAN1_RX0_IRQHandler
238 .word CAN1_RX1_IRQHandler
239 .word CAN1_SCE_IRQHandler
240 .word EXTI9_5_IRQHandler
241 .word TIM1_BRK_IRQHandler
242 .word TIM1_UP_IRQHandler
243 .word TIM1_TRG_COM_IRQHandler
244 .word TIM1_CC_IRQHandler
245 .word TIM2_IRQHandler
246 .word TIM3_IRQHandler
247 .word TIM4_IRQHandler
248 .word I2C1_EV_IRQHandler
249 .word I2C1_ER_IRQHandler
250 .word I2C2_EV_IRQHandler
251 .word I2C2_ER_IRQHandler
252 .word SPI1_IRQHandler
253 .word SPI2_IRQHandler
254 .word USART1_IRQHandler
255 .word USART2_IRQHandler
256 .word USART3_IRQHandler
257 .word EXTI15_10_IRQHandler
258 .word RTCAlarm_IRQHandler
259 .word USBWakeUp_IRQHandler
260 .word TIM8_BRK_IRQHandler
261 .word TIM8_UP_IRQHandler
262 .word TIM8_TRG_COM_IRQHandler
263 .word TIM8_CC_IRQHandler
264 .word ADC3_IRQHandler
265 .word FSMC_IRQHandler
266 .word SDIO_IRQHandler
267 .word TIM5_IRQHandler
268 .word SPI3_IRQHandler
269 .word UART4_IRQHandler
270 .word UART5_IRQHandler
271 .word TIM6_IRQHandler
272 .word TIM7_IRQHandler
273 .word DMA2_Channel1_IRQHandler
274 .word DMA2_Channel2_IRQHandler
275 .word DMA2_Channel3_IRQHandler
276 .word DMA2_Channel4_5_IRQHandler
321 .word BootRAM /* @0x1E0. This is for boot in RAM mode for
322 STM32F10x High Density devices. */
324 /*******************************************************************************
326 * Provide weak aliases for each Exception handler to the Default_Handler.
327 * As they are weak aliases, any function with the same name will override
330 *******************************************************************************/
333 .thumb_set NMI_Handler,Default_Handler
335 .weak HardFault_Handler
336 .thumb_set HardFault_Handler,Default_Handler
338 .weak MemManage_Handler
339 .thumb_set MemManage_Handler,Default_Handler
341 .weak BusFault_Handler
342 .thumb_set BusFault_Handler,Default_Handler
344 .weak UsageFault_Handler
345 .thumb_set UsageFault_Handler,Default_Handler
348 .thumb_set SVC_Handler,Default_Handler
350 .weak DebugMon_Handler
351 .thumb_set DebugMon_Handler,Default_Handler
354 .thumb_set PendSV_Handler,Default_Handler
356 .weak SysTick_Handler
357 .thumb_set SysTick_Handler,Default_Handler
359 .weak WWDG_IRQHandler
360 .thumb_set WWDG_IRQHandler,Default_Handler
363 .thumb_set PVD_IRQHandler,Default_Handler
365 .weak TAMPER_IRQHandler
366 .thumb_set TAMPER_IRQHandler,Default_Handler
369 .thumb_set RTC_IRQHandler,Default_Handler
371 .weak FLASH_IRQHandler
372 .thumb_set FLASH_IRQHandler,Default_Handler
375 .thumb_set RCC_IRQHandler,Default_Handler
377 .weak EXTI0_IRQHandler
378 .thumb_set EXTI0_IRQHandler,Default_Handler
380 .weak EXTI1_IRQHandler
381 .thumb_set EXTI1_IRQHandler,Default_Handler
383 .weak EXTI2_IRQHandler
384 .thumb_set EXTI2_IRQHandler,Default_Handler
386 .weak EXTI3_IRQHandler
387 .thumb_set EXTI3_IRQHandler,Default_Handler
389 .weak EXTI4_IRQHandler
390 .thumb_set EXTI4_IRQHandler,Default_Handler
392 .weak DMA1_Channel1_IRQHandler
393 .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
395 .weak DMA1_Channel2_IRQHandler
396 .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
398 .weak DMA1_Channel3_IRQHandler
399 .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
401 .weak DMA1_Channel4_IRQHandler
402 .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
404 .weak DMA1_Channel5_IRQHandler
405 .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
407 .weak DMA1_Channel6_IRQHandler
408 .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
410 .weak DMA1_Channel7_IRQHandler
411 .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
413 .weak ADC1_2_IRQHandler
414 .thumb_set ADC1_2_IRQHandler,Default_Handler
416 .weak USB_HP_CAN1_TX_IRQHandler
417 .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
419 .weak USB_LP_CAN1_RX0_IRQHandler
420 .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
422 .weak CAN1_RX1_IRQHandler
423 .thumb_set CAN1_RX1_IRQHandler,Default_Handler
425 .weak CAN1_SCE_IRQHandler
426 .thumb_set CAN1_SCE_IRQHandler,Default_Handler
428 .weak EXTI9_5_IRQHandler
429 .thumb_set EXTI9_5_IRQHandler,Default_Handler
431 .weak TIM1_BRK_IRQHandler
432 .thumb_set TIM1_BRK_IRQHandler,Default_Handler
434 .weak TIM1_UP_IRQHandler
435 .thumb_set TIM1_UP_IRQHandler,Default_Handler
437 .weak TIM1_TRG_COM_IRQHandler
438 .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler
440 .weak TIM1_CC_IRQHandler
441 .thumb_set TIM1_CC_IRQHandler,Default_Handler
443 .weak TIM2_IRQHandler
444 .thumb_set TIM2_IRQHandler,Default_Handler
446 .weak TIM3_IRQHandler
447 .thumb_set TIM3_IRQHandler,Default_Handler
449 .weak TIM4_IRQHandler
450 .thumb_set TIM4_IRQHandler,Default_Handler
452 .weak I2C1_EV_IRQHandler
453 .thumb_set I2C1_EV_IRQHandler,Default_Handler
455 .weak I2C1_ER_IRQHandler
456 .thumb_set I2C1_ER_IRQHandler,Default_Handler
458 .weak I2C2_EV_IRQHandler
459 .thumb_set I2C2_EV_IRQHandler,Default_Handler
461 .weak I2C2_ER_IRQHandler
462 .thumb_set I2C2_ER_IRQHandler,Default_Handler
464 .weak SPI1_IRQHandler
465 .thumb_set SPI1_IRQHandler,Default_Handler
467 .weak SPI2_IRQHandler
468 .thumb_set SPI2_IRQHandler,Default_Handler
470 .weak USART1_IRQHandler
471 .thumb_set USART1_IRQHandler,Default_Handler
473 .weak USART2_IRQHandler
474 .thumb_set USART2_IRQHandler,Default_Handler
476 .weak USART3_IRQHandler
477 .thumb_set USART3_IRQHandler,Default_Handler
479 .weak EXTI15_10_IRQHandler
480 .thumb_set EXTI15_10_IRQHandler,Default_Handler
482 .weak RTCAlarm_IRQHandler
483 .thumb_set RTCAlarm_IRQHandler,Default_Handler
485 .weak USBWakeUp_IRQHandler
486 .thumb_set USBWakeUp_IRQHandler,Default_Handler
488 .weak TIM8_BRK_IRQHandler
489 .thumb_set TIM8_BRK_IRQHandler,Default_Handler
491 .weak TIM8_UP_IRQHandler
492 .thumb_set TIM8_UP_IRQHandler,Default_Handler
494 .weak TIM8_TRG_COM_IRQHandler
495 .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler
497 .weak TIM8_CC_IRQHandler
498 .thumb_set TIM8_CC_IRQHandler,Default_Handler
500 .weak ADC3_IRQHandler
501 .thumb_set ADC3_IRQHandler,Default_Handler
503 .weak FSMC_IRQHandler
504 .thumb_set FSMC_IRQHandler,Default_Handler
506 .weak SDIO_IRQHandler
507 .thumb_set SDIO_IRQHandler,Default_Handler
509 .weak TIM5_IRQHandler
510 .thumb_set TIM5_IRQHandler,Default_Handler
512 .weak SPI3_IRQHandler
513 .thumb_set SPI3_IRQHandler,Default_Handler
515 .weak UART4_IRQHandler
516 .thumb_set UART4_IRQHandler,Default_Handler
518 .weak UART5_IRQHandler
519 .thumb_set UART5_IRQHandler,Default_Handler
521 .weak TIM6_IRQHandler
522 .thumb_set TIM6_IRQHandler,Default_Handler
524 .weak TIM7_IRQHandler
525 .thumb_set TIM7_IRQHandler,Default_Handler
527 .weak DMA2_Channel1_IRQHandler
528 .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
530 .weak DMA2_Channel2_IRQHandler
531 .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
533 .weak DMA2_Channel3_IRQHandler
534 .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
536 .weak DMA2_Channel4_5_IRQHandler
537 .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
539 .weak SystemInit_ExtMemCtl
540 .thumb_set SystemInit_ExtMemCtl,SystemInit_ExtMemCtl_Dummy