其他分享
首页 > 其他分享> > 编译链接

编译链接

作者:互联网

from 《自己动手做CPU》:

流程:
1.新建一个文件,文件名为inst_rom.S,其中为汇编代码
2.cd到上述文件所在目录,使用如下命令编译代码,添加了“-mips32”选项,即按照MIPS32指令集架构编译:
mips-sde-elf-as -mips32 inst_rom.S -o inst_rom.o
3.1:
总步骤
编译: mips-sde-elf-as -mips32 inst_rom.S -o inst_rom.o
链接: mips-sde-elf-ld -T ram.ld inst_rom.o -o inst_rom.om
得到bin文件:mips-sde-elf-objcopy -O binary inst_rom.om inst_rom.bin
格式转化: ./Bin2Mem.exe -f inst_rom.bin -o inst_rom.data
3.2:
或者编写makefile文件实现上述四步:
路径调整到源代码所在目录,输入 make all
最终得到 inst_rom.data

4:最后我们可以在增加一步,使用mips-sde-elf-objdump对inst_rom.om进行反汇编,从而得到指令与其二进制字的对应,如下
mips-sde-elf-objdump -D inst_rom.om > inst_rom.asm

.asm文件可以用记事本打开

标签:om,rom,sde,elf,编译,inst,mips,链接
来源: https://www.cnblogs.com/wytong/p/14203466.html