Getting Started Guide for the AVNET OMAPL138 EVM

From RidgeRun Developer Connection

(Difference between revisions)
Jump to:navigation, search
Line 7: Line 7:
== Download the SDK  ==
== Download the SDK  ==
-
The evaluation SDK contains everything you need to build Linux for the S6-OMAP CoProcessing kit. It includes the kernel source, the toolchain, and a number of applications already ported to the OMAP-L138. Go [[AVNET OMAPL138 EVM|here]] for a complete list of SDK features. You will need to dowload an evaluation SDK from the [[http://www.ridgerun.com/downloadinfo.shtml?Product=evals6omapsdk|download center (direct link)]]. Once you have completed and submitted a short form, you will be emailed instructions on how to download the SDK. You can put the downloaded SDK installer anywhere on your filesystem.  
+
The evaluation SDK contains everything you need to build Linux for the S6-OMAP CoProcessing kit. It includes the kernel source, the toolchain, and a number of applications already ported to the OMAP-L138. Go [[AVNET OMAPL138 EVM|here]] for a complete list of SDK features. You will need to dowload an evaluation SDK from the [http://www.ridgerun.com/downloadinfo.shtml?Product=evals6omapsdk download center]. Once you have completed and submitted a short form, you will be emailed instructions on how to download the SDK. You can put the downloaded SDK installer anywhere on your filesystem.  
== Installing the SDK  ==
== Installing the SDK  ==

Revision as of 17:01, 20 December 2010

Contents

Installation Guide

Setting up a Linux host for development

This SDK requires a Linux host. This guide assumes that you are running Ubuntu 10.4. For a list of support Linux hosts please go here. For a guide on setting up a Linux host from scratch, go to here. To download Ubuntu for desktop computers, go here.

Download the SDK

The evaluation SDK contains everything you need to build Linux for the S6-OMAP CoProcessing kit. It includes the kernel source, the toolchain, and a number of applications already ported to the OMAP-L138. Go here for a complete list of SDK features. You will need to dowload an evaluation SDK from the download center. Once you have completed and submitted a short form, you will be emailed instructions on how to download the SDK. You can put the downloaded SDK installer anywhere on your filesystem.

Installing the SDK

The SDK comes in the form of a binary installer (.bin file). You will first need to make the file excutable using the following command:

chmod +x s6omapSDK-beta-Linux-x86-Install.bin

The installer must be able to write to the /opt directory in order to install the toolchain. You can allow it to do this in one of two ways. The first way is to run the installer as root using the sudo command or the su (switch user) command. The other way to do this is to change the ownership of /opt such that you as a user and write to it.

$ sudo chown $USER /opt

Note: The 'sudo' command causes the command to run as root. You will need to enter your user password on Ubuntu systems. Most other distributions require you to enter the root password. Then you will be able to run the installer:

$ ./s6omapSDK-beta-Linux-x86-Install.bin

After accepting a license agreement, the installer will ask for for a default location at which to install the SDK. If you are running the installer as a user, the default location is in /home/$USER/s6omapsdk. You can change this to any directory to which you have write permission. You will also be prompted to select if you want a "Typical" or "Custom" install. Select "Typical."

Running 'make' for the first time

Now that you have the SDK installed, you can build your Linux system. You do that by using the 'make' command.

$ cd $HOME/s6omapsdk
$ make

Host OS Check

The SDK first checks to make sure the the host is setup properly and has certain necessary packages installed.

Changing the link from /bin/sh to /bin/bash

The first time that you run make, it will ask you to do a couple of things in order to proceed. The first thing it might ask of you (particularly if you are running an Ubuntu host), is to change the shell that is run when scripts run /bin/sh. You should see this message.

$ make
bash is not your default shell.
Please run:
  sudo rm /bin/sh
  sudo ln -s /bin/bash /bin/sh
make: *** [.oscheck] Error 255

By default on Ubuntu systems, /bin/sh is linked to /bin/dash and that causes problems with certain build scripts. It should be linked to /bin/bash. Run the following commands to fix this problem:

$ sudo rm /bin/sh
$ sudo ln -s /bin/bash /bin/sh

Once you do this, you will need to run make again.

Installing required host packages

This time, it will exit because it might find a number of packages that you need to install on your host in order for it to run. Below is a complete list of the required host packages. Your host system might or might not need all of them and the SDK will tell you which ones are missing. You can install them by running the following command (assumes your host has a valid connection to the internet):

$ sudo apt-get install build-essential libtool libncurses5-dev texinfo minicom quilt subversion curl \
git-core libdbus-glib-1-dev libgtk2.0-dev flex bison gperf autoconf automake libusb-dev libexpect-perl \
mono-devel

First build

During the first build, you'll need to go through the initial menu configuration and the SDK will also download and install some proprietary software packages from TI.

After you've installed the missing packages, you will run make again. This time, it should present you with the top-level configuration menu.

Top level configation menu

Rr-sdk-config-screen.png

This menu is the main way for you to customize your Linux system. You can make modifications to the kernel configuration, select user applications, change the type of filesystem to build, and so on.

Since you are just getting started, just take the default settings by selecting "Exit" with the cursor key and hit the enter key. The menu will exit and it the SDK will be built automatically. This can take a while, depending on the performance of your host system.

Installation of TI packages

The first time you build the SDK, it will automatically attempt to download, install, and build various packages from TI. These include DSP/BIOS, DSPlink, Codec Engine, Code Generation Tools, and XDCtools. Each of these takes some time to download and each comes with its own click-through license agreement that you will need to accept.

By default, the TI packages are all downloaded and installed into the s6omapsdk/downloads directory. Make sure to keep this default installation location. Once you have installed all of the necessary TI packages, the SDK build will complete.

Location of kernel and filesystem

When the SDK build is complete, you will have a kernel and filesystem (and many other things as well, but we won't go into that in this guide).

Kernel location:

Install dir/images/kernel.uImage (uboot loadable binary image) 

Filesystem location:

Install dir/fs/fs (NFS-mountable filesystem directory by default) 

You should now be ready to use these on your board. Install dir is typically going to be /home/user/s6omapsdk.

Booting your board with the new kernel and NFS filesystem

In order to configure your board, load the board with the kernel, and use the NFS filesystem, you will need to do some basic host setup.

Here is a diagram showing the data connections between the board and the host computer.

Setup block diagram.png

Setting up serial access to the Linux console

You use a serial port with a terminal emulator to control u-boot and Linux. The S6-OMAP CoProcessing Kit makes use of Silicon Labs CP2102 USB-UART bridge chips to provide serial ports. Driver support for these chips is already included in Linux. Simply connect the USB port J16 (labeled "OMAP UART") to your host computer. The serial device should appear in /dev/ttyUSBn, where n is chosen by your particular machine (usually 0).

Sometimes it is a little tricky to discover which device this is. Here is a useful command that will tell you. Before you plug in the USB cable, run this command in a terminal:

$ watch "dmesg | tail -5"

This will show you the last 5 lines in the kernel message log (as reported by the 'dmesg' command). When you connect the USB cable, you should see something like this:

[175280.446497] usb 2-1: new full speed USB device using uhci_hcd and address 6
[175280.634470] usb 2-1: configuration #1 chosen from 1 choice
[175280.695555] cp210x 2-1:1.0: cp210x converter detected
[175280.861447] usb 2-1: reset full speed USB device using uhci_hcd and address 6
[175281.102604] usb 2-1: cp210x converter now attached to ttyUSB0

The last line in the dmesg output indicates the serial port device to use, which is /dev/ttyUSB0.

You need to use a terminal emulator program to use the serial port. The picocom terminal emulator work well for this purpose.

Setting up Picocom - Ubuntu

Note: Avnet uses virtual machines (VM) to run Linux. They have noticed the following error when attempting to run Picocom:

    FATAL: cannot open /dev/ttyUSB0: Protocol error"

Sometimes repeated attempts to open the serial port are successful in getting the port to open. It is believed that this is related to using the virtual machine, rather than a native issue with the CP201x driver.

Reset the board and access the U-boot prompt

Once you have your terminal emulator configured and running, reset the OMAP-L138 by pressing SW8 (pushbutton switch labeled "OMAP_RST"). You should see the following text appear in the terminal emulator. Be sure to stop the autoboot process by hitting any key.

UBL customized by RidgeRun
Booting TI User Boot Loader
        UBL Version: 1.65
        UBL Flashtype: SPI
Starting SPI Memory Copy...
Valid magicnum, 0x55424CBB, found at offset 0x00010000.
   DONE
Jumping to entry point at 0xC1080000.


U-Boot customized by RidgeRun
U-Boot 2009.01 (Aug 06 2010 - 08:54:23)

DRAM:  64 MB
In:    serial
Out:   serial
Err:   serial
ARM Clock : 300000000 Hz
DDR Clock : 150000000 Hz
Ethernet PHY: GENERIC @ 0x00
Hit any key to stop autoboot:  0

You are now ready to configure U-boot.

Configuring U-boot

In order to use the kernel and filesystem that you just built, you will need to configure U-boot on your board.

By default, the board is configured to boot Linux out of the box by loading the kernel from the on-board SPI flash and to use the filesytem on the SD card. You will need to configure U-boot to load the kenrel into DDR using TFTP from the host TFTP server, and to mount an NFS filesystem. Fortunately, the board comes preprogrammed with some useful macros to greatly assist you. These macros are set as environment settings in U-boot.

To see what environment variables are installed on your system by default, run the 'printenv' command.

AVNET u-boot # printenv
AVNET u-boot # pri
baudrate=115200
ethaddr=00:08:ee:03:a4:62
stdin=serial
stdout=serial
stderr=serial
ver=U-Boot 2009.01 (Aug 06 2010 - 08:54:23)
bootdelay=3
ipaddr=192.168.0.134
serverip=192.168.0.111
nfspath=/mnt/devel/sdk/trunk/fs/fs
kerneloffset=0x50000
ksize=0x280000
kernelloadaddr=0xC0700000
bootfile=kernel.uImage
update_kernel=tftp ${kernelloadaddr} ${bootfile}; sf probe 0; sf erase ${kerneloffset} ${ksize}; sf write ${kernelloadaddr} ${kerneloffset} ${filesize}
spi_load_kernel=sf probe 0;sf read ${kernelloadaddr} ${kerneloffset} ${ksize}
tftp_load_kernel=tftp ${kernelloadaddr} ${bootfile}
set_bootargs_base=setenv bootargs console=ttyS2,115200n8 mem=34M ip=${ipaddr} ${debugopts}
set_nfsbootargs=run set_bootargs_base; setenv bootargs ${bootargs} root=/dev/nfs nfsroot=${serverip}:${nfspath} rw
set_sdbootargs=run set_bootargs_base; setenv bootargs ${bootargs} root=/dev/mmcblk0p1 rootfstype=ext3 rw
spinfsboot=run set_nfsbootargs; run spi_load_kernel; bootm ${kernelloadaddr}
tftpnfsboot=run set_nfsbootargs; run tftp_load_kernel ; bootm ${kernelloadaddr}
tftpsdboot=run set_sdbootargs; run tftp_load_kernel; bootm ${kernelloadaddr}
spisdboot=run set_sdbootargs; run spi_load_kernel; bootm ${kernelloadaddr}
bootcmd=run spisdboot

Environment size: 1227/65532 bytes

To set the board to boot the kernel from TFTP and to use an NFS filesystem, run the following command in U-boot:

AVNET u-boot # setenv bootcmd run tftpnfsboot

This sets the 'bootcmd' environment variable in U-boot to run the macro 'tftpnfsboot.' That way, when your board turns on, by default it will boot from the network. This is very convenient for development.

There are a few other settings that are specific to your network/host computer setup. These include the IP address of the board, the IP address of the TFTP/NFS server, and the path to the NFS root filesystem on the server. You need to set these using the following commands.

AVNET u-boot # setenv serverip <TFTP/NFS server IP address>

Note: You can find the IP address of your host by running the 'ifconfig' command.

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0c:29:df:bf:1a  
          inet addr:192.168.0.111  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fedf:bf1a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
...
AVNET u-boot # setenv ipaddr <board IP address, usually on the same subnet as the TFTP/NFS server>
AVNET u-boot # setenv nfspath <absolute path to NFS filesystem on your host computer (e.g. /home/<user>/s6omapsdk/fs/fs)>

After you have made the network setting changes, you can test them to make sure you have a valid connection between the board and the host computer by running the ping command.

AVNET u-boot # ping $serverip
host <serverip is alive>

You should be done make changes to the U-boot configuration. Save it to SPI flash using the 'saveenv' command.

AVNET u-boot # saveenv
Saving Environment to SPI Flash...
Erasing SPI flash...Writing to SPI flash...done

Host PC Server Setup

You'll need to make sure you have a TFTP and NFS server running properly on your host computer.

Setting up a TFTP server

Using u-boot, you can speed downloads to the target hardware by using the OMAP Ethernet connection and Trivial File Transfer Protocol (TFTP). Your host PC needs to be configured as a TFTP server for this to work.

Setting Up A Tftp Service

Setting up an NFS server

For application development, it is convenient to use root NFS mount file system for the target hardware. This allows you to rebuild your application on the host and immediately run the application on the target hardware with no interveining steps. You host PC needs to be configured as a NFS server for this to work.

Setting Up A NFS Service

Boot your board

Once you have the board and host computer setup properly, you should be ready to boot your board.

On the host computer, copy the new kernel image to your tftp server downloads directory. This is typically /tftpboot.

$ cp images/kernel.uImage /tftpboot

Now, using the serial console, at the U-boot prompt, simply type 'boot':

AVNET u-boot # boot
TFTP from server 192.168.0.138; our IP address is 192.168.0.134
Filename 'kernel.uImage'.
Load address: 0xc0700000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ##########################
done
Bytes transferred = 2127616 (207700 hex)
## Booting kernel from Legacy Image at c0700000 ...
   Image Name:   "RR Compressed Linux Kernel"
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2127552 Bytes =  2 MB
   Load Address: c0a00000
   Entry Point:  c0a00000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.33-rc4-ridgerun (training@training-vm) (gcc version 4.2.4) #2 PREEMPT Wed Dec 15 12:50:18 CST 2010
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: DaVinci DA850/OMAP-L138/AM18xx EVM
Memory policy: ECC disabled, Data cache writeback
DaVinci da850/omap-l138 variant 0x0
...
...
eth0: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=1:00, id=7c0f1)
IP-Config: Guessing netmask 255.255.255.0
IP-Config: Complete:
     device=eth0, addr=192.168.0.134, mask=255.255.255.0, gw=255.255.255.255,
     host=192.168.0.134, domain=, nis-domain=(none),
     bootserver=255.255.255.255, rootserver=192.168.0.138, rootpath=
Looking up port of RPC 100003/2 on 192.168.0.138
PHY: 1:00 - Link is Up - 100/Full
Looking up port of RPC 100005/1 on 192.168.0.138
VFS: Mounted root (nfs filesystem) on device 0:13.
Freeing init memory: 148K
init started: BusyBox v1.14.2 (2010-12-15 11:43:19 CST)
starting pid 508, tty '': '/etc/rcS'
Starting System
done.
Welcome to
    _____
   /     \          ____   ___       ____  ___     ____   ________  _______ __
  /____   \______  /    \ \   \     /   / /   /\  |    / /  _____/ /__    //_/
 /\    \   \    / /      \ \   \   /   / /   // \ |   / /  /_        /   /
/__\    \___\  / /   /\   \ \   \ /   / /   //   \|  / /  /__/      /   /
    \         / /   //_    \ \   \   / /   /\       / /  /___      /   /
     \_______/ /___/    \___\ \___\\/ /___/  \_____/ /_______/    /___/
                                                     Electronics Marketing
                Customized by RidgeRun Embedded Linux Solutions

For further information see:
http://www.ridgerun.com
http://www.em.avnet.com

Build host: training-vm
Built by: training
Build date: Wed, 15 Dec 2010 12:54:32 -0600
Build tag: avnet
Loading modules...
CMEMK module: built on Dec 15 2010 at 12:09:43
  Reference Linux version 2.6.33
  File /home/training/s6omapsdk/proprietary/dvsdk_2_00_00/OMAP-L138_arm_1_00_00_11/linuxutils_2_25_01_06/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c
allocated heap buffer 0xc3000000 of size 0x4de000
cmemk initialized
DSPLINK Module (1.65.00.02) created on Date: Dec 15 2010 Time: 12:11:29
Setting ALSA volume to 100%...
Configuring network interfaces
Starting D-Bus message bus system

Please press Enter to activate this console.

Congratulations! Your board is now booted and running the software you just built with the SDK. Now, let's see some of the things we can do right out of the box.

Step 6) Running the FPGA tests

The SDK ships with a few simple tests to show connectivity with the on-board Spartan-6 FPGA. These are located in the /s6omap_test directory.

First, activate the Linux console.

Please press Enter to activate this console.
starting pid 609, tty '/dev/ttyS2': '-/bin/sh'


BusyBox v1.14.2 (2010-12-15 11:43:19 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/ #

Change directory to s6omap_test.

cd s6omap_test
/s6omap_test # ls
s6omap_fpga_prog.ko       s6omap_i2c.ko
s6omap_fpga_prog_test.sh  s6omap_i2c_fpga_test.sh
/s6omap_test #

Running the FPGA reload test

The FPGA can be reset and reloaded from using this test. First, install the driver into the kernel.

/s6omap_test # insmod s6omap_fpga_prog.ko
s6omap_fpga_prog_init: entered

This driver enables the user to toggle the PROGRAM signal on the FPGA and to check the status of the DONE signal. Toggling the PROGRAM signal causes the FPGA to reset and reload its configuration from SPI flash (a different SPI flash than the one used to boot the OMAP-L138). You can run a simple script to see this in action.

/s6omap_test # ./s6omap_fpga_prog_test.sh

  This script will test the ability of the driver
  to issue a reset to the FPGA.  The driver uses
  sysfs to issue the reset pulse and and to check
  to see if the FPGA is done with programming.

  In 10 seconds, we will issue an FPGA reset using PROG_B
  signal.  Observe LED D16 go dark.  After a few seconds,
  it should light back up, indicating that the FPGA has
  successfully reread its configuration bitstream
  from the SPI flash.

  Reset issued, checking DONE bit.
  DONE is low.  Waiting while FPGA re-reads it's configuration
  from SPI flash.
  DONE went high.  Successful FPGA prog test.

Running the FPGA I2C test

You can also test communication between the OMAP-L138 and the FPGA using I2C. The FPGA comes configured with a slave device on the I2C bus and this used as a simple command and status interface.

First, install the driver.

/s6omap_test # insmod s6omap_i2c.ko
s6omap_i2c_init: entered
s6omap_i2c_probe: entered
/s6omap_test #

Now, run the script. This will do a few things. First it will read the version registers on the FPGA and report the version. Next, it toggles some LEDs (LED1-4), and then it reads the state of the DIP switch SW1 and the user pushbutton switches (SW2-SW5).

/s6omap_test # ./s6omap_i2c_fpga_test.sh

   This script tests the i2c connectivity between the
   ARM CPU and the FPGA.  This requires that the FPGA
   be programmed with the i2c slave at i2c address 0x2A.

  FPGA ID 0x1, version 1.7

   Writing a pattern of 0xFF, 0x00, 0x55, 0xAA to the user LEDs

   Done.

   Ready to read the DIP switch register.  Set bits on SW1 to desired state
   and then press enter key when ready.


   DIP switch = 0x1

   Ready to read the pushbutton switch register.  Press a user button
   and then press enter key when ready.


   Pushbutton switch = 0x8

   Test done.
/s6omap_test #


Additional Things to Do

Using an SD card root filesystem

You can store the file system on an SD card. To do this, you need to have the right partitions setup on the SD card. These steps will create two partitions, the second one is used to hold the target file system.

Formatting a new SD card
Installing the Filesystem to an SD Card
Configuring the Avnet S6-OMAP board to use an SD Card root filesystem

Checking out the binary images

If you simply want to run the pre-built versions of the Linux kernel using the pre-built file system,, the start by downloading the pre-built images from 're not able to use the SDK you could download the pre-built images.

https://www.ridgerun.com/support/avnet/downloads/

Saving pre-built kernel and file system on target hardware

Format an SD Card with 2 partitions in the first one use a FAT32 format with 32Mb of size and in the second one format it with EXT3 format and with the rest of the SD Card, as described above.

On your host computer, copy the image of the file system given in the web site to the second partition:

sudo tar -C /media/MOUNT EXT3 -xzvf fs-avnet-evm.tar.gz

Plug the SD to the board and power on it. Using your terminal emulator (e.g. picocom), send the following commands to u-boot.

echo Initialize access to SPI flash
sf probe 0
echo Get IP address and configure networking
setenv autoload no
dhcp
setenv serverip SERVER_WERE THE TFTP IS
setenv autostart no

echo Load kernel image over the network using TFTP
tftp 0xC0700000  kernel.uImage.avnet.evm

echo Erasing SPI flash memory...
sf erase 0x50000 0x280000

echo Saving kernel...
sf write 0xC0700000 50000 24FF88

echo Saving new kernel load address...
setenv kernelloadaddr 0xC0700000

echo Saving new kernel save addresses and offset...
setenv kernelsaveaddr 0x50000
setenv kerneloffset 0x50000

echo Saving new kernel size...
setenv ksize 0x250000

echo Set kernel command line
setenv setenv bootargs 'console=ttyS2,115200n8 root=/dev/mmcblk0p2 rootdelay=2 rootfstype=ext3 mem=34M' 

echo Set boot command 
setenv bootcmd 'sf probe 0;sf read ${kernelloadaddr} ${kerneloffset} ${ksize}; bootm ${kernelloadaddr}'
setenv autostart yes

echo Saving u-boot parameter environment
saveenv

What's Tested and Supported

AUDIO Audio test Spartan 6 LX45T/OMAP L138
USB-RS232 USB-RS232 test Spartan 6 LX45T/OMAP L138
Ethernet Ethernet Test Spartan 6 LX45T/OMAP L138
USB ports USB0 USB1 USB Test Spartan 6 LX45T/OMAP L138
SDCARD SLOT SD Card Test Spartan 6 LX45T/OMAP L138
SATA SATA Test Spartan 6 LX45T/OMAP L138
I2C Test I2C General
USER switches
User LEDs

What's Tested and not Supported

Changing the mode with OMAPL138 related pins

What's not Tested and not currently supported by the SDK

FPGA Communications Ports
OMAP DEBUG (JTAG Interface)
ALI Interface (AVNET LCD Interface)
FPGA GTP Interfaces
installing an updated bootloader using make installbootloader

Bold text

Navigation
Toolbox