OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [libgloss/] [xstormy16/] [crt0_stub.s] - Blame information for rev 252

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

Line No. Rev Author Line
1 207 jeremybenn
# XSTORMY16 startup code for GDB stub.
2
 
3
# CPU Data for Sanyo EVA debugger at 0x7F00
4
        .section .cpudata,"ax"
5
        .byte   0x00,0x02,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
6
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
7
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
8
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
9
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
10
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
11
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
12
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
13
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
14
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
15
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
16
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
17
        .byte   0x44,0x35,0x39,0x52,0x30,0x30,0x30,0x30,0x2E,0x4F,0x50,0x54,0x00,0x00,0x00,0x00
18
        .byte   0x4c,0x43,0x35,0x39,0x52,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00
19
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x80,0x00,0x20,0x48,0x00,0x00,0x00
20
        .byte   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x20,0x01,0x12,0x31,0x23,0x59
21
 
22
# Interrupt vectors at 0x8000.
23
        .section .int_vec,"ax"
24
        .global _start
25
        .align 1
26
_start:
27
        ;; Reset, watchdog timer interrupt
28
        jmpf _int_reset
29
        ;; base timer interrupt
30
        jmpf _int_basetimer
31
        ;; timer 0
32
        jmpf _int_timer0
33
        ;; timer 1
34
        jmpf _int_timer1
35
        ;; SIO0 interrupt
36
        jmpf _int_sio0
37
        ;; SIO1 interrupt
38
        jmpf _int_sio1
39
        ;; port0 interrupt
40
        jmpf _int_port0
41
        ;; port1 interrupt
42
        jmpf _int_port1
43
 
44
        .org 0x80
45
        ;; sys interrupt (0x8080)
46
        jmpf _int_sys
47
 
48
        ;; Application void write(char *buf, int nbytes)
49
        ;; This jmps to a stub function to packetize the buf for GDB
50
        jmpf gdb_write
51
        ;; Application int read(char *buf, int nbytes)
52
        jmpf gdb_read
53
 
54
        .text
55
# Reset code, set up memory and call main.
56
_int_reset:
57
        ;; Set up the application stack pointer.
58
        mov sp,#0x002
59
 
60
        ;; Zero the data space
61
        mov r0,#_edata
62
        mov r1,#_end
63
        mov r2,#0
64
0:       mov.w (r0++),r2
65
        blt r0,r1,0b
66
 
67
        ;; Init the UART
68
        callf uart_init
69
 
70
        ;; Turn on illegal insn trap
71
        mov   r0,r14
72
        set1  r0,#11
73
        mov   r14,r0
74
        mov.b 0x7f08,#0x11
75
        mov.b 0x7f09,#0x10
76
 
77
        ;; "breakpoint" sends us into stub.
78
0:
79
        .hword 0x0006
80
        br  0b
81
 
82
_int_sys:
83
        push  r13
84
        mov   r13,#registers
85
        mov.w (r13++),r0
86
        mov.w (r13++),r1
87
        mov.w (r13++),r2
88
        mov.w (r13++),r3
89
        mov.w (r13++),r4
90
        mov.w (r13++),r5
91
        mov.w (r13++),r6
92
        mov.w (r13++),r7
93
        mov   r0,r8
94
        mov.w (r13++),r0
95
        mov   r0,r9
96
        mov.w (r13++),r0
97
        mov   r0,r10
98
        mov.w (r13++),r0
99
        mov   r0,r11
100
        mov.w (r13++),r0
101
        mov   r0,r12
102
        mov.w (r13++),r0
103
        pop   r0
104
        mov.w (r13++),r0    ; R13
105
        pop   r0
106
        mov.w (r13++),r0    ; PSW
107
        mov   r0,r15
108
        sub   r0,#4
109
        mov.w (r13++),r0    ; SP
110
        pop   r0
111
        pop   r1
112
        mov.w (r13++),r1    ; PCL
113
        mov.w (r13++),r0    ; PCH
114
 
115
        ;; switch to stub stack and invoke stub
116
        mov sp,#0x700
117
        callf handle_exception
118
 
119
        mov   r0,#registers+34
120
        mov.w r1,(r0)           ; PCH
121
        mov.w r2,(--r0)         ; PCL
122
        mov.w r3,(--r0)         ; SP
123
        mov   r15,r3
124
        push  r2
125
        push  r1
126
        mov.w r1,(--r0)    ; PSW
127
        push  r1
128
        mov.w r1,(--r0)
129
        mov   r13,r1
130
        mov.w r1,(--r0)
131
        mov   r12,r1
132
        mov.w r1,(--r0)
133
        mov   r11,r1
134
        mov.w r1,(--r0)
135
        mov   r10,r1
136
        mov.w r1,(--r0)
137
        mov   r9,r1
138
        mov.w r1,(--r0)
139
        mov   r8,r1
140
        mov.w r7,(--r0)
141
        mov.w r6,(--r0)
142
        mov.w r5,(--r0)
143
        mov.w r4,(--r0)
144
        mov.w r3,(--r0)
145
        mov.w r2,(--r0)
146
        mov.w r1,(--r0)
147
        mov.w r0,(--r0)
148
        iret
149
1:      .size _int_sys,1b-_int_sys
150
 
151
 

powered by: WebSVN 2.1.0

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