/** * \file * * * \brief Cortex-M3 architecture's entry point * * \author Andrea Righi */ .syntax unified .thumb .section .init, "ax", %progbits .weak __init .set __init, __init0 .weak __init1 .set __init1, __dummy_init .weak __init2 .set __init2, __dummy_init .balign 2 .thumb_func __dummy_init: bx lr /* * Reset handler. */ .balign 2 .thumb_func __init0: /* Disable IRQs */ cpsid i /* Call the early hardware initialization routine */ bl __init1 /* Copy the data segment initializers from flash to SRAM */ ldr r0, =__text_end ldr r1, =__data_start ldr r2, =__data_end data_loop: cmp r1, r2 ittt lo ldrlo r3, [r0], #4 strlo r3, [r1], #4 blo data_loop /* Zero fill the bss segment */ ldr r1, =__bss_start ldr r2, =__bss_end mov r0, #0 bss_loop: cmp r1, r2 itt lo strlo r0, [r1], #4 blo bss_loop /* Call the hardware initialization routine */ bl __init2 /* Call the application's entry point */ bl main end: wfi b end