2 ******************************************************************************
3 * @file startup_stm32f10x_hd.s
4 * @author MCD Application Team
7 * @brief STM32F10x High Density Devices vector table for Atollic 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 the clock system
13 * - Branches to main in the C library (which eventually
15 * After Reset the Cortex-M3 processor is in Thread mode,
16 * priority is Privileged, and the Stack is set to Main.
17 ******************************************************************************
20 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
21 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
22 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
23 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
24 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
25 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
27 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
28 ******************************************************************************
37 .global Default_Handler
39 /* start address for the initialization values of the .data section.
40 defined in linker script */
42 /* start address for the .data section. defined in linker script */
44 /* end address for the .data section. defined in linker script */
46 /* start address for the .bss section. defined in linker script */
48 /* end address for the .bss section. defined in linker script */
50 /* stack used for SystemInit_ExtMemCtl; always internal RAM used */
52 .equ BootRAM, 0xF1E0F85F
54 * @brief This is the code that gets called when the processor first
55 * starts execution following a reset event. Only the absolutely
56 * necessary set is performed, after which the application
57 * supplied main() routine is called.
62 .section .text.Reset_Handler
64 .type Reset_Handler, %function
66 ldr r0, =0x2000CFF0 // HJI - TC bootloader entry on reset mod
67 ldr r1, =0xDEADBEEF // HJI - TC bootloader entry on reset mod
68 ldr r2, [r0, #0] // HJI - TC bootloader entry on reset mod
69 str r0, [r0, #0] // HJI - TC bootloader entry on reset mod
70 cmp r2, r1 // HJI - TC bootloader entry on reset mod
71 beq Reboot_Loader // HJI - TC bootloader entry on reset mod
73 /* Copy the data segment initializers from flash to SRAM */
91 /* Zero fill the bss segment. */
101 /* Call the clock system intitialization function.*/
103 /* Call the application's entry point.*/
105 /* Atollic update, branch LoopForever */
109 .equ RCC_APB2ENR, 0x40021018 // HJI - TC bootloader entry on reset mod
110 .equ GPIO_AFIO_MASK, 0x00000009 // HJI - TC bootloader entry on reset mod
111 .equ GPIOB_CRL, 0x40010C00 // HJI - TC bootloader entry on reset mod
112 .equ GPIOB_BRR, 0x40010C14 // HJI - TC bootloader entry on reset mod
113 .equ AFIO_MAPR, 0x40010004 // HJI - TC bootloader entry on reset mod
115 Reboot_Loader: // HJI - TC bootloader entry on reset mod
116 // RCC Enable GPIOB+AFIO // HJI - TC bootloader entry on reset mod
117 ldr r6, =RCC_APB2ENR // HJI - TC bootloader entry on reset mod
118 ldr r0, =GPIO_AFIO_MASK // HJI - TC bootloader entry on reset mod
119 str R0, [r6]; // HJI - TC bootloader entry on reset mod
121 // MAPR pt1 // HJI - TC bootloader entry on reset mod
122 ldr r0, =AFIO_MAPR // HJI - TC bootloader entry on reset mod
123 ldr r1, [r0] // HJI - TC bootloader entry on reset mod
124 bic r1, r1, #0x0F000000 // HJI - TC bootloader entry on reset mod
125 str r1, [r0] // HJI - TC bootloader entry on reset mod
127 // MAPR pt2 // HJI - TC bootloader entry on reset mod
128 lsls r1, r0, #9 // HJI - TC bootloader entry on reset mod
129 str r1, [r0] // HJI - TC bootloader entry on reset mod
131 // BRR // HJI - TC bootloader entry on reset mod
132 ldr r4, =GPIOB_BRR // HJI - TC bootloader entry on reset mod
133 movs r0, #0x18 // HJI - TC bootloader entry on reset mod
134 str r0, [r4] // HJI - TC bootloader entry on reset mod
136 // CRL // HJI - TC bootloader entry on reset mod
137 ldr r1, =GPIOB_CRL // HJI - TC bootloader entry on reset mod
138 ldr r0, =0x44433444 // HJI - TC bootloader entry on reset mod
139 str r0, [r1] // HJI - TC bootloader entry on reset mod
141 // Reboot to ROM // HJI - TC bootloader entry on reset mod
142 ldr r0, =0x1FFFF000 // HJI - TC bootloader entry on reset mod
143 ldr sp,[r0, #0] // HJI - TC bootloader entry on reset mod
144 ldr r0,[r0, #4] // HJI - TC bootloader entry on reset mod
145 bx r0 // HJI - TC bootloader entry on reset mod
147 .size Reset_Handler, .-Reset_Handler
150 * @brief This is the code that gets called when the processor receives an
151 * unexpected interrupt. This simply enters an infinite loop, preserving
152 * the system state for examination by a debugger.
157 .section .text.Default_Handler,"ax",%progbits
161 .size Default_Handler, .-Default_Handler
162 /******************************************************************************
164 * The minimal vector table for a Cortex M3. Note that the proper constructs
165 * must be placed on this to ensure that it ends up at physical address
168 ******************************************************************************/
169 .section .isr_vector,"a",%progbits
170 .type g_pfnVectors, %object
171 .size g_pfnVectors, .-g_pfnVectors
178 .word HardFault_Handler
179 .word MemManage_Handler
180 .word BusFault_Handler
181 .word UsageFault_Handler
187 .word DebugMon_Handler
190 .word SysTick_Handler
191 .word WWDG_IRQHandler
193 .word TAMPER_IRQHandler
195 .word FLASH_IRQHandler
197 .word EXTI0_IRQHandler
198 .word EXTI1_IRQHandler
199 .word EXTI2_IRQHandler
200 .word EXTI3_IRQHandler
201 .word EXTI4_IRQHandler
202 .word DMA1_Channel1_IRQHandler
203 .word DMA1_Channel2_IRQHandler
204 .word DMA1_Channel3_IRQHandler
205 .word DMA1_Channel4_IRQHandler
206 .word DMA1_Channel5_IRQHandler
207 .word DMA1_Channel6_IRQHandler
208 .word DMA1_Channel7_IRQHandler
209 .word ADC1_2_IRQHandler
210 .word USB_HP_CAN1_TX_IRQHandler
211 .word USB_LP_CAN1_RX0_IRQHandler
212 .word CAN1_RX1_IRQHandler
213 .word CAN1_SCE_IRQHandler
214 .word EXTI9_5_IRQHandler
215 .word TIM1_BRK_IRQHandler
216 .word TIM1_UP_IRQHandler
217 .word TIM1_TRG_COM_IRQHandler
218 .word TIM1_CC_IRQHandler
219 .word TIM2_IRQHandler
220 .word TIM3_IRQHandler
221 .word TIM4_IRQHandler
222 .word I2C1_EV_IRQHandler
223 .word I2C1_ER_IRQHandler
224 .word I2C2_EV_IRQHandler
225 .word I2C2_ER_IRQHandler
226 .word SPI1_IRQHandler
227 .word SPI2_IRQHandler
228 .word USART1_IRQHandler
229 .word USART2_IRQHandler
230 .word USART3_IRQHandler
231 .word EXTI15_10_IRQHandler
232 .word RTCAlarm_IRQHandler
233 .word USBWakeUp_IRQHandler
234 .word TIM8_BRK_IRQHandler
235 .word TIM8_UP_IRQHandler
236 .word TIM8_TRG_COM_IRQHandler
237 .word TIM8_CC_IRQHandler
238 .word ADC3_IRQHandler
239 .word FSMC_IRQHandler
240 .word SDIO_IRQHandler
241 .word TIM5_IRQHandler
242 .word SPI3_IRQHandler
243 .word UART4_IRQHandler
244 .word UART5_IRQHandler
245 .word TIM6_IRQHandler
246 .word TIM7_IRQHandler
247 .word DMA2_Channel1_IRQHandler
248 .word DMA2_Channel2_IRQHandler
249 .word DMA2_Channel3_IRQHandler
250 .word DMA2_Channel4_5_IRQHandler
295 .word BootRAM /* @0x1E0. This is for boot in RAM mode for
296 STM32F10x High Density devices. */
297 /*******************************************************************************
299 * Provide weak aliases for each Exception handler to the Default_Handler.
300 * As they are weak aliases, any function with the same name will override
303 *******************************************************************************/
306 .thumb_set NMI_Handler,Default_Handler
308 .weak HardFault_Handler
309 .thumb_set HardFault_Handler,Default_Handler
311 .weak MemManage_Handler
312 .thumb_set MemManage_Handler,Default_Handler
314 .weak BusFault_Handler
315 .thumb_set BusFault_Handler,Default_Handler
317 .weak UsageFault_Handler
318 .thumb_set UsageFault_Handler,Default_Handler
321 .thumb_set SVC_Handler,Default_Handler
323 .weak DebugMon_Handler
324 .thumb_set DebugMon_Handler,Default_Handler
327 .thumb_set PendSV_Handler,Default_Handler
329 .weak SysTick_Handler
330 .thumb_set SysTick_Handler,Default_Handler
332 .weak WWDG_IRQHandler
333 .thumb_set WWDG_IRQHandler,Default_Handler
336 .thumb_set PVD_IRQHandler,Default_Handler
338 .weak TAMPER_IRQHandler
339 .thumb_set TAMPER_IRQHandler,Default_Handler
342 .thumb_set RTC_IRQHandler,Default_Handler
344 .weak FLASH_IRQHandler
345 .thumb_set FLASH_IRQHandler,Default_Handler
348 .thumb_set RCC_IRQHandler,Default_Handler
350 .weak EXTI0_IRQHandler
351 .thumb_set EXTI0_IRQHandler,Default_Handler
353 .weak EXTI1_IRQHandler
354 .thumb_set EXTI1_IRQHandler,Default_Handler
356 .weak EXTI2_IRQHandler
357 .thumb_set EXTI2_IRQHandler,Default_Handler
359 .weak EXTI3_IRQHandler
360 .thumb_set EXTI3_IRQHandler,Default_Handler
362 .weak EXTI4_IRQHandler
363 .thumb_set EXTI4_IRQHandler,Default_Handler
365 .weak DMA1_Channel1_IRQHandler
366 .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
368 .weak DMA1_Channel2_IRQHandler
369 .thumb_set DMA1_Channel2_IRQHandler,Default_Handler
371 .weak DMA1_Channel3_IRQHandler
372 .thumb_set DMA1_Channel3_IRQHandler,Default_Handler
374 .weak DMA1_Channel4_IRQHandler
375 .thumb_set DMA1_Channel4_IRQHandler,Default_Handler
377 .weak DMA1_Channel5_IRQHandler
378 .thumb_set DMA1_Channel5_IRQHandler,Default_Handler
380 .weak DMA1_Channel6_IRQHandler
381 .thumb_set DMA1_Channel6_IRQHandler,Default_Handler
383 .weak DMA1_Channel7_IRQHandler
384 .thumb_set DMA1_Channel7_IRQHandler,Default_Handler
386 .weak ADC1_2_IRQHandler
387 .thumb_set ADC1_2_IRQHandler,Default_Handler
389 .weak USB_HP_CAN1_TX_IRQHandler
390 .thumb_set USB_HP_CAN1_TX_IRQHandler,Default_Handler
392 .weak USB_LP_CAN1_RX0_IRQHandler
393 .thumb_set USB_LP_CAN1_RX0_IRQHandler,Default_Handler
395 .weak CAN1_RX1_IRQHandler
396 .thumb_set CAN1_RX1_IRQHandler,Default_Handler
398 .weak CAN1_SCE_IRQHandler
399 .thumb_set CAN1_SCE_IRQHandler,Default_Handler
401 .weak EXTI9_5_IRQHandler
402 .thumb_set EXTI9_5_IRQHandler,Default_Handler
404 .weak TIM1_BRK_IRQHandler
405 .thumb_set TIM1_BRK_IRQHandler,Default_Handler
407 .weak TIM1_UP_IRQHandler
408 .thumb_set TIM1_UP_IRQHandler,Default_Handler
410 .weak TIM1_TRG_COM_IRQHandler
411 .thumb_set TIM1_TRG_COM_IRQHandler,Default_Handler
413 .weak TIM1_CC_IRQHandler
414 .thumb_set TIM1_CC_IRQHandler,Default_Handler
416 .weak TIM2_IRQHandler
417 .thumb_set TIM2_IRQHandler,Default_Handler
419 .weak TIM3_IRQHandler
420 .thumb_set TIM3_IRQHandler,Default_Handler
422 .weak TIM4_IRQHandler
423 .thumb_set TIM4_IRQHandler,Default_Handler
425 .weak I2C1_EV_IRQHandler
426 .thumb_set I2C1_EV_IRQHandler,Default_Handler
428 .weak I2C1_ER_IRQHandler
429 .thumb_set I2C1_ER_IRQHandler,Default_Handler
431 .weak I2C2_EV_IRQHandler
432 .thumb_set I2C2_EV_IRQHandler,Default_Handler
434 .weak I2C2_ER_IRQHandler
435 .thumb_set I2C2_ER_IRQHandler,Default_Handler
437 .weak SPI1_IRQHandler
438 .thumb_set SPI1_IRQHandler,Default_Handler
440 .weak SPI2_IRQHandler
441 .thumb_set SPI2_IRQHandler,Default_Handler
443 .weak USART1_IRQHandler
444 .thumb_set USART1_IRQHandler,Default_Handler
446 .weak USART2_IRQHandler
447 .thumb_set USART2_IRQHandler,Default_Handler
449 .weak USART3_IRQHandler
450 .thumb_set USART3_IRQHandler,Default_Handler
452 .weak EXTI15_10_IRQHandler
453 .thumb_set EXTI15_10_IRQHandler,Default_Handler
455 .weak RTCAlarm_IRQHandler
456 .thumb_set RTCAlarm_IRQHandler,Default_Handler
458 .weak USBWakeUp_IRQHandler
459 .thumb_set USBWakeUp_IRQHandler,Default_Handler
461 .weak TIM8_BRK_IRQHandler
462 .thumb_set TIM8_BRK_IRQHandler,Default_Handler
464 .weak TIM8_UP_IRQHandler
465 .thumb_set TIM8_UP_IRQHandler,Default_Handler
467 .weak TIM8_TRG_COM_IRQHandler
468 .thumb_set TIM8_TRG_COM_IRQHandler,Default_Handler
470 .weak TIM8_CC_IRQHandler
471 .thumb_set TIM8_CC_IRQHandler,Default_Handler
473 .weak ADC3_IRQHandler
474 .thumb_set ADC3_IRQHandler,Default_Handler
476 .weak FSMC_IRQHandler
477 .thumb_set FSMC_IRQHandler,Default_Handler
479 .weak SDIO_IRQHandler
480 .thumb_set SDIO_IRQHandler,Default_Handler
482 .weak TIM5_IRQHandler
483 .thumb_set TIM5_IRQHandler,Default_Handler
485 .weak SPI3_IRQHandler
486 .thumb_set SPI3_IRQHandler,Default_Handler
488 .weak UART4_IRQHandler
489 .thumb_set UART4_IRQHandler,Default_Handler
491 .weak UART5_IRQHandler
492 .thumb_set UART5_IRQHandler,Default_Handler
494 .weak TIM6_IRQHandler
495 .thumb_set TIM6_IRQHandler,Default_Handler
497 .weak TIM7_IRQHandler
498 .thumb_set TIM7_IRQHandler,Default_Handler
500 .weak DMA2_Channel1_IRQHandler
501 .thumb_set DMA2_Channel1_IRQHandler,Default_Handler
503 .weak DMA2_Channel2_IRQHandler
504 .thumb_set DMA2_Channel2_IRQHandler,Default_Handler
506 .weak DMA2_Channel3_IRQHandler
507 .thumb_set DMA2_Channel3_IRQHandler,Default_Handler
509 .weak DMA2_Channel4_5_IRQHandler
510 .thumb_set DMA2_Channel4_5_IRQHandler,Default_Handler
512 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/