1/* 2 * Copyright (c) 2006-2022, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2010-12-21 onelife Initial creation for EFM32 9 * 2011-07-06 onelife Modify to make use the start code in libraries 10 * 2012-05-15 onelife Modified to compatible with CMSIS v3 11 */ 12 13/***************************************************************************//** 14* @addtogroup cortex-m3 15* @{ 16*******************************************************************************/ 17 .syntax unified 18 .cpu cortex-m3 19 .fpu softvfp 20 .thumb 21 22/* start address for the initialization values of the .data section. 23defined in linker script */ 24 .word __etext 25/* start address for the .data section. defined in linker script */ 26 .word __data_start__ 27/* end address for the .data section. defined in linker script */ 28 .word __data_end__ 29/* start address for the .bss section. defined in linker script */ 30 .word __bss_start__ 31/* end address for the .bss section. defined in linker script */ 32 .word __bss_end__ 33 34/***************************************************************************//** 35 * @brief This is the code that gets called when the processor first 36 * starts execution following a reset event. Only the absolutely 37 * necessary set is performed, after which the application 38 * supplied main() routine is called. 39 * @param None 40 * @retval None 41*******************************************************************************/ 42 .thumb 43 .thumb_func 44 .section .cs3.init,"ax", %progbits 45 .globl _start 46 .type _start, %function 47_start: 48 /* Copy the data segment initializers from flash to SRAM */ 49 movs r1, #0 50 b LoopCopyDataInit 51 52CopyDataInit: 53 ldr r3, =__etext 54 ldr r3, [r3, r1] 55 str r3, [r0, r1] 56 adds r1, r1, #4 57 58LoopCopyDataInit: 59 ldr r0, =__data_start__ 60 ldr r3, =__data_end__ 61 adds r2, r0, r1 62 cmp r2, r3 63 bcc CopyDataInit 64 ldr r2, =__bss_start__ 65 b LoopFillZerobss 66 67/* Zero fill the bss segment. */ 68FillZerobss: 69 movs r3, #0 70 str r3, [r2], #4 71 72LoopFillZerobss: 73 ldr r3, = __bss_end__ 74 cmp r2, r3 75 bcc FillZerobss 76 /* Call the application's entry point.*/ 77 bl main 78 bx lr 79 .size _start, .-_start 80 81/***************************************************************************//** 82 * @} 83*******************************************************************************/ 84