1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12/*
13 * A default crt0 for ARM. It does the bare minimum required to get into
14 * main() with a sensible C environment.
15 *
16 * This file will only be linked in if:
17 *   - no other file already provides a _start symbol, and
18 *   - _start is an undefined external symbol (force this by passing
19 *     "-u _start" to ld).
20 */
21
22#include <autoconf.h>
23#include <sel4platsupport/gen_config.h>
24
25#ifdef CONFIG_LIB_SEL4_PLAT_SUPPORT_START
26
27.text
28
29/*
30 * Image Entry point.
31 */
32.global _start
33_start:
34    /* Setup a stack for ourselves. */
35    ldr     sp, =_stack_top
36
37    /* Setup bootinfo. The pointer to the bootinfo struct starts in 'r0'. */
38    bl      seL4_InitBootInfo
39
40    /* Call constructors and other initialisation functions. */
41    bl      _init
42
43    /* Call main. */
44    bl      main
45    b       exit
46
47/* .text Literal Pool */
48.pool
49
50/* Stack for the image. */
51.bss
52.balign  8
53_stack_bottom:
54.space  16384
55_stack_top:
56
57#endif /* CONFIG_LIB_SEL4_PLAT_SUPPORT_START */
58