OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [libgloss/] [crx/] [crt0.S] - Blame information for rev 828

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
 ##############################################################################
2
 # crt0.S -- CRX default start-up routine                                     #
3
 #                                                                            #
4
 # Copyright (c) 2004 National Semiconductor Corporation                      #
5
 #                                                                            #
6
 # The authors hereby grant permission to use, copy, modify, distribute,      #
7
 # and license this software and its documentation for any purpose, provided  #
8
 # that existing copyright notices are retained in all copies and that this   #
9
 # notice is included verbatim in any distributions. No written agreement,    #
10
 # license, or royalty fee is required for any of the authorized uses.        #
11
 # Modifications to this software may be copyrighted by their authors         #
12
 # and need not follow the licensing terms described here, provided that      #
13
 # the new terms are clearly indicated on the first page of each file where   #
14
 # they apply.                                                                #
15
 #                                                                            #
16
 # This is the  start routine of your CRX program.                            #
17
 # It is linked with your application automatically. You can use              #
18
 # this routine as a template and modify it to your needs, yet this           #
19
 # file must be supplied for the compiler.                                    #
20
 # It is assumed that the following symbols are defined in your linker        #
21
 # script: __STACK_START, __ISTACK_START, __DATA_START, __DATA_END,           #
22
 # __DATA_IMAGE_START, __BSS_START, __BSS_END.                                #
23
 ##############################################################################
24
 
25
        .text
26
        .align  4
27
        .globl          _main
28
        .globl          _start
29
        .globl          _atexit
30
        .globl          _exit
31
        .globl          __dispatch_table
32
 
33
_start:
34
 
35
 #----------------------------------------------------------------------------#
36
 # Initialize the stack pointers. The constants __STACK_START and             #
37
 # __ISTACK_START should be defined in the linker script.                     #
38
 
39
        movd    $__STACK_START, sp
40
        movd    $__ISTACK_START, r0
41
        mtpr    r0, isp
42
 
43
 #----------------------------------------------------------------------------#
44
 # Initialize the default sections according to the linker script.            #
45
 
46
        movd    $__DATA_END, r4
47
        subd    $__DATA_START, r4
48
        movd    $__DATA_START, r2
49
        movd    $__DATA_IMAGE_START, r3
50
        bal     ra,     _memcpy
51
        movd    $__BSS_END, r4
52
        subd    $__BSS_START, r4
53
        movd    $__BSS_START, r2
54
        movd    $0, r3
55
        bal     ra,     _memset
56
 
57
 #----------------------------------------------------------------------------#
58
 # Initialize the intbase (pointer to the dispatch table).                    #
59
 
60
        movd    $__dispatch_table, r0
61
        mtpr    r0, intbase
62
 
63
 #----------------------------------------------------------------------------#
64
 # Handle global and static constructurs execution and setup                  #
65
 # destructors to be called from exit.                                        #
66
        bal     ra,     _init
67
        movd    $_fini, r2
68
        bal     ra, _atexit
69
 
70
 #----------------------------------------------------------------------------#
71
 # Here you may add initializations that are specific to your                 #
72
 # environment. For example:                                                  #
73
 # 1. Configure wait states and other BIU parameters in order to get          #
74
 #    the best performance out of your target (see the specification          #
75
 #    document).                                                              #
76
 # 2. Enable maskable interrupts that should be enabled when your             #
77
 #    program starts to execute.                                              #
78
 
79
 
80
 #----------------------------------------------------------------------------#
81
 # Jump to the main function in your application.                             #
82
 
83
        bal     ra, _main
84
 
85
 #----------------------------------------------------------------------------#
86
 # Upon returning from the main function (if it isn't an infinite loop),      #
87
 # jump to the exit function. The exit function is located in the             #
88
 # library 'libc.a'.                                                          #
89
 
90
        movd    r0, r2          # _main return value is passed as a
91
                                                # parameter to exit.
92
        br      _exit                   # returns control to the debugger.
93
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.