嵌入式gcc的编译过程
2011-11-20 19:50
267 查看
嵌入式上得使用交叉编译器进行编译,这里以ARM平台的编译C程序的编译器arm-linux-gcc为例。
hello.c:
1.预处理(Preprocessing):
arm-linux-gcc -E hello.c -o hello.i
生成预处理文件hello.i
2.编译(Compilation):
arm-linux-gcc -S hello.i -o hello.s
生成汇编代码hello.s,此时的汇编语言为ARM汇编指令,不是x86体系下的汇编指令
3.汇编(Assembly):
arm-linux-gcc -c hello.s -o hello.o
4.链接(Linking):
arm-linux-gcc hello.o -o hello
生成ARM平台下可以运行的可执行文件hello
若在PC机上运行则会被告知:cannot execute binary file。可以用file hello查看hello文件属性。
hello.c:
#include <stdio.h> int main() { printf("Hello world!\n"); return 0; }
1.预处理(Preprocessing):
arm-linux-gcc -E hello.c -o hello.i
生成预处理文件hello.i
2.编译(Compilation):
arm-linux-gcc -S hello.i -o hello.s
生成汇编代码hello.s,此时的汇编语言为ARM汇编指令,不是x86体系下的汇编指令
3.汇编(Assembly):
arm-linux-gcc -c hello.s -o hello.o
4.链接(Linking):
arm-linux-gcc hello.o -o hello
生成ARM平台下可以运行的可执行文件hello
若在PC机上运行则会被告知:cannot execute binary file。可以用file hello查看hello文件属性。
相关文章推荐
- Ubuntu 12.04嵌入式交叉编译环境arm-linux-gcc搭建过程
- Ubuntu 12.04嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- Ubuntu 12.04嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- Ubuntu12.04嵌入式交叉编译环境arm-linu-gcc搭建过程,图解
- Ubuntu 12.04嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- Ubuntu 16.04[64bit]嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- Ubuntu12.04嵌入式交叉编译环境arm-linu-gcc搭建过程,图解
- Ubuntu12.04嵌入式交叉编译环境arm-linux-gcc搭建过程,图解
- Ubuntu12.04嵌入式交叉编译环境arm-linu-gcc搭建过程,图解
- 64位Ubuntu 16.04搭建嵌入式交叉编译环境arm-linux-gcc过程图解
- Ubuntu 12.04嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- ok6410[001] Ubuntu 16.04[64bit]嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- Ubuntu 16.04[64bit]嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- 【嵌入式开发】gcc 学习笔记(一) - 编译C程序 及 编译过程
- 【嵌入式开发】gcc 学习笔记(一) - 编译C程序 及 编译过程
- Ubuntu 14.04 LTS嵌入式交叉编译环境arm-linux-gcc搭建过程图解
- Ubuntu12.04嵌入式交叉编译环境arm-linu-gcc搭建过程,图解
- 64位Ubuntu 16.04搭建嵌入式交叉编译环境arm-linux-gcc过程图解
- Ubuntu12.04嵌入式交叉编译环境arm-linu-gcc搭建过程,图解
- Ubuntu14.04下嵌入式交叉编译环境arm-linux-gcc-4.3.3搭建过程