0%

mips microAptiv 测试

芯片上

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
   0xbfc01000:  move    a2,t2
=> 0xbfc01004: lw a0,0(s0)
0xbfc01008: move a2,t2
0xbfc0100c: jal 0xbfc00a64
0xbfc01010: move a1,t3
0xbfc01014: bnez v0,0xbfc010a8
0xbfc01018: li a2,100
0xbfc0101c: li a1,4

0xbfc01000: jal 0xbfc00a64
0xbfc01004: lw a0,0(s0)
=> 0xbfc01008: move a2,t2
0xbfc0100c: jal 0xbfc00a64
0xbfc01010: move a1,t3
0xbfc01014: bnez v0,0xbfc010a8
0xbfc01018: li a2,100
0xbfc0101c: li a1,4


0xbfc01000: move a1,t3
0xbfc01004: lw a0,0(s0)
0xbfc01008: move a2,t2
=> 0xbfc0100c: jal 0xbfc00a64
0xbfc01010: move a1,t3
0xbfc01014: bnez v0,0xbfc010a8
0xbfc01018: li a2,100
0xbfc0101c: li a1,4

下载模式下调试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
	la a2,		change_k0_cca
li a1, 0xf
ins a2, a1, 29, 1 // changed to KSEG1 address by setting bit 29
jalr a2


LEAF(change_k0_cca)
// NOTE! This code must be executed in KSEG1 (not KSGE0 uncached)
// Set CCA for kseg0 to cacheable
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
mfc0 TEMP1, C0_CONFIG // read C0_Config
li TEMP2, 2 // CCA for all others

set_kseg0_cca:
ins TEMP1, TEMP2, 0, 3 // insert K0
mtc0 TEMP1, C0_CONFIG // write C0_Config
ehb
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
jalr.hb zero, ra

END(change_k0_cca)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
Remote debugging using 192.168.66.149:3333
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x82c0ee7c in ?? ()
Undefined command: "dashboard". Try "help".
Loading section .text_init, size 0x2540 lma 0x84104000
Loading section .text_ram, size 0x4628 lma 0x84106540
Loading section .rodata, size 0xa10 lma 0x8410ab68
Loading section .data, size 0x28 lma 0x8410b578
Start address 0x84104000, load size 30112
Transfer rate: 21 KB/sec, 6022 bytes/write.
Execution start_address = 0x84104000
Fastdata access Failed
Falling back to non-bulk write
46496 bytes written at address 0x84100000
downloaded 46496 bytes in 3.464504s (13.106 KiB/s)
target was already halted
Breakpoint 1 at 0x84104000: file src/asm/start.S, line 46.
Continuing.

Program stopped.
__reset_vector () at src/asm/start.S:46
46 la a2, check_nmi
(gdb) disassemble change_k0_cca
Dump of assembler code for function change_k0_cca:
0x84104804 <+0>: nop
0x84104808 <+4>: nop
0x8410480c <+8>: nop
0x84104810 <+12>: nop
0x84104814 <+16>: nop
0x84104818 <+20>: nop
0x8410481c <+24>: nop
0x84104820 <+28>: nop
0x84104824 <+32>: nop
0x84104828 <+36>: nop
0x8410482c <+40>: nop
0x84104830 <+44>: nop
0x84104834 <+48>: nop
0x84104838 <+52>: nop
0x8410483c <+56>: nop
0x84104840 <+60>: nop
0x84104844 <+64>: nop
0x84104848 <+68>: nop
0x8410484c <+72>: nop
0x84104850 <+76>: nop
0x84104854 <+80>: mfc0 t6,c0_config
0x84104858 <+84>: li t7,2
0x8410485c <+88>: ins t6,t7,0x0,0x3
0x84104860 <+92>: mtc0 t6,c0_config
0x84104864 <+96>: ehb
0x84104868 <+100>: nop
0x8410486c <+104>: nop
0x84104870 <+108>: nop
0x84104874 <+112>: nop
0x84104878 <+116>: nop
0x8410487c <+120>: nop
0x84104880 <+124>: nop
0x84104884 <+128>: nop
0x84104888 <+132>: nop
0x8410488c <+136>: nop
0x84104890 <+140>: nop
0x84104894 <+144>: nop
0x84104898 <+148>: nop
0x8410489c <+152>: nop
0x841048a0 <+156>: nop
0x841048a4 <+160>: nop
0x841048a8 <+164>: nop
0x841048ac <+168>: nop
0x841048b0 <+172>: nop
0x841048b4 <+176>: nop
0x841048b8 <+180>: jalr.hb zero,ra
0x841048bc <+184>: nop
End of assembler dump.
(gdb) b *0xa410486c
Breakpoint 2 at 0xa410486c
(gdb) c
Continuing.

Program stopped.
0xa410486c in ?? ()
(gdb) mon mips32 cp0 config
0xa4310582
(gdb) mon mww 0x82d030b4 0x80000080
(gdb) x/12i 0xbfc00100
0xbfc00100: sdc2 $16,147(k1)
0xbfc00104: ldc1 $f7,16913(ra)
0xbfc00108: sw gp,-16950(a0)
0xbfc0010c: 0x7f9f292a
0xbfc00110: jalx 0xb02f4ffd
0xbfc00114: 0x720b0904
0xbfc00118: 0x6082ee6e
0xbfc0011c: lwc2 $15,4232(t7)
0xbfc00120: lwc1 $f1,-17410(a2)
0xbfc00124: ldc2 $13,-24540(t7)
0xbfc00128: ll t7,-9333(t0)
0xbfc0012c: 0x1feb0088
(gdb) restore ~/work_space/benji/splfdl/text_init.bin binary 0xbfc00100
Restoring binary file /home/liguang/work_space/benji/splfdl/text_init.bin into memory (0xffffffffbfc00100 to 0xffffffffbfc03e40)
(gdb) x/12i 0xbfc00100
0xbfc00100: lui a2,0x82a0
0xbfc00104: addiu a2,a2,1172
0xbfc00108: jr a2
0xbfc0010c: mtc0 zero,c0_count
0xbfc00110: nop
0xbfc00114: nop
0xbfc00118: nop
0xbfc0011c: nop
0xbfc00120: nop
0xbfc00124: nop
0xbfc00128: nop
0xbfc0012c: nop
(gdb) mon mww 0x82d030b4 0x80
(gdb) x/12i 0xbfc00100
0xbfc00100: lui a2,0x82a0
0xbfc00104: addiu a2,a2,1172
0xbfc00108: jr a2
0xbfc0010c: mtc0 zero,c0_count
0xbfc00110: nop
0xbfc00114: nop
0xbfc00118: nop
0xbfc0011c: nop
0xbfc00120: nop
0xbfc00124: nop
0xbfc00128: nop
0xbfc0012c: nop
(gdb) b *0xbfc00100
warning: GDB can't find the start of the function at 0xa410486c.

GDB is unable to find the start of the function at 0xa410486c
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
This problem is most likely caused by an invalid program counter or
stack pointer.
However, if you think GDB should simply search farther back
from 0xa410486c for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
Breakpoint 3 at 0xbfc00100
(gdb) x/12i 0xbfc00100
0xbfc00100: lui a2,0x82a0
0xbfc00104: addiu a2,a2,1172
0xbfc00108: jr a2
0xbfc0010c: mtc0 zero,c0_count
0xbfc00110: nop
0xbfc00114: nop
0xbfc00118: nop
0xbfc0011c: nop
0xbfc00120: nop
0xbfc00124: nop
0xbfc00128: nop
0xbfc0012c: nop
(gdb) j *0xbfc00100
Continuing at 0xbfc00100.

Program stopped.
0xbfc00100 in ?? ()
(gdb) x/12i 0xbfc00100
=> 0xbfc00100: 0xf06275ff
0xbfc00104: 0xf06275ff
0xbfc00108: 0xf06275ff
0xbfc0010c: 0xf06275ff
0xbfc00110: 0xf06275ff
0xbfc00114: 0xf06275ff
0xbfc00118: 0xf06275ff
0xbfc0011c: 0xf06275ff
0xbfc00120: 0xf06275ff
0xbfc00124: 0xf06275ff
0xbfc00128: 0xf06275ff
0xbfc0012c: 0xf06275ff

fpga验证

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
❯ mgdb.microAptiv 8888
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=mips-mti-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
Remote debugging using localhost:7777
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x00000000 in ?? ()
The target is assumed to be little endian
target state: halted
target halted in MIPS32 mode due to debug-request, pc: 0x82c476d8
"on" or "off" expected.
(microAptiv) mon mips32 cp0 config
0xa4310582
(microAptiv) x/i $pc
=> 0x0: nop
(microAptiv) x/i $pc
=> 0x0: nop
(microAptiv) mon mww 0xa2a00008 0x7ca41004
(microAptiv) mon mww 0xa2a00000 0x40048000
(microAptiv) mon mww 0xa2a00004 0x24050003
(microAptiv) mon mww 0xa2a0000c 0x40848000
(microAptiv) x/8i 0xa2a00000
0xa2a00000: mfc0 t6,$16
0xa2a00004: li t7,3
0xa2a00008: 0x7dee1004
0xa2a0000c: mtc0 t6,$16
0xa2a00010: nop
0xa2a00014: nop
0xa2a00018: nop
0xa2a0001c: nop
=> (microAptiv) b *0xa2a00000
Breakpoint 1 at 0xa2a00000
==> (microAptiv) j *0xa2a00000
Continuing at 0xa2a00000.

Program stopped.
0xa2a00000 in ?? ()
(microAptiv) disassemble 0xa2a00000,+0x20
Dump of assembler code from 0xa2a00000 to 0xa2a00020:
=> 0xa2a00000: mfc0 a0,$16
0xa2a00004: li a1,3
0xa2a00008: 0x7ca41004
0xa2a0000c: mtc0 a0,$16
0xa2a00010: nop
0xa2a00014: nop
0xa2a00018: nop
0xa2a0001c: nop
End of assembler dump.
(microAptiv) ni
warning: GDB can't find the start of the function at 0xa2a00000.

GDB is unable to find the start of the function at 0xa2a00000
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
This problem is most likely caused by an invalid program counter or
stack pointer.
However, if you think GDB should simply search farther back
from 0xa2a00000 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
warning: GDB can't find the start of the function at 0xa2a00004.
0xa2a00004 in ?? ()
(microAptiv) ni
warning: GDB can't find the start of the function at 0xa2a00008.
0xa2a00008 in ?? ()
(microAptiv) ni
warning: GDB can't find the start of the function at 0xa2a0000c.
0xa2a0000c in ?? ()
(microAptiv) i r a0
a0: 0xa4310583
(microAptiv) ni
warning: GDB can't find the start of the function at 0xa2a00010.
0xa2a00010 in ?? ()
(microAptiv) mon mips32 cp0 config
0xa4310583
(microAptiv) disassemble 0xa2a00000,+0x20
Dump of assembler code from 0xa2a00000 to 0xa2a00020:
0xa2a00000: mfc0 a0,$16
0xa2a00004: li a1,3
0xa2a00008: 0x7ca41004
0xa2a0000c: mtc0 a0,$16
=> 0xa2a00010: nop
0xa2a00014: nop
0xa2a00018: nop
0xa2a0001c: nop
End of assembler dump.
(microAptiv) mon mww 0x82d030b4 0x80000080
(microAptiv) restore ~/work_space/benji/splfdl/text_init.bin binary 0xbfc00100
Restoring binary file /home/liguang/work_space/benji/splfdl/text_init.bin into memory (0xffffffffbfc00100 to 0xffffffffbfc03cb0)
(microAptiv) x/8i 0xbfc00100
0xbfc00100: lui a2,0xbfc0
0xbfc00104: addiu a2,a2,1172
0xbfc00108: jr a2
0xbfc0010c: mtc0 zero,$9
0xbfc00110: nop
0xbfc00114: nop
0xbfc00118: nop
0xbfc0011c: nop
(microAptiv) mon mww 0x82d030b4 0x80
(microAptiv) b *0xbfc00100
Breakpoint 2 at 0xbfc00100
(microAptiv) j *0xbfc00100
Continuing at 0xbfc00100.

Program stopped.
0xbfc00100 in ?? ()
(microAptiv) mon mips32 cp0 config
0xa4310583
(microAptiv) x/12i $pc
=> 0xbfc00100: lui a2,0xbfc0
0xbfc00104: addiu a2,a2,1172
0xbfc00108: jr a2
0xbfc0010c: mtc0 zero,$9
0xbfc00110: nop
0xbfc00114: nop
0xbfc00118: nop
0xbfc0011c: nop
0xbfc00120: nop
0xbfc00124: nop
0xbfc00128: nop
0xbfc0012c: nop
(microAptiv) x/12i 0xbfc00100
=> 0xbfc00100: lui a2,0xbfc0
0xbfc00104: addiu a2,a2,1172
0xbfc00108: jr a2
0xbfc0010c: mtc0 zero,$9
0xbfc00110: nop
0xbfc00114: nop
0xbfc00118: nop
0xbfc0011c: nop
0xbfc00120: nop
0xbfc00124: nop
0xbfc00128: nop
0xbfc0012c: nop
(microAptiv) ni
warning: GDB can't find the start of the function at 0xbfc00100.
warning: GDB can't find the start of the function at 0xbfc00104.
0xbfc00104 in ?? ()
(microAptiv) x/12i 0xbfc00100
0xbfc00100: lui a2,0xbfc0
=> 0xbfc00104: addiu a2,a2,1172
0xbfc00108: jr a2
0xbfc0010c: mtc0 zero,$9
0xbfc00110: nop
0xbfc00114: nop
0xbfc00118: nop
0xbfc0011c: nop
0xbfc00120: nop
0xbfc00124: nop
0xbfc00128: nop
0xbfc0012c: nop
(microAptiv) file ~/u
uA_baremetal.elf uAptiv_Baremetal.elf ua.bin
(microAptiv) file ~/uA_baremetal.elf
Reading symbols from ~/uA_baremetal.elf...
warning: GDB can't find the start of the function at 0xbfc00104.
(microAptiv) restore ~/u
uA_baremetal.elf uAptiv_Baremetal.elf ua.bin
(microAptiv) restore ~/work_space/benji/xy-bootrom/objs_release/uA_baremetal.bin binary 0x82c00000
Restoring binary file /home/liguang/work_space/benji/xy-bootrom/objs_release/uA_baremetal.bin into memory (0xffffffff82c00000 to 0xffffffff82c1147f)
(microAptiv) x/8i 0x82c00000
0x82c00000 <__reset_vector at src/startup/start.S:41>: lui a2,0x82c0
0x82c00004 <__reset_vector+4 at src/startup/start.S:41>: addiu a2,a2,1280
0x82c00008 <__reset_vector+8 at src/startup/start.S:43>: jr a2
0x82c0000c <__reset_vector+12 at src/startup/start.S:43>: mtc0 zero,c0_count
0x82c00010 <_boot_rom+16 at src/startup/start.S:43>: nop
0x82c00014 <_boot_rom+20 at src/startup/start.S:43>: nop
0x82c00018 <_boot_rom+24 at src/startup/start.S:43>: nop
0x82c0001c <_boot_rom+28 at src/startup/start.S:43>: nop
(microAptiv) b *0x82c00000
Breakpoint 3 at 0x82c00000: file src/startup/start.S, line 41.
(microAptiv) j *0x82c00000
Continuing at 0x82c00000.

Program stopped.
__reset_vector () at src/startup/start.S:41
41 la a2, check_nmi
(microAptiv) ni
0x82c00004 41 la a2, check_nmi
(microAptiv) x/12i 0xbfc00000
0xbfc00000: lui a2,0x82c0
0xbfc00004: addiu a2,a2,0
0xbfc00008: jr a2
0xbfc0000c: nop
0xbfc00010: nop
0xbfc00014: nop
0xbfc00018: nop
0xbfc0001c: nop
0xbfc00020: nop
0xbfc00024: nop
0xbfc00028: nop
0xbfc0002c: nop
(microAptiv) x/12i 0xbfc00100
0xbfc00100: lui a2,0xbfc0
0xbfc00104: addiu a2,a2,1172
0xbfc00108: jr a2
0xbfc0010c: mtc0 zero,c0_count
0xbfc00110: nop
0xbfc00114: nop
0xbfc00118: nop
0xbfc0011c: nop
0xbfc00120: nop
0xbfc00124: nop
0xbfc00128: nop
0xbfc0012c: nop
(microAptiv) ni
43 jr a2
(microAptiv) x/8i $pc
=> 0x82c00008 <__reset_vector+8 at src/startup/start.S:43>: jr a2
0x82c0000c <__reset_vector+12 at src/startup/start.S:43>: mtc0 zero,c0_count
0x82c00010 <_boot_rom+16 at src/startup/start.S:43>: nop
0x82c00014 <_boot_rom+20 at src/startup/start.S:43>: nop
0x82c00018 <_boot_rom+24 at src/startup/start.S:43>: nop
0x82c0001c <_boot_rom+28 at src/startup/start.S:43>: nop
0x82c00020 <_boot_rom+32 at src/startup/start.S:43>: nop
0x82c00024 <_boot_rom+36 at src/startup/start.S:43>: nop
(microAptiv) x/12i 0xbfc00100
0xbfc00100: lui a2,0xbfc0
0xbfc00104: addiu a2,a2,1172
0xbfc00108: jr a2
0xbfc0010c: mtc0 zero,c0_count
0xbfc00110: nop
0xbfc00114: nop
0xbfc00118: nop
0xbfc0011c: nop
0xbfc00120: nop
0xbfc00124: nop
0xbfc00128: nop
0xbfc0012c: nop
(microAptiv) b *0xbfc00100
Note: breakpoint 2 also set at pc 0xbfc00100.
Breakpoint 4 at 0xbfc00100
(microAptiv) j *0xbfc00100
Continuing at 0xbfc00100.

Program stopped.
0xbfc00100 in ?? ()
(microAptiv) ni
warning: GDB can't find the start of the function at 0xbfc00100.
warning: GDB can't find the start of the function at 0xbfc00104.
0xbfc00104 in ?? ()
(microAptiv) x/12i 0xbfc00100
0xbfc00100: lui a2,0xbfc0
=> 0xbfc00104: addiu a2,a2,1172
0xbfc00108: jr a2
0xbfc0010c: mtc0 zero,c0_count
0xbfc00110: nop
0xbfc00114: nop
0xbfc00118: nop
0xbfc0011c: nop
0xbfc00120: nop
0xbfc00124: nop
0xbfc00128: nop
0xbfc0012c: nop
(microAptiv)
1
2
3
test 按下
The CRU Status regs are: 0x5801 0x3347
The CRU Status regs are: 0x1 0x3347