SMP HiFi 2 Development Board

From Linux/Xtensa
Revision as of 08:38, 6 November 2009 by Piet (talk | contribs)
Jump to navigation Jump to search

These instructions explain how to use HiFi-2 Codec Development environment on a LX200 FPGA board.

Some general notes on these instructions:

  • They are a work in progress, it's currently being prepared for a Tensilica customer.
  • The following was tested on x86 machines running RedHat Fedora Core 5.

Introduction

We will be going over the steps needed to set up you LX200 board for codec development. Your board likely comes with U-boot preinstalled on it to boot a linux kernel. You will be downloading a copy of buildroot and a linux kernel that have been pre-configured and build for HiFi-2 development. You will be setting up a NFS server to export a linux root file system and setting up the Linux kernel to boot from your NFS file server. Once your running on your development board we will suggest how to taylor your board for easy development of your codecs.

Downloading The latest HiFI-2 Buildroot and Kernel Snapshots

The HiFi-2 development environment is maintain in a source code version control system named 'git' that is likely a good environemt for you to use when working with this development environemt, thought it can be done without it. We will assume you will be using 'git' but will point out allternatives for those not interested in investing the time to set it up.

Installing git

   The Git source code Version Control System can be easily installed by downloading a recient tar ball to your system from:
        http://www.kernel.org/pub/software/scm/git/
   Then simpley unpack the tar ball, drop into the git src code, and then make and install it.
       $ cp $HOME/Desktop/git-1.6.5.tar.gz .
       $ gunzip git-1.6.5.tar.gz
       $ tar xf git-1.6.5.tar
       $ cd git-1.6.5
       $ make
       $ make install

This will usually git to /usr/local/bin or $HOME/bin.

Installing the Buildroot Snapshot

 The HiFi-2 snapshot is in the process of being made. Their are two major components, a Linux kernel git reposiory, and a buildroot git repository. We will download both preconfigured for easily running HiFi-2 codecs. Both the kernel and buildroot are available via git and compressed tar balls. With git being arguable preferable as it will allow you to easly see any changes you have made from this reference starting point.

The buildtoot environment can be downloaded with git by using the following command:

  $ git clone git://git.linux-xtensa.org/git/buildroot/buildroot-xtensa-HiFi2-Snapshot

once git is finished, do a cd to buildroot-xtensa-HiFi2-Snapshot and checkout the latest stuff; which is currently the snapshot_2+SMP branch. This can be done at the command line with:

   $ cd buildroot-xtensa-HiFi2-Snapshot
   $ git branch --track snapshot_2+SMP origin/snapshot_2+SMP
   $ git checkout snapshot_2+SMP

The git GUI is also convenient for checking out the HiFi-2 snapshot and provides a comfortable way for viewing the state of the git repository. To check out the snapshot_2+SMP branch simply run the command 'git gui' and then pull down the branch->create menu. Next put snapshot_2+SMP into the Name block, select Tracking Branch in the Starting Revision section, and select the origin/snapshot_2+SMP branch. Finally hit the Create button. This will create your tracking branch which can be easy kept in sync with our git repository.

Alternativly you can currently ftp a compress tar ball from our ftp server:

        http://www.linux-xtensa.org/pub/snapshots/buildroot-xtensa-smp.2-Nov-2009.tar.gz

but this isn't as clean and may be discontinued.

Installing the Linux Kernel Snapshot

Setting up a NFS Server to export the Root Filesystem

Your buildroot has a cpio file that we will use to build a root file system to export via NFS to your LX200 board. We will also be adding an additional minor changes to make your development environment more comfortable. The cpio file with your root file system was build and left in:

   buildroot-xtensa-HiFi2-Snapshot/buildroot-xtensa-smp/binaries/HiFi-2/rootfs.xtensa_test_mmuhifi_c3.cpio

Pick a place on your workstation to export you root and unpack the cpio file into that directory. For exmaple here we will set up an export in /exports/LINUX_ROOT.HiFi-2_DemoBoard.buildroot-xtensa-smp:

   $ cd buildroot-xtensa-HiFi2-Snapshot/buildroot-xtensa-smp/binaries/HiFi-2
   $ cp rootfs.xtensa_test_mmuhifi_c3.cpio /tmp
   $ cd /exports
   $ mkdir LINUX_ROOT.HiFi-2_DemoBoard.buildroot-xtensa-smp
   $ cp /tmp/rootfs.xtensa_test_mmuhifi_c3.cpio
   $ cat rootfs.xtensa_test_mmuhifi_c3.cpio | cpio -i

Next add a line to /etc/exports:

   /exports                *(rw,no_root_squash,sync,no_wdelay)

and restart you nfs services:

   $ /etc/rc.d/init.d/nfs restart

or

   $ sbin/chkconfig nfs on

The showmount command should show your NFS file system now being exported:

   $ showmount -e
     Export list for pdelaney_fc5.hq.tensilica.com:
     /exports *
   $


Configuring U-Boot to Boot Linux

Your LX200 board should have arrived with U-Boot installed in the flash ready to use. Just connect a serial interface to a text based terminal emulation program like minicom. We usually just type:

  minicom xtboard

the boards expect to communicate at with a bauderate of 38400.

Most users of this board are interested in developing codecs on and will prefer to just boot linux with the root file system we just described how to export on you NFS server. We will use git now to pull a snapshot of a performace 2.6.29 linux kerenel and configure U-Boot to automatically boot it after a power cycle.

   U-Boot> setenv serverip 192.168.11.78                                                                   [TFTP server IP Address]
   U-Boot> setenv ipaddr 192.168.11.155                                                                    [HOST IP address]
   U-Boot> setenv bootfile uImage.xtensa-2.6.29-smp.test_mmuhifi_c3                                        [File to fetch with TFTP and pass to bootm]
   U-Boot> setenv exportpath /exports/LINUX_ROOT.HiFi-2_DemoBoard.buildroot-xtensa-smp
   U-Boot> setenv bootargs_using_bootp=console=ttyS0,38400 ip=bootp root=nfs coredump_filter=0xff
   U-boot> setenv bootargs console=ttyS0,38400 ip=dhcp root=/dev/nfs rw nfsroot=${serverip}:${exportpath}
   U-bppt> setenv bootcmd tftpboot\; bootm
   U-Boot> setenv bootdelay=10
   U-Boot> setenv autostart yes
   U-Boot> saveenv
   U-Boot> 


Booting Linux with U-Boot

Tayloring your system prior to developing your codec

Compiling your codec and linking it with Mplayer

Adding your codec to Buildtoot