world leader in high performance signal processing
Trace: » buildscript

Toolchain Build Script

There is a build script for the toolchain that builds and installs the toolchain from source. This is updated as the toolchain changes, so it usually works. This can be used in combination with the cvs scripts provided to ensure that you have the most up-to-date toolchain. The locations for the build directory and the source directory must be included when you run the script. Running the script will build multiple toolchains which are documented in the Blackfin toolchain targets page.

To build from source, you need the source of the kernel and toolchain. The kernel source is required because we need the userspace kernel headers. It is important that the dates of the kernel and toolchain source be close to each other. For normal development, this means you should use a release toolchain source, with a release toolchain kernel. All released code can be found in the relevant project release pages on the Blackfin website (such as the Toolchain releases, Kernel releases, and U-Boot releases).

If you need to build a svn toolchain, it is recommended to use a svn kernel source. Although, at first glance, it seems like the toolchain, bootloader, libraries, and kernel should be separate - that is not true. A bug in the toolchain and cover up problems in the kernel, and bootloader, as toolchains are fixed, bootloaders, and kernels must also be modified. Debugger lives in both the toolchain cvs (for the host part), and the kernel cvs (for the target gdbserver). Adding new features like shared libraries require changes in both the toolchain and kernel cvs. Because of these, and other issues, building a svn toolchain, and using a non-svn kernel uClibc is not supported/tested/validated. To get the svn source, have a look in the developing with live sources section.

Building takes awhile as it will be compiling binutils/gcc/uClibc multiple times over (once per target).

Invocation

For example to run the script a command similar to this must be issued:

./BuildToolChain -s /home/user/checkouts/gcc/ \
  -k /home/user/checkouts/kernel/uClinux-dist/linux-2.6.x \
  -u /home/user/checkouts/uboot/u-boot_1.1.3  \
  -b /home/user/gcc-build/ -o /home/user/cvsoutput 

Options can be in any order, but must include:

  • -s is the toolchain source directory

There are also some optional, but recommended flags:

  • -k is the kernel source directory,
  • -b is the directory where the toolchain is built (default is current directory)
  • -o is the output directory
  • -u builds mkimage(to create compressed images) and gen_eth_addr (to generate private MAC addresses). Without this option, the default kernel will be built without a compressed image (something that most people want).

There are also some optional flags:

  • -c GCC_VERSION gcc version to build (either 3.4 or 4.1). Can be given multiple times
  • -p Check prerequisites
  • -d Date Stamp all output files
  • -h prints out help
  • -t tests the bfin-elf toolchain on the simulator
  • -T IP_NUM tests the bfin-uclinux toolchain on the hardware. Note - IP_NUM must be a Blackfin platform, which is running rcp, and rsh.
  • -m MAKE Default make (leave blank to use system make)
  • -C FILE Use FILE as uClibc config file, rather than the default. This is necessary to change default settings of uClibc.

To get up to date options, do ./BuildToolChain -h.

The actual compiler executables will be located in the directories with their respective designation. eg. Using the above command the executables would be located in the cvsoutput-elf and cvsoutput-uclinux directories.

The output of the buildscript will look something like (this will also tell you how long it can take ~40min on a fast machine).

*** Cleaning Elf Toolchain        Wed Aug 17 18:18:43 EDT 2005
*** Configuring Elf Toolchain      Wed Aug 17 18:18:43 EDT 2005
*** Building Elf Toolchain        Wed Aug 17 18:18:49 EDT 2005
*** Installing Elf Toolchain      Wed Aug 17 18:37:18 EDT 2005
*** Building Elf elf2flt          Wed Aug 17 18:37:46 EDT 2005
*** Cleaning Elf elf2flt          Wed Aug 17 18:37:46 EDT 2005
*** Make Elf elf2flt              Wed Aug 17 18:37:49 EDT 2005
*** Installing Elf elf2flt        Wed Aug 17 18:37:53 EDT 2005
*** Building Elf genext2fs        Wed Aug 17 18:37:53 EDT 2005
*** Cleaning Elf genext2fs        Wed Aug 17 18:37:53 EDT 2005
*** Make Elf genetx2fs            Wed Aug 17 18:37:57 EDT 2005
*** Installing Elf genext2fs      Wed Aug 17 18:37:59 EDT 2005
*** Configuring uClibc            Wed Aug 17 18:38:00 EDT 2005
*** Cleaning uClibc                Wed Aug 17 18:38:04 EDT 2005
*** Building uClibc                Wed Aug 17 18:38:14 EDT 2005
*** Installing uClibc              Wed Aug 17 18:40:03 EDT 2005
*** Cleaning uClinux toolchain    Wed Aug 17 18:40:07 EDT 2005
*** Configuring uClinux toolchain  Wed Aug 17 18:40:07 EDT 2005
*** Building uClinux toolchain    Wed Aug 17 18:40:14 EDT 2005
*** Installing uClinux toolchain  Wed Aug 17 18:57:28 EDT 2005
*** Building uClinux elf2flt      Wed Aug 17 18:57:50 EDT 2005
*** Cleaning uClinux elf2flt      Wed Aug 17 18:57:50 EDT 2005
*** Building uClinux elf2flt      Wed Aug 17 18:57:53 EDT 2005
*** Installing uClinux elf2flt    Wed Aug 17 18:57:57 EDT 2005
*** Building uClinux genext2fs    Wed Aug 17 18:57:57 EDT 2005
*** Cleaning uClinux genext2fs    Wed Aug 17 18:57:57 EDT 2005
*** Make uClinux genetx2fs        Wed Aug 17 18:58:01 EDT 2005
*** Installing uClinux genext2fs  Wed Aug 17 18:58:03 EDT 2005
*** Testing 'bfin-elf-gcc -v'
Reading specs from /home/rgetz/gcc-elf/lib/gcc/bfin-elf/3.4.4/specs
Configured with: /home/rgetz/checkouts/gcc/binutils/binutils-2.15/configure --target=bfin-elf --prefix=/home/rgetz/gcc-elf --disable-libstdcxx-pch
Thread model: single
gcc version 3.4.4
*** Testing 'bfin-uclinux-gcc -v'
Reading specs from /home/rgetz/gcc-uclinux/lib/gcc/bfin-uclinux/3.4.4/specs
Configured with: /home/rgetz/checkouts/gcc/binutils/binutils-2.15/configure --enable-threads=posix --target=bfin-uclinux --prefix=/home/rgetz/gcc-uclinux --disable-libstdcxx-pch
Thread model: posix
gcc version 3.4.4
*** Done                      Wed Aug 17 18:58:03 EDT 2005

For more information related to developing with the latest source code, please see the blackfin_live_sources page.

Examples

Building a Toolchain with Locale Support

To add internationalization (LOCALE) support to the compiler's library, you would follow these steps:

  1. turn on LOCALE support in uClibc.
    1. Read ./toolchain/uClibc/extra/locale/README
    2. goto ./toolchain/uClibc and:
      1. copy the existing .config-used-for-bfin to .config
      2. type make menuconfig
    3. in the submenu String and Stdio Support, turn on Locale Support and Use Pre-generated Locale Data while leaving Automagically Download the Pre-generated Locale Data unselected
    4. exit the configuration process
  2. Save the ./toolchain/uClibc/.config to a different file.
    rgetz@test:~/checkouts/toolchain/uClibc> cp .config config_locale_on
  3. Build the toolchain, with the alternative uClibc .config file.
    ./BuildToolChain -s /home/user/checkouts/gcc/ \
      -k /home/user/checkouts/kernel/uClinux-dist/linux-2.6.x \
      -u /home/user/checkouts/uboot/u-boot_1.1.3  \
      -b /home/user/gcc-build/ -o /home/user/cvsoutput \
      -l c -C /home/user/checkouts/toolchain/uClibc/config_locale_on
  4. You should see a message during the build if everything is working properly:
    *** Building Locale

The BuildToolChain will see that Locale support is turned on, and do the necessary steps in uClibc, as required in the extra/locale/README. Search in the Buildscript for UCLIBC_HAS_LOCALE for more information. The -l c tells the compiler to only build the C language (not C++), since there are some remaining issues in C++/Locale support with uClibc.