187 lines
3.9 KiB
ArmAsm
187 lines
3.9 KiB
ArmAsm
|
|
.syntax unified
|
||
|
|
.cpu cortex-m3
|
||
|
|
.fpu softvfp
|
||
|
|
.thumb
|
||
|
|
|
||
|
|
.global g_pfnVectors
|
||
|
|
.global Default_Handler
|
||
|
|
|
||
|
|
.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
|
||
|
|
mov sp, r0
|
||
|
|
bl SystemInit
|
||
|
|
|
||
|
|
ldr r0, =_sdata
|
||
|
|
ldr r1, =_edata
|
||
|
|
ldr r2, =_sidata
|
||
|
|
movs r3, #0
|
||
|
|
b LoopCopyDataInit
|
||
|
|
|
||
|
|
CopyDataInit:
|
||
|
|
ldr r4, [r2, r3]
|
||
|
|
str r4, [r0, r3]
|
||
|
|
adds r3, r3, #4
|
||
|
|
|
||
|
|
LoopCopyDataInit:
|
||
|
|
adds r4, r0, r3
|
||
|
|
cmp r4, r1
|
||
|
|
bcc CopyDataInit
|
||
|
|
|
||
|
|
ldr r2, =_sbss
|
||
|
|
ldr r4, =_ebss
|
||
|
|
movs r3, #0
|
||
|
|
b LoopFillZerobss
|
||
|
|
|
||
|
|
FillZerobss:
|
||
|
|
str r3, [r2]
|
||
|
|
adds r2, r2, #4
|
||
|
|
|
||
|
|
LoopFillZerobss:
|
||
|
|
cmp r2, r4
|
||
|
|
bcc FillZerobss
|
||
|
|
|
||
|
|
bl __libc_init_array
|
||
|
|
bl main
|
||
|
|
|
||
|
|
LoopForever:
|
||
|
|
b LoopForever
|
||
|
|
|
||
|
|
.size Reset_Handler, .-Reset_Handler
|
||
|
|
|
||
|
|
.section .text.Default_Handler,"ax",%progbits
|
||
|
|
Default_Handler:
|
||
|
|
Infinite_Loop:
|
||
|
|
b Infinite_Loop
|
||
|
|
.size Default_Handler, .-Default_Handler
|
||
|
|
|
||
|
|
.macro def_irq handler
|
||
|
|
.weak \handler
|
||
|
|
.thumb_set \handler, Default_Handler
|
||
|
|
.endm
|
||
|
|
|
||
|
|
def_irq NMI_Handler
|
||
|
|
def_irq HardFault_Handler
|
||
|
|
def_irq MemManage_Handler
|
||
|
|
def_irq BusFault_Handler
|
||
|
|
def_irq UsageFault_Handler
|
||
|
|
def_irq SVC_Handler
|
||
|
|
def_irq DebugMon_Handler
|
||
|
|
def_irq PendSV_Handler
|
||
|
|
def_irq SysTick_Handler
|
||
|
|
def_irq WWDG_IRQHandler
|
||
|
|
def_irq PVD_IRQHandler
|
||
|
|
def_irq TAMPER_IRQHandler
|
||
|
|
def_irq RTC_IRQHandler
|
||
|
|
def_irq FLASH_IRQHandler
|
||
|
|
def_irq RCC_IRQHandler
|
||
|
|
def_irq EXTI0_IRQHandler
|
||
|
|
def_irq EXTI1_IRQHandler
|
||
|
|
def_irq EXTI2_IRQHandler
|
||
|
|
def_irq EXTI3_IRQHandler
|
||
|
|
def_irq EXTI4_IRQHandler
|
||
|
|
def_irq DMA1_Channel1_IRQHandler
|
||
|
|
def_irq DMA1_Channel2_IRQHandler
|
||
|
|
def_irq DMA1_Channel3_IRQHandler
|
||
|
|
def_irq DMA1_Channel4_IRQHandler
|
||
|
|
def_irq DMA1_Channel5_IRQHandler
|
||
|
|
def_irq DMA1_Channel6_IRQHandler
|
||
|
|
def_irq DMA1_Channel7_IRQHandler
|
||
|
|
def_irq ADC1_2_IRQHandler
|
||
|
|
def_irq USB_HP_CAN1_TX_IRQHandler
|
||
|
|
def_irq USB_LP_CAN1_RX0_IRQHandler
|
||
|
|
def_irq CAN1_RX1_IRQHandler
|
||
|
|
def_irq CAN1_SCE_IRQHandler
|
||
|
|
def_irq EXTI9_5_IRQHandler
|
||
|
|
def_irq TIM1_BRK_IRQHandler
|
||
|
|
def_irq TIM1_UP_IRQHandler
|
||
|
|
def_irq TIM1_TRG_COM_IRQHandler
|
||
|
|
def_irq TIM1_CC_IRQHandler
|
||
|
|
def_irq TIM2_IRQHandler
|
||
|
|
def_irq TIM3_IRQHandler
|
||
|
|
def_irq TIM4_IRQHandler
|
||
|
|
def_irq I2C1_EV_IRQHandler
|
||
|
|
def_irq I2C1_ER_IRQHandler
|
||
|
|
def_irq I2C2_EV_IRQHandler
|
||
|
|
def_irq I2C2_ER_IRQHandler
|
||
|
|
def_irq SPI1_IRQHandler
|
||
|
|
def_irq SPI2_IRQHandler
|
||
|
|
def_irq USART1_IRQHandler
|
||
|
|
def_irq USART2_IRQHandler
|
||
|
|
def_irq USART3_IRQHandler
|
||
|
|
def_irq EXTI15_10_IRQHandler
|
||
|
|
def_irq RTC_Alarm_IRQHandler
|
||
|
|
def_irq USBWakeUp_IRQHandler
|
||
|
|
|
||
|
|
.section .isr_vector,"a",%progbits
|
||
|
|
.type g_pfnVectors, %object
|
||
|
|
g_pfnVectors:
|
||
|
|
.word _estack
|
||
|
|
.word Reset_Handler
|
||
|
|
.word NMI_Handler
|
||
|
|
.word HardFault_Handler
|
||
|
|
.word MemManage_Handler
|
||
|
|
.word BusFault_Handler
|
||
|
|
.word UsageFault_Handler
|
||
|
|
.word 0
|
||
|
|
.word 0
|
||
|
|
.word 0
|
||
|
|
.word 0
|
||
|
|
.word SVC_Handler
|
||
|
|
.word DebugMon_Handler
|
||
|
|
.word 0
|
||
|
|
.word PendSV_Handler
|
||
|
|
.word SysTick_Handler
|
||
|
|
.word WWDG_IRQHandler
|
||
|
|
.word PVD_IRQHandler
|
||
|
|
.word TAMPER_IRQHandler
|
||
|
|
.word RTC_IRQHandler
|
||
|
|
.word FLASH_IRQHandler
|
||
|
|
.word RCC_IRQHandler
|
||
|
|
.word EXTI0_IRQHandler
|
||
|
|
.word EXTI1_IRQHandler
|
||
|
|
.word EXTI2_IRQHandler
|
||
|
|
.word EXTI3_IRQHandler
|
||
|
|
.word EXTI4_IRQHandler
|
||
|
|
.word DMA1_Channel1_IRQHandler
|
||
|
|
.word DMA1_Channel2_IRQHandler
|
||
|
|
.word DMA1_Channel3_IRQHandler
|
||
|
|
.word DMA1_Channel4_IRQHandler
|
||
|
|
.word DMA1_Channel5_IRQHandler
|
||
|
|
.word DMA1_Channel6_IRQHandler
|
||
|
|
.word DMA1_Channel7_IRQHandler
|
||
|
|
.word ADC1_2_IRQHandler
|
||
|
|
.word USB_HP_CAN1_TX_IRQHandler
|
||
|
|
.word USB_LP_CAN1_RX0_IRQHandler
|
||
|
|
.word CAN1_RX1_IRQHandler
|
||
|
|
.word CAN1_SCE_IRQHandler
|
||
|
|
.word EXTI9_5_IRQHandler
|
||
|
|
.word TIM1_BRK_IRQHandler
|
||
|
|
.word TIM1_UP_IRQHandler
|
||
|
|
.word TIM1_TRG_COM_IRQHandler
|
||
|
|
.word TIM1_CC_IRQHandler
|
||
|
|
.word TIM2_IRQHandler
|
||
|
|
.word TIM3_IRQHandler
|
||
|
|
.word TIM4_IRQHandler
|
||
|
|
.word I2C1_EV_IRQHandler
|
||
|
|
.word I2C1_ER_IRQHandler
|
||
|
|
.word I2C2_EV_IRQHandler
|
||
|
|
.word I2C2_ER_IRQHandler
|
||
|
|
.word SPI1_IRQHandler
|
||
|
|
.word SPI2_IRQHandler
|
||
|
|
.word USART1_IRQHandler
|
||
|
|
.word USART2_IRQHandler
|
||
|
|
.word USART3_IRQHandler
|
||
|
|
.word EXTI15_10_IRQHandler
|
||
|
|
.word RTC_Alarm_IRQHandler
|
||
|
|
.word USBWakeUp_IRQHandler
|
||
|
|
.size g_pfnVectors, .-g_pfnVectors
|