/* The vector table is normally located at address 0. When debugging in RAM, it can be located in RAM, aligned to at least 2^6. The name "__vector_table" has special meaning for C-SPY: it is where the SP start value is found, and the NVIC vector table register (VTOR) is initialized to this address if != 0. */
/* Cortex-M version */
.syntax unified
.cpu cortex-m0
.fpu softvfp
.thumb
.global __vector_table
.word _sidata
.word _sdata
.word _edata
.word _sbss
.word _ebss
.section.text.Reset_Handler
.weak Reset_Handler
.type Reset_Handler, %function
Reset_Handler:
ldr r0, =_estack
msr msp, r0
/*Check if boot space corresponds to test memory*/
ldr r0, =0x00000004
ldr r1, [r0]
lsrs r1, r1, #24
ldr r2, =0x1F
cmp r1, r2
bne ApplicationStart
/*SYSCFG clock enable*/
ldr r0, =0x40021018
ldr r1, =0x00000001
str r1, [r0]
/* Set CFGR1 register with flash memory remap at address 0 */
ldr r0, =0x40010000
ldr r1, =0x00000000
str r1, [r0]
ApplicationStart:
/* Copy the data segment initializers from flash to SRAM */
movs r1, #0
b LoopCopyDataInit
CopyDataInit:
ldr r3, =_sidata
ldr r3, [r3, r1]
str r3, [r0, r1]
adds r1, r1, #4
LoopCopyDataInit:
ldr r0, =_sdata
ldr r3, =_edata
adds r2, r0, r1
cmp r2, r3
bcc CopyDataInit
ldr r2, =_sbss
b LoopFillZerobss
/* Zero fill the bss segment. */
FillZerobss:
movs r3, #0
str r3, [r2]
adds r2, r2, #4
LoopFillZerobss:
ldr r3, =_ebss
cmp r2, r3
bcc FillZerobss
/* Call the clock system intitialization function.*/
bl SystemInit
/* Call the application's entry point.*/
bl main
LoopForever:
b LoopForever
.size Reset_Handler, .-Reset_Handler
/* Vector Table Mapped to Address 0 at Reset */
.section.isr_vector,"a", %progbits
.type__vector_table, %object
.size__vector_table, .-__vector_table
__vector_table:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word 0
.word SVC_Handler
.word 0
.word 0
.word PendSV_Handler
.word SysTick_Handler
/* External Interrupts */
.word WWDG_IRQHandler
.word PVD_IRQHandler
.word RTC_IRQHandler
.word FLASH_IRQHandler
.word RCC_CRS_IRQHandler
.word EXTI0_1_IRQHandler
.word EXTI2_3_IRQHandler
.word EXTI4_15_IRQHandler
.word 0
.word DMA1_Channel1_IRQHandler
.word DMA1_Channel2_3_IRQHandler
.word DMA1_Channel4_5_IRQHandler
.word ADC_COMP_IRQHandler
.word TIM1_BRK_UP_TRG_COM_IRQHandler
.word TIM1_CC_IRQHandler
.word TIM2_IRQHandler
.word TIM3_IRQHandler
.word 0
.word 0
.word TIM14_IRQHandler
.word 0
.word TIM16_IRQHandler
.word TIM17_IRQHandler
.word I2C1_IRQHandler
.word 0
.word SPI1_IRQHandler
.word SPI2_IRQHandler
.word UART1_IRQHandler
.word UART2_IRQHandler
.word AES_IRQHandler
.word CAN_IRQHandler
.word USB_IRQHandler
/* Dummy Exception Handlers (infinite loops which can be modified) */