Difference between revisions of "Crosstool-NG"

From Linux/Xtensa
Jump to: navigation, search
(New page: == 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 f...)
 
Line 29: Line 29:
 
  ./ct-ng menuconfig
 
  ./ct-ng menuconfig
  
Make sure to make the following changes (---> means to enter the sub-menu)
+
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  --->                                 
 
  Paths and misc options  --->                                 
Line 36: Line 36:
 
  Target options  --->                                         
 
  Target options  --->                                         
 
  Target Architecture (xtensa)  
 
  Target Architecture (xtensa)  
  Target Architecture Variant (Custom Xtensa processor configur...
+
  Target Architecture Variant (Custom Xtensa processor configuration)
  (DC_D_233L) Custom Xtensa process configuration name
+
  (CPUNAME) Custom Xtensa process configuration name
 +
(/HOME/Overlay/) Full path to custom Xtensa processor configurations
 
   
 
   
 
  C-library  --->                                               
 
  C-library  --->                                               

Revision as of 22:21, 2 March 2013

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). 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