    .text

    .extern     main
    .extern     _sdata_loadaddr
    .extern     _sp_base

	.org 0x000

	#  Top of Stack
	.long (_sp_base)
	# Reset Handler
	.long (_startup + 1)


	.org 0x100

	.global _startup
_startup:
        LDR     r1, =_sdata_loadaddr
        LDR     r2, =_sdata
        LDR     r3, =_edata
__copy_loop:
        LDRB    r4, [r1]
        STRB    r4, [r2, #0]
        ADD     r1, r1, #1
        ADD     r2, r2, #1
        CMP     r3, r2
        BGT     __copy_loop

        LDR     R0, =main
        LDR     R1, =0x1
        ORR     R0, R1
        BX      R0

