交叉编译工具链
有如任何其它开发活动一般,嵌入式开发的第一步是建立(setting up)用于构建嵌入式Linux内核(当然包括驱动程序)及应用程序的工具链(toolchains )。不过,嵌入式开发需要是跨平台工具链。跨平台是什么意思呢?一般开发活动是在本地编译,使用是本地的工具链;而由于嵌入式的软硬资源(内存不足、没有本地编译器或操作系统都没有)限制等没法进行本地开发。需要在Linux-x86 主机(HOST)开发,使用主机的编译器生成目标(TARGET)平台代码,这个过程叫交叉编译。
我们常常说的编译器有广义和狭义之分。狭义的编译器只完软件编译(或者叫软件构建)的第一步;广义的编译器包括了软件编译(或者叫软件构建)所需要代码库(比如libc)和其它构建工具(比如汇编器和连接器)。无论是什么编译器都需要支持的代码库和各种构建工具,交叉编译也不例外。一整套广义的编译器称为交叉编译工具链。
何为工具链?
In software, a toolchain is the set ofcomputer programs (tools) that are used to create a product (typically anothercomputer program or system of programs). The tools may be used in a chain, sothat the output of each tool becomes the input for the next, but the term isused widely to refer to any set of linked development tools.
A simple software development toolchainconsists of a text editor for editing source code, a compiler and linker totransform the source code into an executable program, libraries to provideinterfaces to the operating system, and a debugger.
The GNU toolchain is a blanket term for acollection of programming tools produced by the GNU Project. These tools form atoolchain (suite of tools used in a serial manner) used for developing applicationsand operating systems.
Projects included in the GNU toolchain are:
* GNU make: Automation tool for compilationand build;
* GNU Compiler Collection (GCC): Suite ofcompilers for several programming languages;
* GNU Binutils: Suite of tools includinglinker, assembler and other tools;
* GNU Bison: Parser generator
* GNU m4: m4 macro processor
* GNU Debugger (GDB): Code debugging tool;
* GNU build system (autotools):