检验一下:
[root@localhost uclinux]# which arm-elf-gcc
/usr/local/bin/arm-elf-gcc
[root@localhost bluesea]# arm-elf-gcc
arm-elf-gcc: No input files
编写实验程序(国际惯例hello.c),程序清单如下:
int main(void)
{
int i;
for(i = 0; i < 6; i++){
printf("i = %d ",i);
printf("Hello, embedded linux!/n");
}
return 0;
}
保存后执行:
#arm-elf-gcc -Wl,-elf2flt -o hello hello.c
其中,-elf2flt参数是将elf文件格式转为flat文件格式
然后:
#ls
hello hello.c hello.gdb
#file hello
hello: BFLT executable - version 4 ram
其中hello文件是BFLT(binary FLAT).
利用不同编译器编译:
[root@localhost uclinux]# ls
hello hello.c hello.c~ hello.gdb
[root@localhost uclinux]# rm hello
rm:是否删除 普通文件 “hello”? y
[root@localhost uclinux]# rm hello.c~
rm:是否删除 普通文件 “hello.c~”? y
[root@localhost uclinux]# rm hello.gdb
rm:是否删除 普通文件 “hello.gdb”? y
[root@localhost uclinux]# gcc -o hello hello.c
hello.c: 在函数 ‘main’ 中:
hello.c:7: 警告:隐式声明与内建函数 ‘printf’ 不兼容
[root@localhost uclinux]# ls
hello hello.c
[root@localhost uclinux]# hello
i=0Hello,embedded linux!
i=1Hello,embedded linux!
i=2Hello,embedded linux!
i=3Hello,embedded linux!
i=4Hello,embedded linux!
i=5Hello,embedded linux!
[root@localhost uclinux]# which arm-elf-gcc
/usr/local/bin/arm-elf-gcc
[root@localhost bluesea]# arm-elf-gcc
arm-elf-gcc: No input files
编写实验程序(国际惯例hello.c),程序清单如下:
int main(void)
{
int i;
for(i = 0; i < 6; i++){
printf("i = %d ",i);
printf("Hello, embedded linux!/n");
}
return 0;
}
保存后执行:
#arm-elf-gcc -Wl,-elf2flt -o hello hello.c
其中,-elf2flt参数是将elf文件格式转为flat文件格式
然后:
#ls
hello hello.c hello.gdb
#file hello
hello: BFLT executable - version 4 ram
其中hello文件是BFLT(binary FLAT).
利用不同编译器编译:
[root@localhost uclinux]# ls
hello hello.c hello.c~ hello.gdb
[root@localhost uclinux]# rm hello
rm:是否删除 普通文件 “hello”? y
[root@localhost uclinux]# rm hello.c~
rm:是否删除 普通文件 “hello.c~”? y
[root@localhost uclinux]# rm hello.gdb
rm:是否删除 普通文件 “hello.gdb”? y
[root@localhost uclinux]# gcc -o hello hello.c
hello.c: 在函数 ‘main’ 中:
hello.c:7: 警告:隐式声明与内建函数 ‘printf’ 不兼容
[root@localhost uclinux]# ls
hello hello.c
[root@localhost uclinux]# hello
i=0Hello,embedded linux!
i=1Hello,embedded linux!
i=2Hello,embedded linux!
i=3Hello,embedded linux!
i=4Hello,embedded linux!
i=5Hello,embedded linux!