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