长平狐 发布于 2013/06/03 14:56
阅读 202
收藏 0


Development Studio 5 includes a distribution of the GNU Compiler Collection (GCC) and related GNU utilities. This distribution is referred to in this document as the 'GNU Compilation Tools'.

The GNU Compilation Tools can be used to build applications and libraries suitable for ARM Linux targets, including the example ARM Linux distribution which can be found in the DS-5 examples. They are not suitable for building code for 'bare metal' ARM targets, for ARM targets running any other operating system, or for non-ARM targets.

The GNU Compilation Tools are a subset of the 2010.09-50 release of the CodeSourcery G++ Lite distribution for ARM GNU/Linux and are based on GCC version 4.5.1. Sources can be found in the 'sources' directory of your installation medium .


This document makes use of the following terms.

Term Meaning
Host The computer used for building and debugging.
Target The system on which the built software is deployed and run.
Target distribution The Linux distribution running on the target system.
Sysroot A directory on the host system containing a copy of the files that exist in the target distribution and/or extra files required to develop for the target distribution.

Host Development Tools宿主机开发工具

All GNU Compilation Tools are in the bin directory. They can be identified by the prefix arm-none-linux-gnueabi-. The tools can be used from the command line, or in Makefile projects in the Eclipse IDE. For Windows users, the DS-5 Command Prompt has the tools in its path.

Some of the most important tools are:

Tool Description
arm-none-linux-gnueabi-ar GNU Librarian
arm-none-linux-gnueabi-as GNU Assembler
arm-none-linux-gnueabi-gcc GNU C Compiler
arm-none-linux-gnueabi-g++ GNU C++ Compiler
arm-none-linux-gnueabi-ld GNU Linker


The GNU Compilation Tools are not 100% compatible with the ARM compilation tools. The GNU tools do not accept the default command-line options of the ARM tools, but the ARM tools can accept GNU command-line options. ARM therefore recommends that for building Linux applications, GCC command-line option are used. You should also be aware that the GNU and ARM assemblers consume different syntax. However, both toolchains are EABI-compliant, meaning that objects and libraries created with either toolchain can be used with the other toolchain.

Target Development Tools目标板开发工具

A gdbserver utility is included as part of the GNU Compilation Tools. Builds of this gdbserver utility can be found under the arm directory of your Development Studio 5 installation. You should use the build most suitable for your target system but, if in doubt, the armv5t build is likely to work on the broadest range of target systems. Note that you must have compatible shared libraries installed to use the gdbserver utility on your target system. This gdbserver utility is taken from the 2010-q1-202 release of CodeSourcery G++ Lite and corresponds to GDB 7.0.50.



Applications and shared libraries for target distributions must be built with respect to resources available on the target distribution. In particular, libraries and corresponding headers from the target distribution must be available on the host. The necessary libraries and headers are here referred to as a sysroot. A sysroot may or may not also include binaries, configuration files, or any other part of the target distribution.

Sysroot Selection

You should build your code with respect to the headers and libraries for your target distribution. However, the GNU Compilation Tools contain three sysroots in the following directories:

sw/gcc/arm-none-linux-gnueabi/libc Default armv5t sysroot.
sw/gcc/arm-none-linux-gnueabi/libc/thumb2 thumb2 sysroot. Used if options -mthumb --march=armv7a are given to the compiler.
sw/gcc/arm-none-linux-gnueabi/libc/armv4t armv4t sysroot. Used if option -march=armv4t is given to the compiler.

To use your own sysroot, specify its location on your host using --sysroot. The default armv5t sysroot included with the GNU Compilation Tools is sufficient for building applications and libraries for the example Linux distribution included in the DS-5 examples, but its libraries are not guaranteed to be debug-compatible with the example distribution.


Ordinarily, you are able to install sysroot filesystems onto real targets. However, if you are using a Windows host then the provided sysroots will not be suitable for use on a real target, due to differences between Windows and Linux filesystems.


Locale data files have been removed from the provided sysroots, to save disk space. You may need to add locale files to be able to use the provided sysroots as a basis for a target filesystem. This should have no impact on using the sysroots for building applications.

Floating Point Support in the Provided Sysroots

The provided libraries all use software emulation to provide floating point support. This means that:

  1. All floating point operations performed by libraries will use software emulation, even when the target has hardware support for floating point
  2. Any code you build that uses these libraries must be built with -mfloat-abi=softfp in order to be interface-compatible with the libraries

If you are building with respect to a different set of libraries then you should set the -mfloat-abi option to be compatible with your libraries.

Dynamic Linkage

The supplied compiler accesses thread-local storage using TLS descriptors. This requires support from the dynamic loader. If your target filesystem's dynamic loader does not support TLS descriptors then you must compile code with the option -mtls-dialect=arm.