Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

GSG: DM365 DVEVM Software Setup for MontaVista Kernel

From Texas Instruments Wiki
Jump to: navigation, search

Software Overview

To begin developing applications, you need to install the DVEVM development environment. This chapter outlines the steps required to load the DVEVM software onto the development host. You will need the distribution disks or the files they contain to get started, for the BETA release, the DVEVM software will need to be downloaded from here, only the MontaVista tools will be included on the DVD.

The DaVinci software approach provides interoperable, optimized, production-ready video and audio codecs that leverage integrated accelerators. These codecs are built into configurable frameworks, and are presented via published APIs within popular operating systems (such as Linux) for rapid software implementation.

The following software is made available with the DVEVM, some included with the kit and some can be downloaded with registration.

Software package Description Location
TI DVSDK Software installer dvsdk_dm365_setuplinux_#_#_#_#.bin This package includes demo applications, Codec Engine software and related components Download from TI's myRegisteredSoftware after you have activated your ID
MV Development Tool chain installer mvl_5_0_demo_sys_setuplinux.bin This installation file contains the MontaVista Tool development tool chain DVD-R included in the DVEVM kit or updated on TI's myRegisteredSoftware
TI LSP package installer mvl_5_0_0_demo_lsp_setuplinux_#_#_#_#.bin This installer contains the DM365 Linux support package DVD-R included in the DVEVM kit or updated on TI's myRegisteredSoftware
TI XDC Tools installer xdctools_setuplinux_#_#_#.bin This installer contains TI's XDC tools DVD-R included in the DVEVM kit or updated on TI's myRegisteredSoftware
SDI Board Support Software This package includes the EVM board utilities DVD-R included in the DVEVM kit and also available from Spectrum Digital Support Site

Texas Instruments, in agreement with MontaVista Software Inc., is providing a demonstration version of the Linux Professional Edition v5.0 embedded operating system and development tools. The base DVEVM kit includes this demonstration version. The demo version is a subset of what MontaVista provides with the full Professional Edition. Tools such as DevRocketTM and the Professional Edition documentation are not included, but it is otherwise fully functional and useful for customers evaluating the DaVinci platform. Also, please note that this release does not include a MontaVista user license, and no direct customer support, warranty, or indemnification from MontaVista Software Inc. is provided.

You may choose to order the DaVinci Software Production Bundle (DVSPB), which includes the production release of this demonstration version of MontaVista Linux. This includes a full MontaVista license and the DevRocket IDE.

For an alternative set of installation steps for a Ubuntu 9.04 (or similar) distribution please see GSG: DVSDK 2.0 Software Setup in Ubuntu.

Command Prompts in This Guide

In this guide, commands are preceded by prompts that indicate the environment where the command is to be typed. For example:

host $

Indicates command to be typed into the shell window of the host Linux workstation.

EVM #

Indicates commands to be typed into the U-Boot shell in a console window connected to the EVM board's serial port as discussed here.

target $

Indicates commands to be typed into the Linux shell in the terminal window connected to the EVM board's serial port.

Software Components

The following figure shows the software components used for application development with the DVEVM kit:

DM365 Software Block Diagram.jpg

In the previous figure, everything runs on the ARM. The application handles I/O and application processing. To process video, image, speech, and audio signals, it uses the VISA APIs provided by the Codec Engine. The Codec Engine, in turn, uses xDM-based codecs. For more information, see the Codec Engine Application Developer’s Guide (SPRUE67).

In addition, Linux running on the ARM makes a large number of APIs available to your application, including drivers and timers.

Preparing to Install

On a host Linux system (such as Red Hat Enterprise Linux (RHEL) v4 which was used for this guide), mount the DVEVM demonstration DVD and copy the following files to a temporary location with at least 1.2 GB available space. Since you can delete the installation files after installing the software, a directory like /tmp is recommended.

  • mvl_5_0_#_demo_sys_setuplinux.bin - installs the Monta Vista tools
  • mvl_5_0_0_demo_lsp_setuplinux_#_#_#_#.bin - installs the Monta Vista kernel source tree with the TI modifications, also known as the Linux Support Package (LSP)
  • psp_#_#_#_#.bin - installs the PSP support collateral (documentation and examples for the LSP)
  • xdctools_setuplinux_#_#_#.bin - installs the XDC tools package
  • dvsdk_dm365_setuplinux_#_#_#_#.bin - installs the DVSDK itself
  • LPTB_#_#_#.bin - installs the Linux Performance Test Bench

Updates to these installers may be available on the TI DaVinci Software Updates website.

Ensure that an X graphical display is available.

Installing the Software

Installing the software used by the DVEVM involves performing the following steps:

  • Installing the Target Linux Software
  • Installing the DVSDK Software
  • Installing the Linux Performance Test Bench
  • Exporting a Shared File System for Target Access
  • Testing the Shared File System

Installing the Target Linux Software

This section explains how to install Linux for use on the target board. This is a demonstration version of MontaVista Linux Pro v5.0.

Note that separate versions of Linux are used by the target and your host Linux workstation. The following Linux host operating system is tested with the DVEVM: Red Hat Enterprise Linux v4 (Server Edition).

To install the Linux software, follow these steps:

1) Log in as root on your host Linux workstation. This will allow you to successfully run the graphical installer to install MontaVista Linux.

Note: If you are logged in with any account other than root, log out from your workstation (by issuing the exit, logout or logoff command, depending on your Linux version). Log in again as root.

2) We suggest that you create a directory called /opt/mv_pro_5.0 using the following command. This will be the directory into which you install the software.

host $ mkdir /opt/mv_pro_5.0 

3) Execute each of the following bin files (where #_#_#_# is the current version number) from the temporary location that they were copied in order to extract the installers for the Linux tools, Linux kernel, and the file system. If a bin file does not run (i.e. you get a permission denied type of error), make sure these files are executable (use chmod +x *.bin).

Instead of the default installation directory, change the installation directory to the new directory you created in the previous step.

host $ ./mvl_5_0_########_demo_sys_setuplinux.bin


host $ ./mvl_5_0_0_demo_lsp_setuplinux_#_#_#_#.bin 

4) After you execute these .bin files, make sure the following files are located in /opt/mv_pro_5.0 (or in the /mv_pro_5.0 subdirectory of the directory you chose in place of the default):

  • mvltools5.0-no-target.tar.gz
  • DaVinciLSP_#_#_#_#.tar.gz

There is also an uninstall file that can be ignored.

5) Go to the location where you will unpack the tar files. For example:

host $ cd /opt/mv_pro_5.0

6) Unpack the tar files (as root) by using the following commands:


host $ tar zxf mvltools5.0-no-target.tar.gz 


host $ tar zxf DaVinciLSP_#_#_#_#.tar.gz

This creates the MontaVista directory structure under the /opt/mv_pro_5.0/montavista/ directory.Note that unpacking these tar files will overwrite any existing files that were previously installed. Note: The LSP shipped with the DVSDK is a multi-platform LSP; it is not configured for a particular platform. As shipped, this LSP cannot be used to build the demo or example applications. It must first be copied to a user area and configured/built for the EVM. Please see Building a New Linux Kernel for instructions.

Installing the DVSDK Software

The DVSDK software includes Codec Engine components, sample data files, xDAIS and xDM header files, and a contiguous memory allocator for Linux (CMEM).

To install the DVSDK software using the Linux installer, follow these steps:

1) Log in to the system using a user account. Navigate to the location of the installers you downloaded. The user account must have execute permission for the dvsdk_dm365_setuplinux_#_#_#_#.bin and xdctools_setuplinux_#_#_#.bin files. In order to do this, you must switch to "root" on the host Linux workstation, change the permissions of the files. For example:

host $ su root
host $ chmod 777 dvsdk_dm365_setuplinux_#_#_#_#.bin 
host $ chmod 777 xdctools_setuplinux_#_#_#.bin
host $ chmod 777 psp_#_#_#_#.bin

2) It is suggested to open a new terminal that will be logged in as user to execute the installers, than execute the DVSDK installer that you previously copied from the DVSDK DVD. For example:

host $ cd /tmp
host $./dvsdk_dm365_setuplinux_#_#_#_#.bin

This installs the DVSDK in /home/useracct/dvsdk_#_#.

3) Execute the XDC installer that you previously copied from the DVSDK DVD (or downloaded). When you are prompted, do not use the default installation location. Instead, install the software in the directory created in Step 2. For example, /home/useracct/dvsdk_#_#. For example:

host $ ./xdctools_setuplinux_#_#_#.bin

4) Execute the PSP installer that you previously copied from the DVSDK DVD (or downloaded). When you are prompted, do not use the default installation location. Instead, install the software in the directory created in Step 2. For example, /home/useracct/dvsdk_#_#. Once the installer completes you will have a PSP_#_#_#_#.tar.gz file in your DVSDK directory, you can now extract it. For example:

host $ ./psp_#_#_#_#.bin
host $ cd ~/dvsdk_#_#_#_#
host $ tar -zxvf psp_#_#_#_#.tar.gz

5) You can now delete the .bin files that you loaded into the temporary directory.

Note: You can uninstall these components by using the rm -rf command on its directory. You should ignore the uninstall files created by the installer.

Creating a Shared File System Between Host and Target

Although the EVM board's (i.e. target's) NAND flash contains a file system, during development it is more convenient to have the target board NFS mount a file system on a host Linux workstation. Once you have tested the application, you can store it on the board's flash for a standalone demonstration.

Before the EVM can mount a shared target file system, you must export that target file system on the host Linux workstation. The shared file system uses a NFS (Network File System) server. The exported file system will contain the target file system and your executables.

Exporting a Shared File System for Target Access

To export the file system from your NFS server, perform the following steps. You only need to perform these steps once.

1) Log in with a user account on the host Linux workstation.

2) Perform the following commands to prepare a location for the MontaVista file system. For example:

host $ cd /home/useracct
host $ mkdir -p workdir/filesys
host $ cd workdir/filesys

3) Switch user to "root" on the host Linux workstation.

host $ su root

4) Perform the following commands to create a copy of the target file system with permissions set for writing to the shared area as useracct. Substitute your user name for useracct. If you installed in a location other than /opt/mv_pro_5.0, use your location in the cp command.

host $ cp -a /opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/target/* .
host $ chown -R useracct opt

5) Still as root, edit the /etc/exports file on the host Linux workstation (not the exports file on the target filesystem) using a text editor like gedit, for example:

host $ gedit /etc/exports 

Add the following line for exporting the filesys area, substituting your user name for useracct. Use the full path from root; ~ may not work for exports on all file systems. By editing the exports file you are effectively sharing the folder so that other devices (such as the EVM) can mount it.

/home/useracct/workdir/filesys *(rw,no_root_squash,no_all_squash,sync)

Note: Make sure you do not add a space between the * and the ( in the above command.

6) Still as root, use the following commands to make the NFS server aware of the change to its configuration and to invoke an NFS restart.

host $/usr/sbin/exportfs -av
host $/sbin/service nfs restart

Note: Use exportfs -rav to re-export all directories. Use /etc/init.d/nfs status to verify that the NFS status is running.

7) Verify that the server firewall is turned off:

host $ /etc/init.d/iptables status

If the firewall is running, disable it:

host $ /etc/init.d/iptables stop

Testing the Shared File System

To test your NFS setup, follow these steps:

1) Get the IP address of your host Linux workstations as follows. Look for the IP address associated with the eth0 Ethernet port.

host $ /sbin/ifconfig

2) Open a terminal emulation window to connect to the EVM board via RS-232 using the instructions here. If you have a Windows workstation, you can use HyperTerminal. If you have a Linux workstation, you might use Minicom. (You may need to turn on line wrap.)

3) Power on the EVM board, and abort the automatic boot sequence by pressing a key in the console window (as shown here). This gets you into the U-Boot prompt where you can configure how U-Boot will boot the Linux kernel.

4) Set the following environment variables in the console window:

EVM # setenv nfshost <ip address of nfs host> 
EVM # setenv rootpath directory to mount 
EVM # setenv bootargs 'console=ttyS0,115200n8 noinitrd rw ip=dhcp root=/dev/nfs nfsroot=$(nfshost):$(rootpath),nolock mem=76M video=davincifb:vid0=OFF:vid1=OFF:osd0=720x576x16,4050K dm365_imp.oper_mode=0 davinci_capture.device_type=4'

Note that the setenv bootargs command should be typed on a single line. Also note that you should avoid using the numeric keypad to enter numbers, as it can sometimes insert extra invisible characters. These environment variables must be typed in perfectly including capitals, if anything is typoed you will likely run into boot errors.

The directory to mount must match what you specified in Step 5 of Exporting a Shared File System for Target Access. For example, /home/<user>/workdir/filesys.

Hints: You may want to use the printenv command to print a list of your environment variables. You can also save these setenv commands in a .txt file from which you can paste them in the future.

5) Save the environment so that you don't have to retype these commands every time you cycle power on the EVM board:

EVM # saveenv

6) Boot the board using NFS:

EVM # boot

7) You can now log in as "root" with no password required.

See DM365 Alternate Boot Methods for information about booting with TFTP, NFS, or the board's NAND flash.

Notes on Using Evaluation/Production Codecs

As part of the DM365 DVSDK installation, you received a number of codecs:

  • Sequential JPEG Decoder
  • Sequential JPEG Encoder
  • MPEG4 Restricted Simple Profile Decoder
  • MPEG4 Simple Profile Encoder
  • H.264 High Profile Decoder
  • H.264 High Profile Encoder
  • G.711 Decoder (not a TI codec)
  • G.711 Encoder (not a TI codec)

These codecs are provided under a "for demonstration-only" license agreement. If you wish to use these codecs in a production development environment, you can go to the http://www.ti.com/digitalmediasoftware web site and click on "Software Inventory" to download the latest production versions and the appropriate license agreement.

Setting Up the Build/Development Environment

To set up the development and build environment, follow these steps:

1) Log in to your user account (and not as root) on the NFS host system.

2) Set your PATH so that the MontaVista tool chain host tools and cross compiler (arm_v5t_le-gcc) can be found. For example, in a default installation of the MontaVista LSP, you should add a definition like the following to your shell resource file (for example, home/user/.bashrc), typically this would be done using the export command. Note that there can be no spaces or carriage returns in the path definition. Note that this step is asking you to open .bashrc in a text editor such as vi or gedit and add the export command line to the file, for example run the command below:

host $ gedit /home/user/.bashrc

Than add the export command below to the .bashrc file:

export PATH="/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin:/opt/mv_pro_5.0/montavista/pro/bin:/opt/mv_pro_5.0/montavista/common/bin:$PATH"

If you installed in a location other than /opt/mv_pro_5.0, use your own location in the PATH.

3) Remember to use the following command after modifying your .bashrc file, the source command will essentially execute the .bashrc script such that the path you just added to it is put into your environment variables:

host $ source /.bashrc 

4) If you want to verify your new PATH variable you can run either of the commands below:

This will print just the PATH variable:

host $ echo $PATH 

This will print all of the system's current environment variables:

host $ printenv 

Writing a Simple Program and Running it on the EVM

Make sure you have performed the steps in Exporting a Shared File System for Target Access and Setting Up the Build/Development Environment.

Perform the following steps on the NFS host system as user (not as root):

1) Make a new directory for the simple program:

host $ mkdir /home/useracct/workdir/filesys/opt/hello

2) Move to the new directory:

host $ cd /home/useracct/workdir/filesys/opt/hello

3) Create a file named hello.c using a text editor (for example, gedit, kedit, xemacs, or vi),

host $ gedit hello.c

Now add the following contents to it:

#include <stdio.h>
int main()
{
printf("Buongiorno DaVinci!\n");
return 0;
}

4) Build the new c file:

host $ arm_v5t_le-gcc hello.c -o hello

Perform the following steps on the target board. You may use either the target's console window (Discussed here) or a telnet session.

1) Move to the new directory on the target:

target $ cd /opt/hello

2) Run the new executable:

./hello. 

The output should be:

Buongiorno DaVinci!

Building a New Linux Kernel

If you modify the target's Linux kernel sources, you will need to rebuild it and then boot it up by either replacing the kernel that comes installed on the EVM board's flash (through a TFTP load, Serial load, JTAG load, etc) or by having the U-Boot utility use TFTP (Tiny File Transfer Protocol) to boot the kernel over a network connection.

Make sure you have completed Setting Up the Build/Development Environment and Writing a Simple Program and Running it on the EVM before attempting to build a new kernel.

To rebuild the Linux Kernel, follow these steps:

1) Log in to your user account (not as root).

2) Edit the Rules.make file in the dvsdk_#_#. directory:

host $ gedit /home/user/dvsdk_#_#_#_#/Rules.make

Modify PLATFORM to match your EVM board as follows:

PLATFORM=dm365 

3) Use commands like the following to make a local working copy of the MontaVista Linux Support Package (LSP) in your home directory. This copy contains the embedded Linux 2.6.18 kernel plus the DaVinci drivers. If you installed in a location other than /opt/mv_pro_5.0, use your location in the cp command.

host $ cd /home/<useracct>
host $ mkdir -p workdir/lsp
host $ cd workdir/lsp
host $ cp -R /opt/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci .

4)Use the following commands to configure the kernel using the DaVinci defaults. Note that CROSS_COMPILE specifies a prefix for the executables that are used during compilation:

host $ cd ti-davinci/linux-2.6.18_pro500
host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- davinci_dm365_defconfig

5) To modify the kernel options, you will need to use a configuration command such as "make menuconfig" or "make xconfig". To verify the MontaVista default kernel options, use the following command:

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- checksetconfig

6) Compile the kernel using the following command:

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- uImage

7) If the kernel is configured with any loadable modules (that is, selecting <M> for a module in menuconfig), use the following commands to rebuild and install these modules (with the default out of the box build you will not have any and can skip this step):

host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- modules
host $ make ARCH=arm CROSS_COMPILE=arm_v5t_le- INSTALL_MOD_PATH=/home/<useracct>/workdir/filesys modules_install

8) Use the following command to copy uImage to a place where U-Boot can use TFTP to download it to the EVM. These commands assume you are using the default TFTP boot area, which is /tftpboot. If you use another TFTP root location, please change /tftpboot to your own TFTP root location. (Perform these commands as root or use a chown uImage command to get ownership of the file.)

host $ cp /home/<useracct>/workdir/lsp/ti-davinci/linux-2.6.18_pro500/arch/arm/boot/uImage /tftpboot
host $ chmod a+r /tftpboot/uImage

For more information on setting up a TFTP server, see Setting Up a TFTP Server.

See a standard Linux kernel reference book or online source for more about Linux build configuration options.

Rebuilding the DVSDK Software for the Target

To place demo files in the /opt/dvsdk directory, you need to rebuild the DVSDK software. To do this, follow these steps:

1) If you have not already done so, rebuild the Linux kernel as described in Building a New Linux Kernel.

2) Change directory to dvsdk_#_#.

3) Edit the Rules.make file in the dvsdk_#_#. directory.

host $ gedit Rules.make

If you installed components in the default locations, the directory definitions may already be correct, but you should verify them in any case.

Set PLATFORM to match your EVM board as follows:

PLATFORM=dm365 

Set DVSDK_INSTALL_DIR to the top-level DVSDK installation directory as follows, note that by default ${HOME} refers to your /home/<user> directory:

DVSDK_INSTALL_DIR=/home/<useracct>/dvsdk_#_#

Modify the following variable as needed to match the location of XDCtools on your Linux host. We recommend that XDCtools be installed in the /home/<useracct>/dvsdk_#_# directory, but you may have installed it elsewhere.

XDC_INSTALL_DIR=/home/<useracct>/dvsdk_#_#/xdctools_#_#

Make sure LINUXKERNEL_INSTALL_DIR is defined as follows so it points to where you copied the linux kernel tree in the Building a New Linux Kernel.

LINUXKERNEL_INSTALL_DIR=/home/<useracct>/workdir/lsp/ti-davinci/linux-2.6.18_pro500 

Make sure MVTOOL_DIR points to the MontaVista Linux tools directory as follows:

MVTOOL_DIR=/opt/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le 

Make sure EXEC_DIR points to the opt directory on the NFS exported file system as follows:

EXEC_DIR=/home/<useracct>/workdir/filesys/opt/dvsdk/dm365

4) While in the same directory that contains Rules.make, use the following commands to build the DVSDK demo applications and put the resulting binaries on the target file system specified by EXEC_DIR. Note that the first time you run 'make clean' there may not be much to clean yet, so the output from make will have a lot of 'no such file or directory' messages. The make commands should be run as the user account.

host $ make clean
host $ make
host $ make install 

5) You can test the rebuilt DVEVM software by booting your NFS file system and running the demos from the command line as described in Running the Demos from the Command Line.

Booting the New Linux Kernel

After building the new kernel, in order to use it to boot the DaVinci board, you must transfer it to the board via TFTP. It is assumed you have completed the steps in Building a New Linux Kernel, and the boot file, uImage has been copied to /tftpboot (or some other site-specific TFTP accessible location).

1) Power on the EVM board, and abort the automatic boot sequence by pressing a key in the console window (Discussed here).

2) Set the following environment variables. (This assumes you are starting from a default, clean U-Boot environment. See Default Boot Configuration for information on the U-Boot default environment.)


EVM # setenv bootcmd ’dhcp;bootm’
EVM # setenv serverip <tftp server ip address>
EVM # setenv bootfile uImage
EVM # setenv bootargs mem=76M console=ttyS0,115200n8 root=/dev/mtdblock3 rw rootfstype=yaffs2 ip=dhcp video=davincifb:vid0=OFF:vid1=OFF:osd0=720x576x16,4050K dm365_imp.oper_mode=0 davinci_capture.device_type=4
EVM # saveenv

Note that the 'setenv bootargs' command should be typed on a single line.

3) Boot the board:

EVM # boot

This configuration boots a new Linux kernel via TFTP with a NAND flash based file system. To boot using an NFS file system, see Booting via TFTP Using NFS File System.

For instructions on how to verify that your host workstation is running a TFTP server, and for instructions on what to do if it isn't, see Setting up a TFTP Server.

For more details on booting, see DM365 Alternate Boot Methods.

To continue the EVM setup process please continue in the Getting Started Guide.