資源簡介
Ubuntu下MIPS編譯環境建立所需工具,具體操作參考我的博客
代碼片段和文件信息
#include?
#include?
char?*option_invalid??=?NULL;
char?*option_file_in??=?NULL;
char?*option_file_out?=?NULL;
FILE?*file_in_descriptor??=?NULL;
FILE?*file_out_descriptor?=?NULL;
void?exception_handler(int?code)?{
????switch?(code)?{
????????case?0:
????????????break;
????????case?10001:
????????????printf(“Error?(10001):?No?option?recognized.\n“);
????????????printf(“Please?specify?at?least?one?valid?option.\n“);
????????????break;
????????case?10002:
????????????printf(“Error?(10002):?Invalid?option:?%s\n“?option_invalid);
????????????break;
????????case?10003:
????????????printf(“Error?(10003):?No?input?Binary?file?specified.\n“);
????????????break;
????????case?10004:
????????????printf(“Error?(10004):?Cannot?open?file:?%s\n“?option_file_in);
????????????break;
????????case?10005:
????????????printf(“Error?(10005):?Cannot?create?file:?%s\n“?option_file_out);
????????????break;
????????default:
????????????break;
????}
????if?(file_in_descriptor??!=?NULL)?{
????????fclose(file_in_descriptor);
????}
????if?(file_out_descriptor?!=?NULL)?{
????????fclose(file_out_descriptor);
????}
????exit(0);
}
int?main(int?argc?char?**argv)?{
?
????int?i=0j=0;
????unsigned?char?temp1temp2temp3temp4;
????unsigned?int?option_flag?=?0;
????while?(argc?>?0)?{
????????if?(**argv?==?‘-‘)?{
????????????(*argv)?++;
????????????switch?(**argv)?{
????????????????case?‘f‘:
????????????????????option_flag?|=?0x4;
????????????????????argv?++;
????????????????????option_file_in?=?*argv;
????????????????????argc?--;
????????????????????break;
????????????????case?‘o‘:
????????????????????option_flag?|=?0x8;
????????????????????argv?++;
????????????????????option_file_out?=?*argv;
????????????????????argc?--;
????????????????????break;
????????????????default:
????????????????????option_flag?|=?0x1;
????????????????????(*argv)?--;
????????????????????option_invalid?=?*argv;
????????????????????break;
????????????}
????????}
????????argv?++;
????????argc?--;
????}
????file_in_descriptor?=?fopen(option_file_in?“rb“);
????if?(file_in_descriptor?==?NULL)?{
????????exception_handler(10004);
????}
????file_out_descriptor?=?fopen(option_file_out?“w“);
????if?(file_out_descriptor?==?NULL)?{
????????exception_handler(10005);
????}
????
????while?(!feof(file_in_descriptor))?{
?????????
????????????fscanf(file_in_descriptor?“%c“?&temp1);
????????????fscanf(file_in_descriptor?“%c“?&temp2);
????????????fscanf(file_in_descriptor?“%c“?&temp3);
????????????fscanf(file_in_descriptor?“%c“?&temp4);
????????????if(!feof(file_in_descriptor))
????????????{
?????????????fprintf(file_out_descriptor?“%02x“?temp1);
?????????????fprintf(file_out_descriptor?“%02x“?temp2);
?????????????fprintf(file_out_descriptor?“%02x“?temp3);
?????????????fprintf(file_out_descriptor?“%02x“?temp4);
?????????????fprintf(file_out_descriptor?“\n“);
????????????}
??
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-04-24?11:17??Ubuntu下MIPS編譯環境建立所需工具\
?????目錄???????????0??2016-04-24?11:17??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\
?????文件????????8172??2016-04-24?11:17??Ubuntu下MIPS編譯環境建立所需工具\AsmTest.zip
?????文件????????3073??2014-05-07?10:03??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\Bin2Mem.c
?????文件????????7733??2013-10-08?22:31??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\Bin2Mem.exe
?????文件?????????326??2013-11-03?09:31??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\inst_rom.asm
?????文件??????????16??2013-11-03?09:31??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\inst_rom.bin
?????文件??????????36??2013-11-03?09:31??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\inst_rom.data
?????文件?????????632??2013-11-03?09:31??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\inst_rom.o
?????文件???????65957??2013-11-03?09:31??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\inst_rom.om
?????文件?????????267??2014-05-03?11:47??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\inst_rom.S
?????文件?????????267??2013-11-03?09:28??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\inst_rom.S~
?????文件?????????651??2013-11-02?17:57??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\Makefile
?????文件????????1724??2013-10-17?22:54??Ubuntu下MIPS編譯環境建立所需工具\AsmTest\ram.ld
?????文件????48856754??2013-08-02?13:34??Ubuntu下MIPS編譯環境建立所需工具\mips-sde-elf-i686-pc-linux-gnu.tar.tar
評論
共有 條評論