Linux Toolchain

From Texas Instruments Wiki
Revision as of 17:07, 8 November 2011 by Russellm (Talk | contribs)

Jump to: navigation, search

Development host

For developing Linux-based software for DaVinci (target) you will probably need a PC (host) where you write and compile programs for the target. The cross-compiled software then is loaded from the development host to the DaVinci target board and executed there. For developing Linux software for DaVinci, it is recommended to use Linux as OS on development host PC as well. While it should be possible to use Windows with Cygwin for DaVinci development as well, there may be shortcomings using this configuration. See post on DaVinci mailing list for some more details.

For ARM-side work, another option is native development. It's easy to have a root filesystem on your DaVinci board which includes a development toolchain; for example, just install Debian Linux. The downside of native development is that it's much slower to built native on an ARM (armv5 CPU at a few hundred MHz, a few hundred MBytes RAM, slow mass storage) than cross-compiling from a modern PC (64-bit CPU at several GHz, several GB RAM, fast disks and networking). Also, when your project involves a DaVinci DSP, native tools are not currently an option.

The next sections assume your development host PC runs Linux as OS.

Linux Kernel

There are a few versions of the Linux kernel to choose from.

  • The DaVinci GIT kernel is the focus of community development, and staging area for DaVinci support to be pushed up to mainline. It is regularly kept up-to-date with the mainline kernel, and welcomes contributions including patches from all; coordinated on its mailing list.
  • TI Arago project PSP releases: TI developers maintain their own "arago" tree based on the above community tree, but also including work-in-progress drivers which may not be available yet in the community tree. They also make official PSP releases including U-Boot and so on. The arago tree does not accept patches from developers outside TI.
  • MontaVista Linux Professional Edition 4.0 for DaVinci is available with support contracts, but based on a relatively old kernel (2.6.10)
  • Last but not least there is the Mainline kernel which has much support merged from the community DaVinci GIT tree, but naturally lags behind it in terms of DaVinci support.

See also an older mail from Kevin Hilman (current community kernel maintainer) on DaVinci open source mailing list for the differences between these kernels.

Get recent open source DaVinci Linux kernel

You can get most recent open source DaVinci Linux kernel by using git or using by git snapshot feature.


Clone recent open source Davinci Linux kernel git

Use

git-clone  git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git

to get the most recent DaVinci Linux kernel git repository to your local disk (Attention: Downloads ~210MB!). You can then update that with "git pull" to get recent updates

Clone recent open source Davinci Linux kernel git over http

You can use

git-clone   http://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci.git
            

if you have firewall problems.


Get recent open source Davinci Linux kernel by git snapshot

If you don't like to use git (installation issues), DaVinci Linux git gives you the ability to directly download recent git snapshots without using git. For this, go to DaVinci Linux git starting page and there select snapshot at the right side:


Davinci kernel git snapshot.jpg


The result will be a quite big .tar.gz image on your local disk you can extract with

tar xvfz linux-davinci-2.6.git-7c2d65c9a06f7faa11e5b1659c6800bf0a030cce.tar.gz

Note: replace this longish number with the version you got.

Build kernel

Once you have a compiler set up, you can configure and build the git kernel with the following commands. These assume you are using the CodeSourcery gcc compiler, for others you may need to change the value of CROSS_COMPILE:

host > make distclean
host > make ARCH=arm davinci_all_defconfig
host > make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage
host > make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules

make uImage may fail with a misleading success message:

"mkimage" command not found - U-Boot images will not be built
Image arch/arm/boot/uImage is ready

mkimage is a tool built as part of U-Boot and needs to be in your PATH. build U-Boot first (see later section of this wiki page).

Bootloader

Most DaVinci and OMAP boards use Das U-Boot -- the Universal Boot Loader as bootloader. As with Linux kernel, there are several versions available.

  • For the official versions for TI development boards, see the code included with your board, or this TI DaVinci FAQ. For newer chips, these may be your only option.
  • The mainline U-Boot sources are available with git (or U-Boot git snapshot). FTP releases are availble too. This includes support for various DaVinci and OMAP boards, and generally supports features and boot modes that TI's older code does not.
  • The OMAPZOOM site has tarballs of with more PM-aware support for some OMAP3 boards (including SDP).
  • As with any open source software, other versions may be found if you look for them.

Current U-Boot releases (e.g. 2009.06) contains support for various OMAP1 and OMAP2 boards, as well as several DaVinci and OMAP3 based boards:

  • DaVinci
    • DM355 EVM
    • DM6446 EVM
    • Schmoogie
    • Sonata
    • SFFSDR
  • OMAP3
    • Beagle
    • EVM
    • Overo
    • Pandora
    • Zoom1
    • Zoom2

NAND support in mainline U-Boot is currently limited to single bit ECC for both DaVinci and OMAP3, though the DM355 and OMAP3 support stronger ECC codes.


Clone recent open source U-Boot by git

Use

git-clone git://www.denx.de/git/u-boot.git u-boot

to get the most recent U-Boot git repository to your local disk. This is what you'll probably want if you're developing support for a new board, or just want a more capable version to install on your existing development board.

Get recent open source U-Boot by git snapshot

If you don't like to use git (firewall issues, installation issues), U-Boot git gives you the ability to directly download recent git snapshots without using git. For this, go to U-Boot git starting page and there select snapshot at the right side:


Uboot git snapshot.jpg


The result will be a ~10MB .tar.gz image on your local disk you can extract with

tar xvfz u-boot.git-308e2b3a6c3fd84fceada79b3d4a559280d326a6.tar.gz

Note: replace this longish number with the version you got.

Build U-Boot

If you downloaded recent U-Boot git you can build U-Boot for DaVinci EVM by

host > make distclean
host > make davinci_dvevm_config
host > make

Support for the other both boards is configured by replacing davinci_dvevm_config above by

host > make davinci_schmoogie_config

or

 host > make davinci_sonata_config

Git

If you read above sections carefully, you will have noticed that there git is mentioned several times. But, what is git?

From git home page:

Git is popular version control system designed to handle very large projects with speed and efficiency; it is used mainly for various open source projects, most notably the Linux kernel

Since Linus created it to do Linux kernel version control with it, lot of open source projects use it. So besides kernel, as mentioned above, U-Boot use it as well. If you want to participate and use latest developments of e.g. U-boot and Linux Kernel, you have to use git to directly access the most recent sources.

Some helpful intros:

Compiler

To be able to compile bootloader, Linux kernel and user space programs, you need toolchain. For Linux this is normally based on Binutils (assembler, linker , object tools etc.), GCC (C- & C++ compiler) and GLibc (C-Library). The compiler has to be a cross compiler, i.e. you compile programs for DaVinci ARM and DSP (target) on a x86 PC (host).

ARM

Linux kernel and bootloader will run on ARM processor of DaVinci. Assuming you do the development for DaVinci on a Linux host (PC) as well, there are several ways to get a GCC toolchain (Binutils & GCC & GLIBC)

  • MontaVista toolchain, part of Linux Professional Edition 4.0 for DaVinci
  • CodeSourcery - Optimized free Linux GCC toolchain for ARM; paid/supported versions are also available. (The same folk who currently shepherd the GCC release cycle.)
  • ELDK - the Embedded Linux Development Kit from DENX Software Engineering (the people behind U-Boot). See ELDK for DaVinci quick start guide as well.
  • Crosstool - Build your own cross compiler from ARM from scratch
  • crosstool-NG - a great tool for building toolchains; works great for DM6446 (U-boot, kernel and userland).
  • RidgeRun offers free SDK for Davinci-family DM355 (also tested on DM6446) that has been used with Linux kernel 2.6.22. It includes a GCC 4.1 ARM EABI NPTL toolchain and source code. It uses uClibc, so if you require strict glibc compatibility it may not suit your needs. RidgeRun can offer support contracts for the toolchain if you find any trouble. To get this toolchain go to RidgeRun download center and check the files in the .iso image (you will find the tarballs for the toolchain in it). NOTE: Download needs registration!
  • ...

DSP

DaVinci uses TI C64x+ DSP. To create code for this, you have to use (buy/test the 120 days trial) CCS. Unfortunately, there are no free Linux DSP tools available like for OMAP1 & OMAP2 C55x DSPs. There is the tutorial How to build an ARM/DSP Hello World program on the DaVinci EVM that is using Dsp/Link.

News: The linux C6000 evaluation toolchain is now available for registered users on my.ti.com [1] !

Root File System solutions

While above sections describe steps to get DaVinci ARM side boot loader and Linux OS going, the other big task is getting a root file system. The basic choices here are building your own, customizing one of numerious distributions, or taking a pre-built one. Depending on the kind of systems development you're doing, any one of these may be appropriate for you.

If you customize an embedded Linux distribution, you have an especially large number of tool choices. These range from bare bones, with little except a statically linked busybox and some application-specific code, to minimalist buildroot systems, up to platform builders which will create a boot loader, kernel, and filesystem image all at once. There are dozens of such systems.

Pre-built solutions of note include binary distributions such as Debian and Ubuntu, plus the MontaVista root filesystem provided with the SDK.

Debian ARMEL

You can install the Debian Linux distribution on an easily-available 2GB SD card using QEMU to host the install process. These BeagleBoard instructions work. Until the DaVinci versions of U-Boot support MMC access, you won't want a separate partition for U-Boot to use: your root filesystem can be /dev/mmcblk0p1 and you will have well over a GigaByte of storage available for adding new packages, storing temporary files, building applications, and so on.

That is, for now you should plan to boot U-Boot from flash (NOR or NAND) and load your kernel either from flash or from the network. Then configure your kernel command line to use mmcblk0p1 for its root filesystem: "root=/dev/mmcblk0p1 rootwait" if you're tracking mainline Linux. Use "apt-get" regularly to install updated packages.

Ubuntu ARM

Ubuntu ARM is young but interesting. You would set it up much like Debian ARMEL. Unlike Debian's support for minimum ARMv4t (like an ARM920), Ubuntu currently targets ARMv5t (like an ARM926) and has discussed Cortex-A8 builds. Ubuntu will support VFP libraries where they make a difference.

MontaVista Root FS from DVSDK

The DVSDK includes a root file system from MontaVista. This filesystem has older versions of many tools, but it's probably a good starting point because it came with your development board and includes a relatively large number of packages.

OpenEmbedded

OpenEmbedded builds u-boot, a kernel, and filesystem images for the DaVinci EVM. Use

MACHINE = "davinci-dvevm"
DISTRO = "angstrom-2007.1"

in your local.conf file. These images need testing and refinement. They build the kernel and u-boot from the current git HEAD's. When stable versions are available this will change.

Poky Linux is a refinement of OpenEmbedded, and may also be interesting to you.

Arago is an OpenEmbedded project with DaVinci and OMAP3 support.

General DaVinci tooling

See DaVinci development tools for a short more general discussion about DaVinci development tooling.

Other Resources (SEO)

Microcontroller, MCU, Embedded Controller, 8 bit microcontroller alternatives, 16 bit microcontroller MSP430, Arm Microcontroller, Arm Processor, 32 bit microcontroller, DC motor controller, Capacitive Touch Microcontroller, Capacitive Touch MCU, Microcontroller Code, Microcontroller Projects, smart grid, 6LoWPAN, Safety Microcontroller, Automotive Microcontroller