Embedded Linux Encounters

A peek in to the world of Embedded Linux and stuff

  • Linux is addictive, I'm hooked!

         Geek@WastingTime>

Working with Toolchains

Posted by Vaisakh P S On 6:09 AM 0 comments

In porting any GNU based software, the first and fore most aspect that needs to be looked into is availability of Tool chain for that platform. I started trying out various pre-built toolchain that was available in Internet and which was provided in Marvell Site. They had various disadvantages

Toolchain provided by Marvell

· This toolchain supported EABI what was required by Android but lacked --sysroot option which an utmost necessity for root file system generation utilities like buildroot and other utilities.

· For the initial few weeks of development, this toolchain was used for porting Kernel and Boot loader, until another toolchain was prepared

Code Sorcery GNU Toolchain

· The binaries generated from this toolchain seemed to have different behavior compared to the one generated by the Marvell toolchain. So further experimentation

So considering these points, I decided to create a custom compiler tool chain. This was made possible by using build scripts like CrossTools and CrossTools-NG. Using CrossTools-NG, we can generate Cross Compiler toolchain which includes the following utilities

  • GCC
  • G++
  • BinUtils
  • C Library (with choices of flavor between ucLibc or Glibc)
  • GDB Host and Target binaries (optional, and is not included in current toolchain).

The toolchain and the output target binaries has proven to be stable till now. Here are the main options by which the current toolchain has been built:

CT_ARCH_SUPPORTS_BOTH_ENDIAN

CT_ARCH_ARCH="iwmmxt" - which is the Xscale core.

CT_ARCH_FLOAT_SW

CT_ARCH_arm

CT_ARCH_USE_MMU

CT_ARCH_ARM_EABI - Android requires EABI support and this will enhance floating point performance of binaries.

CT_KERNEL_V_2_6_27_35 – Close to the kernel version used for porting

CT_BINUTILS_V_2_19_1

CT_CC_V_4_3_4

CT_CC_SUPPORT_CXX

CT_LIBC="glibc" – Other option was ucLibc, but in this case I chose glibc

CT_LIBC_V_2_9

CT_GMP_MPFR

CT_MPFR_V_2_4_1

CT_TOOLS_WRAPPER_SCRIPT

Here are some pitfalls and key points that needs to be taken in to account while choosing or making a toolchain.

  • For compiling Glibc, the version of kernel headers needs to be specified. This is a very important factor and it is preferable to use header of the kernel which you are porting to your hardware. While running an application compiled with a specific Glibc version, it checks for the running kernel, if the kernel version is older than version of headers against which Glibc is compiled too, the it will report a FATAL error saying that “FATAL: kernel too old” and program will terminate.

  • Selection of options such as WCHAR support, Locale, Largefile support etc for C Library is at developer's discretion, but bear in mind that if the library doesn't have these feature enabled, they cannot be enabled in buildroot or kernel which uses these libraries and toolchain.

Categories:

0 Response for the "Working with Toolchains"

Post a Comment