summaryrefslogtreecommitdiffstats
path: root/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/REENT/MAIN.S
blob: 552f24dea33d4b8da99ba675cc4ce1ccf593542f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
        EXPORT  __main
        IMPORT  main
        IMPORT  |sb$$interLUdata$$Base|

SWI_GetEnv  *       &10
SWI_Exit    *       &11

        AREA |StartupCode|, CODE, READONLY, REENTRANT

;
; This is the initial entry point to the image.
; (The compiler ensures it is linked in to the image by generating a reference
;  to __main from the object module generated from compiling a file containing
;  an  extern main()).
        ENTRY

; We have to establish a stack for C, initialise the library, then call _main
; (which will set up the arguments for main, then call it).
|__main|
        LDR     r9, =|sb$$interLUdata$$Base|
        SWI     SWI_GetEnv              ; to decide heap limit
        MOV     r13, r1                 ; top of program workspace
        BL      |main|
        SWI     SWI_Exit

        END