发表于:2010/1/26 10:47:32
#0楼
按照书中实验步骤写好代码后,执行命令as -o hello_mips.o hello_mips.s
出现一堆error,提示:hello_mips.s: Assembler messages:
hello_mips.s:4: Error: unknown pseudo-op: `.rdata'
hello_mips.s:13: Error: unknown pseudo-op: `.ent'
hello_mips.s:15: Error: no such instruction: `move $4,$0'
hello_mips.s:16: Error: no such instruction: `la $5,hello'
hello_mips.s:17: Error: no such instruction: `li $6,len'
hello_mips.s:18: Error: no such instruction: `li $2,4004'
hello_mips.s:21: Error: no such instruction: `li $2,4001'
hello_mips.s:22: Error: no such instruction: `li $4,0'
经检查发现是工具链使用错了,
把命令改为mipsel-linux-as –o hello_mips.o hello_mips.s
此时发现没有上述error了,但是有一个warning,修改源文件hello_mips.s,将其中的两处
_start改为__start (注意此处是两个下划线),重新执行命令,编译通过
接着执行:
mipsel-linux-ld hello_mips.o
ls,发现生成a.out文件,将其拷到开发板中就可以执行了
此贴转自www.longxinzhijian.cn论坛
出现一堆error,提示:hello_mips.s: Assembler messages:
hello_mips.s:4: Error: unknown pseudo-op: `.rdata'
hello_mips.s:13: Error: unknown pseudo-op: `.ent'
hello_mips.s:15: Error: no such instruction: `move $4,$0'
hello_mips.s:16: Error: no such instruction: `la $5,hello'
hello_mips.s:17: Error: no such instruction: `li $6,len'
hello_mips.s:18: Error: no such instruction: `li $2,4004'
hello_mips.s:21: Error: no such instruction: `li $2,4001'
hello_mips.s:22: Error: no such instruction: `li $4,0'
经检查发现是工具链使用错了,
把命令改为mipsel-linux-as –o hello_mips.o hello_mips.s
此时发现没有上述error了,但是有一个warning,修改源文件hello_mips.s,将其中的两处
_start改为__start (注意此处是两个下划线),重新执行命令,编译通过
接着执行:
mipsel-linux-ld hello_mips.o
ls,发现生成a.out文件,将其拷到开发板中就可以执行了
此贴转自www.longxinzhijian.cn论坛