source: rtems/c/src/lib/libbsp/microblaze/microblaze_fpga/startup/sim-crtinit.S @ 0f62af0e

Last change on this file since 0f62af0e was 0f62af0e, checked in by Hesham ALMatary <heshamelmatary@…>, on 09/30/21 at 21:33:48

bsps: Add MicroBlaze? FPGA BSP

  • Property mode set to 100644
File size: 2.9 KB
Line 
1## Copyright (c) 2015, Hesham Almatary
2## Copyright (c) 2001, 2009 Xilinx, Inc.  All rights reserved.
3##
4## Redistribution and use in source and binary forms, with or without
5## modification, are permitted provided that the following conditions are
6## met:
7##
8## 1.  Redistributions source code must retain the above copyright notice,
9## this list of conditions and the following disclaimer.
10##
11## 2.  Redistributions in binary form must reproduce the above copyright
12## notice, this list of conditions and the following disclaimer in the
13## documentation and/or other materials provided with the distribution.
14##
15## 3.  Neither the name of Xilinx nor the names of its contributors may be
16## used to endorse or promote products derived from this software without
17## specific prior written permission.
18##
19## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
20## IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22## PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23## HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
25## TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27## LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28## NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29## SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30#
31#
32# sim-crtinit.s
33#
34# Default second stage of C run-time initialization that does not peform
35# BSS initialization to zero. Typical use is on a simulator.
36#
37
38        .globl _crtinit
39        .align 2
40        .ent _crtinit
41
42_crtinit:
43        addi    r1, r1, -20                     /* Save Link register    */
44        swi     r15, r1, 0
45
46#ifndef __rtems__
47        brlid   r15, _program_init              /* Initialize the program  */
48        nop
49
50        brlid   r15, __init                     /* Invoke language initialization functions */
51        nop
52#endif
53
54
55  /* Init .bss */
56  addi  r6, r0, bsp_section_bss_begin
57  addi  r7, r0, bsp_section_bss_end
58
59_clear_bss_loop:
60  swi   r0, r6, 0
61
62  addi  r6, r6, 4
63  cmpu  r8, r6, r7
64  bgti  r8, _clear_bss_loop
65
66        addi    r6, r0, 0                       /* Initialize argc = 1 and argv = NULL and envp = NULL  */
67        addi    r7, r0, 0
68        brlid   r15, boot_card                  /* Execute the program */
69        addi    r5, r0, 0
70
71        addik   r19, r3, 0                      /* Save return value */
72
73#ifndef __rtems__
74        brlid   r15, __fini                     /* Invoke language cleanup functions */
75        nop
76
77        brlid   r15, _program_clean             /* Cleanup the program  */
78        nop
79#endif
80
81        lw      r15, r1, r0                     /* Return back to CRT   */
82        addik   r3, r19, 0                      /* Restore return value */
83        rtsd    r15, 8
84        addi    r1, r1, 20
85        .end _crtinit
Note: See TracBrowser for help on using the repository browser.