kopia lustrzana https://github.com/piotr022/UV_K5_playground
71 wiersze
1.4 KiB
ArmAsm
71 wiersze
1.4 KiB
ArmAsm
.syntax unified
|
|
.cpu cortex-m0
|
|
.fpu softvfp
|
|
.thumb
|
|
|
|
.global g_pfnVectors
|
|
.global Default_Handler
|
|
|
|
/* start address for the initialization values of the .data section.
|
|
defined in linker script */
|
|
.word _sidata
|
|
/* start address for the .data section. defined in linker script */
|
|
.word _sdata
|
|
/* end address for the .data section. defined in linker script */
|
|
.word _edata
|
|
/* start address for the .bss section. defined in linker script */
|
|
.word _sbss
|
|
/* end address for the .bss section. defined in linker script */
|
|
.word _ebss
|
|
|
|
.section .text.Reset_Handler
|
|
.weak Reset_Handler
|
|
.type Reset_Handler, %function
|
|
Reset_Handler:
|
|
ldr r0, =_estack
|
|
mov sp, r0 /* set stack pointer */
|
|
|
|
/* Copy the data segment initializers from flash to SRAM */
|
|
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
|
|
|
|
/* Zero fill the bss segment. */
|
|
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
|
|
|
|
/* Call the clock system intitialization function.*/
|
|
/* bl SystemInit */
|
|
/* Call static constructors */
|
|
@bl __libc_init_array
|
|
/* Call the application's entry point.*/
|
|
bl main
|
|
|
|
LoopForever:
|
|
b LoopForever
|
|
|
|
|
|
.size Reset_Handler, .-Reset_Handler
|