wip
[fw/openocd] / testing / examples / ledtest-imx31pdk / crt0.S
1 /* Sample initialization file */\r
2         \r
3         .extern main\r
4         .extern exit\r
5         \r
6 /* .text is used instead of .section .text so it works with arm-aout too.  */\r
7         .text\r
8         .code 32\r
9         .align  0\r
10 \r
11         .global _mainCRTStartup\r
12         .global _start\r
13         .global start\r
14 start:\r
15 _start:\r
16 _mainCRTStartup:\r
17 \r
18 /* Start by setting up a stack */\r
19         /*  Set up the stack pointer to end of bss */\r
20         ldr     r3, .LC2\r
21         mov     sp, r3\r
22 \r
23         sub     sl, sp, #512    /* Still assumes 512 bytes below sl */\r
24 \r
25         mov     a2, #0          /* Second arg: fill value */\r
26         mov     fp, a2          /* Null frame pointer */\r
27         mov     r7, a2          /* Null frame pointer for Thumb */\r
28         \r
29         ldr     a1, .LC1        /* First arg: start of memory block */\r
30         ldr     a3, .LC2        /* Second arg: end of memory block */\r
31         sub     a3, a3, a1      /* Third arg: length of block */\r
32         \r
33         mov     r0, #0          /*  no arguments  */\r
34         mov     r1, #0          /*  no argv either */\r
35 \r
36         bl      main\r
37         bl      exit            /* Should not return */\r
38 \r
39         /* For Thumb, constants must be after the code since only \r
40         positive offsets are supported for PC relative addresses. */\r
41         \r
42         .align 0\r
43 .LC1:\r
44         .word   __bss_start__\r
45 .LC2:\r
46         .word   __bss_end__\r
47 \r