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

Subversion Repositories openfire2

[/] [openfire2/] [trunk/] [sw/] [crt/] [crt-bram.s] - Blame information for rev 4

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

Line No. Rev Author Line
1 3 toni32
# crt.asm
2
#       C RunTime:
3
#       Used for initialization of small data
4
#       anchors and stack for programs compiled using
5
#       Xilinx Gnu Tools.
6
#       Used for initialization of user's bss area
7
#       All external and static variables are initialized
8
 
9
/*      Vector map (Interrupts, Exceptions, Breakpoints)                 */
10
#       # 0x00 #                Jump to Start   (reset vector)
11
#       # 0x04 #                nop
12
#       # 0x08 #                Imm instr for soft exception address [Hi halfword]
13
#       # 0x0c #                Jump to sof Exception handler        [Lo halfword]
14
#       # 0x10 #                Imm instr for interrupt address      [Hi halfword]
15
#       # 0x14 #                Jump to interrupt handler            [Lo halfword]
16
#       # 0x18 #                nop - Reserved for breakpoint vector
17
#       # 0x1C #                nop - Reserved for breakpoint vector
18
#       # 0x20 #                Imm instr for hw exception address   [Hi halfword]
19
#       # 0x24 #                Jump instr to hw exception handler   [Lo halfword]
20
 
21 4 toni32
                        .globl _start
22
                        .align 2
23
                        .ent _start
24
_start:                 brai    _start1
25
_vector_sw_exception:   brai    _exception_handler
26
_vector_interrupt:      brai    _interrupt_handler
27
_vector_breakpoint:     brai    _breakpoint_handler
28
_vector_hw_exception:   brai    _hw_exception_handler
29 3 toni32
 
30 4 toni32
/* ------ crt starts here --------- */
31 3 toni32
 
32
_start1:                                /* Set the Small Data Anchors and the Stack pointer  */
33
        la r13, r0, _SDA_BASE_
34
        la r2, r0, _SDA2_BASE_
35
        la r1, r0, _STACK_START         # stack is at end of block-ram
36
 
37
_crtinit:                               /* clear sbss */
38
        addi    r6,r0,__sbss_start      /* SBSS beginning       */
39
        addi    r7,r0,__sbss_end        /* SBSS end             */
40
        rsub    r18,r6,r7               /* Compare              */
41
        blei    r18,.Lendsbss
42
.Lloopsbss:
43
        sw      r0,r6,r0
44
        addi    r6,r6,4
45
        rsub    r18,r6,r7
46
        bgti    r18,.Lloopsbss
47
.Lendsbss:                              /* clear bss */
48
        addi    r6,r0,__bss_start       /* BSS beginning        */
49
        addi    r7,r0,__bss_end         /* BSS end              */
50
        rsub    r18,r6,r7               /* Compare              */
51
        blei    r18,.Lendbss
52
.Lloopbss:
53
        sw      r0,r6,r0
54
        addi    r6,r6,4
55
        rsub    r18,r6,r7
56
        bgti    r18,.Lloopbss
57
.Lendbss:
58
 
59
        brlid   r15,main                # enter main program (ignoring parameters: r5, r6 & r7)
60
        nop                             # fall throught to exit
61
        .end _start
62
 
63 4 toni32
_exception_handler:
64
_interrupt_handler:
65
_breakpoint_handler:
66
_hw_exception_handler:
67
 
68 3 toni32
        .globl exit                     # exit library call
69
        .ent exit
70
exit:
71 4 toni32
        bri _start1
72 3 toni32
        .end exit

powered by: WebSVN 2.1.0

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