Crosstool-NG: Difference between revisions

From Linux/Xtensa
Jump to navigation Jump to search
No edit summary
No edit summary
Line 55: Line 55:
  export PATH=$PATH:$HOME/x-tools/xtensa-unknown-linux-gnu/bin
  export PATH=$PATH:$HOME/x-tools/xtensa-unknown-linux-gnu/bin
  xtensa-unknown-linux-gnu-gcc t.c
  xtensa-unknown-linux-gnu-gcc t.c
== Building a 'glibc' based toolchain ''(experimental)'' ==
The glibc port is experimental at the moment and also not part of the main repository yet. A version for Xtensa is on linux-xtensa.org, so you need to clone the glibc and crosstool-NG repositories:
git clone git://linux-xtensa.org/git/crosstool-NG
git clone git://linux-xtensa.org/git/glibc
[more instructions to follow...]

Revision as of 23:54, 9 March 2013

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). We are assuming that the overlay file (src/xtensa-config-overlay.tar.gz) has been copied to /HOME/Overlay/CPUNAME.tar.gz.

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

Target options  --->                                         
Target Architecture (xtensa) 
Target Architecture Variant (Custom Xtensa processor configuration)
(CPUNAME) Custom Xtensa process configuration name
(/HOME/Overlay/) Full path to custom Xtensa processor configurations 

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

Building a 'glibc' based toolchain (experimental)

The glibc port is experimental at the moment and also not part of the main repository yet. A version for Xtensa is on linux-xtensa.org, so you need to clone the glibc and crosstool-NG repositories:

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

[more instructions to follow...]