world leader in high performance signal processing
Trace: » installing

Installing the Blackfin Toolchain in Linux

What to install

There are two toolchains, depending on what you are developing:

Toolchains for Bare Metal

  • bfin-elf-xxx which uses the newlib and libgloss libraries.

Toolchains for Linux on the Blackfin

The Blackfin toolchain is split up into a few different packages. You must select the proper components for a properly working toolchain. Older versions may not have included as many choices.

A typical install requires only two files.

  1. a toolchain (gcc) version
  2. a uClibc version - uClibc is a configurable C library. It allows you to enable or disable certain functions and groups of functions. It also allows you to enable or disable particular features of functions, such as whether members of the printf family support the GNU custom format extension. Finally, it allows you to change some numeric parameters, such as the size of a FILE buffer. We provide prebuilt static and shared versions of uClibc for a “full” (all uClinux-compatible features enabled, and with the default values of numeric parameters.), and a “normal” (less commonly used options turned off). These versions are intended to be standard configurations. We recommend that you use the prebuilt versions of uClibc, because we have tested them as part of the release process, and because they are known to work well with the standard C++ library. However, to reduce the library's footprint, you may wish to build a customized version of uClibc instead. If you decide to do this, you must build the entire toolchain from source.

Exactly which two files is an excerise left for the reader, as it depends on:

  • your Operating system (linux, Windows, Mac OS X)
    • your distribution (tar, rpm or deb).
  • your host (x86, PPC, ia64, etc)

It is required to install the toolchain, and the uClibc library which are provided as separate packages.

GCC/binutils/gdb package:

Filename prefix Optional or
blackfin-toolchain-2012R2-RC2 required GCC-4.3 of bfin-uclinux-xxx and bfin-linux-uclibc-xxx
blackfin-toolchain-2012R2-RC2_45 required GCC-4.5 of bfin-uclinux-xxx and bfin-linux-uclibc-xxx
blackfin-toolchain-elf-gcc-4.3-2012R2-RC2 optional GCC-4.3 of bfin-elf-xxx
blackfin-toolchain-elf-gcc-4.5-2012R2-RC2_45 optional GCC-4.5 of bfin-elf-xxx

uClibc packages

Although which exact package you install depends on the functionality you require (default or extended functionality), you must only install just one per version (default or full, but not both) of GCC that installed.

GCC version Package name prefix Description
GCC-4.3 blackfin-toolchain-uclibc-default-2012R2-RC2 default set of configuration options
GCC-4.3 blackfin-toolchain-uclibc-full-2012R2-RC2 extended set of configuration options (wchar/etc…)
GCC-4.5 blackfin-toolchain-uclibc-default-2012R2-RC2_45 default set of configuration options
GCC-4.5 blackfin-toolchain-uclibc-full-2012R2-RC2_45 extended set of configuration options (wchar/etc…)

JTAG Tools

jtag tools (for developing with an In Circuit Emulator).

Where to get things

The Blackfin toolchain can be obtained from the Blackfin Linux website in the toolchain file release page. You just need to determine your architecture (what host you have), and what files you need.

Before installing the latest toolchain (you can find the latest release by the release date), be sure to read the toolchain release notes.

Depending on the version of the toolchain there may be a variety of file types available. These file types are summarized below:

  • .tar.bz2 files - These files are compressed archives of files. They must be decompressed with bunzip2 and unarchived with tar. (Check your man page for tar xjf filename.tar.bz2)
  • .tar.gz files - The same as *.tar.bz2 files except that they must be decompressed with gzip. (Check your man page for tar xzf filename.tar.gz)
  • .rpm files - These are Red Hat Package Management files for RPM based distributions. The package manager can natively handle this format to automatically install the files in the correct place, check for any dependencies, and update the package information in the RPM database.

Files that include .src. are the source packages that include all of the source code used to build the binary packages. Files that include .i386. or .x86_64. or similar architecture names are prebuilt binary packages for that specific architecture.

You may need some additional packages in order for everything to run smoothly. Please see the section about configuring Linux for more information.

There may also be a number of addons available (for other toolchain tuples like ''bfin-elf'' or for other gcc versions). You normally do not need to install these; they are merely provided in case you have some code which needs an older version of gcc to build. The bfin-elf toolchain is only needed if you wish to compile code that will be running on bare-metal -- that is, no operating system at all like Linux.

The default install path for all of our toolchains is /opt/uClinux/. This is not a requirement, just the default, so you can unpack the install files elsewhere if you like. Note however that the RPMs do not have the ability to change install paths, so those must be installed into /opt/uClinux/ first before being moved.

A quick example

A quick example for installing toolchain with the tar ball,take the 2012R2-RC2 of toolchain for example, usually we copy the following three files in the same folder and untar them one by one, the generated /opt/uClinux is what we want:

i) tar jxvf blackfin-toolchain-2012R2-RC2.i386.tar.bz2

ii) tar jxvf blackfin-toolchain-elf-gcc-4.3-2012R2-RC2.i386.tar.bz2

iii) tar jxvf blackfin-toolchain-uclibc-default-2012R2-RC2.i386.tar.bz2

Then set the path as described later in this page

Installing Packages

There may be more detailed installation instructions in the Toolchain Release Notes.

When installing rpms, /opt must be writable. Normally if /opt is on a local machine, just become root, if /opt is network mounted, you will need to call your local IT support person. If this is not possible - you should install from the tarball.

Although it may be necessary to install the toolchaing as the root user, Do NOT install the U-Boot source or the uClinux-dist source as root, but as a normal user

Under some distributions, double clicking an RPM file may bring up a graphical front‑end for installing RPM's. Under SuSE Linux 9.0 this front-end is provided through YaST2.

Installing an RPM by hand

For an RPM file, as root enter the following command:

# rpm -Uvh <filename>
(e.g. rpm -Uvh blackfin-toolchain-2012R1-RC2.i386.rpm)

Installing RPMs on a non-RPM distro (Debian/CoLinux)

Do not do it. Use the provided pre-compiled tarballs (tar.gz or .tar.bz2). On the off chance that one does not exist …

Many distributions do not utilize RPM's so it may be a pain to try and install one. To get around this, we also provide binary tarballs which are equivalent to the binary RPM's.

These are created using the package rpm2targz. If your distribution does not include it, you can find it here.

Converting it is pretty easy:

$ rpm2targz <rpm>
(e.g. rpm2targz blackfin-toolchain-2012R1-RC2.i386.rpm)

This should leave you with a tarball in the same directory named the same as the rpm, but with a '.tar.gz' instead of '.rpm' extension. Then just unpack the tarball and move the files wherever you like.

Installing From Source

There are a few reasons not to use the prebuilt binary toolchain:

  • There are bugs in the released toolchain that directly affect you
  • You wish to change the default uClibc settings
  • No binary exists for your architecture

Normally these should not happen -- we attempt to ensure that there are no bugs, attempt to ensure the widest settings of uClibc (we normally provide two versions of uClibc), and build binaries for many architectures/OSes. If possible -- use the prebuilt binary toolchain. However, if the releases do not satisfy your needs, then you have no choice - either:

  • try the latest source from SVN (branch first, trunk second)
  • build the toolchain from a release source

Detailed instructions on how to download and build the latest SVN toolchain can be found in the Toolchain Build Script section of the documentation. Or you can view the page on how to build the src rpm.

Setting The PATH Environment Variable

After installing the Blackfin toolchain the environment variable PATH must be modified to include the directory where the Blackfin toolchain is installed. This can be done by entering the following command before using the Blackfin toolchain (assuming the Blackfin toolchain binaries are installed in the default location - /opt/uClinux/bfin-uclinux/bin and /opt/uClinux/bfin-linux-uclibc/bin. If you installed these somewhere else, you will need to modify these examples).

$ export PATH=$PATH:/opt/uClinux/bfin-uclinux/bin:/opt/uClinux/bfin-linux-uclibc/bin

Alternately, to have PATH set automatically edit the file ~/.bashrc to include the following lines:

export PATH=$PATH:/opt/uClinux/bfin-uclinux/bin:/opt/uClinux/bfin-linux-uclibc/bin

When your system is localized, you may or may not prefer to have all build output in native english or your localized language, where english supports forum information exchange. Setting english (whether in all shells or a single one, see above):

export LANG=C

Now when a new bash shell is started, PATH will automatically be set to include the path to the Blackfin toolchain.

The Blackfin toolchain should now be installed allowing you to compile programs such as U‑Boot or the uClinux distribution. The default compiler is available under the name bfin-uclinux-gcc (or bfin-uclinux-g++ for the C++ compiler). If you wish to execute a specific version, simply append it like bfin-uclinux-gcc-4.5.3.

Once you have edited your path, you should check it with:

$ which -a bfin-linux-uclibc-gcc

Above, there are two toolchains in the path (which is normally bad), to determine which one will be used:

$ which bfin-linux-uclibc-gcc

If this is not the toolchain you want to use, you can edit your PATH variable.

$ echo $PATH

$ export PATH=:/home/rgetz/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:\

To remove a toolchain you don't want - depends on how you installed it.

  • package manager - see your distribution source for the exact instructions:
    • rpm based package managers - look for rpm erase.
    • apt based package managers - look for apt-get remove or apt-get purge
  • tar-ball - if you installed something from source, or by from a binary tar ball, just rm the directory in question.

Installing the Blackfin Toolchain in Windows

The Blackfin toolchain can be obtained from the Blackfin Linux website in the toolchain file release page.

Before installing the latest toolchain (you can find the latest release by the release date), be sure to read the toolchain release notes.

There is only one Windows toolchain package (installer) available:

  • blackfin-toolchain-win32-(version).exe

Files that include .src. are the source packages that include all of the source code used to build the binary packages. The Windows GNU/Blackfin toolchain includes a complete toolchain for building bare metal applications (bfin-elf-) and a complete toolchain for building Linux fdpic applications. If you are not sure what the difference is, have a look at the supported targets page.

The Windows installer will add the directory that you installed things into to your default PATH, so you can call the toolchain from any directory. All that is installed is command line callable toolchain - it does not include an IDE (integrated development environment, or graphical editor). It is up to you to either install one (have a peek at eclipse), or use your existing favorite if it allows third party compilers to be called.