Crosstool-NG

From Linux/Xtensa
Revision as of 22:15, 2 March 2013 by Chris (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Overview

crosstool-NG provides a system to build a complete toolchain. It supports the c-libraries uClibc, glibc, and eglibc, but can also be used to build a 'bare' toolchain. The following describes the steps to build a toolchain tailored for an Xtensa configuration. In this example, we are building a 'bare' toolchain for the DC_D_233L processor configuration. 'Bare' in this sense means a toolchain without a c-library.

Building a 'bare' toolchain

The mainline repository for crosstool-NG does not yet include support for Xtensa, so you need to clone the repository from linux-xtensa.org:

git clone git://linux-xtensa.org/git/crosstool-NG

Build ct-ng

ct-ng is similar to the command 'make' for other projects, and is used to configure and build the toolchain. Because this is not a released package but cloned from a repository, it is not yet preconfigured with 'autoconf'. So, the first step is to run autoconf:

autoconf

The next step is to configure ct-ng for your system. crosstool-NG needs to install additional components. The default path is /usr/local/ but can be overwritten with the --prefix option. In this example, we install all additional files under $PWD in the current directory. Note that the prefix option requires an absolute path, so we use $PWD here:

./configure --prefix=$PWD/usr

Finally, run 'make install' to build ct-ng and install the additional files:

make install

Build the toolchain

The first step is to configure crosstool-NG. Simply run

./ct-ng menuconfig

Make sure to make the following changes (---> means to enter the sub-menu)

Paths and misc options  --->                                 
[*] Try features marked as EXPERIMENTAL

Target options  --->                                         
Target Architecture (xtensa) 
Target Architecture Variant (Custom Xtensa processor configur...
(DC_D_233L) Custom Xtensa process configuration name

C-library  --->                                              
C library (none)  

Build and install the toolchain

Finally, build and install the toolchain. The default install directory is $HOME/x-tools, unless changed during the configuration step above.

./ct-ng build

Test it

export PATH=$PATH:$HOME/x-tools/xtensa-unknown-linux-gnu/bin
xtensa-unknown-linux-gnu-gcc t.c