Building DSPLink

From Texas Instruments Wiki
Jump to: navigation, search

END OF LIFE

DSP Link is still available for download, but no further releases or updates are planned. Please see IPC Software Options for details and alternatives.

Overview

DSPLink is provided with full source code and an associated build system. This page gives the sequence to be followed for installing and building DSPLink.

Install, build sequence

How do I install DSPLink?

DSPLink is available as a tar.gz file from DSP/BIOS Link Product Download Pages. To install it, simply extract it into your desired directory.

DSPLink Build Prerequisites

GPP-side

To build the GPP-side of DSPLink, the following are needed:

  • PERL installation (usually present on all systems)
  • make/gmake (also usually present)
  • Linux toolchain (Depending on the device, this may be the Montavista Pro toolchain, CodeSourcery or other toolchains, as documented within the DSPLink ReleaseNotes as the dependency for each supported device).
  • Linux base-port (This also differs for each device, and is documented within the ReleaseNotes as the dependency)

DSP-side

To build the DSP-side of DSPLink, the following are needed:

  • PERL installation (usually present on all systems)
  • make/gmake (also usually present)
  • If building on Windows, Windows-based tools available standalone or within Code Composer Studio (CCS). If building on Linux, standalone Linux-based tools can be used

Setting the DSPLINK Environment Variable

The makefiles for DSPLink all utilize a variable called DSPLINK. Any time you want to build/rebuild DSPLink you need to make sure there is a DSPLINK environment variable present and set correctly. It specifies the absolute path to the root of your DSPLink installation (i.e. a folder that contains config, doc, dsp, etc, gpp, and make folders). The DSPLINK makefile variable is inherited from the DSPLINK environment variables. Therefore you must be sure to set this environment variable correctly. There are two methods to set the DSPLINK environment variable.

Method 1: Directly in the Shell

Let's assume we're using Linux and the dsplink folder is located at ${HOME}/dsplink_#_##_##/packages/dsplink

If using tcsh shell:

setenv DSPLINK   ${HOME}/dsplink_#_##_##/packages/dsplink

If using bash shell:

export DSPLINK=$HOME/dsplink_#_##_##/packages/dsplink

On Windows PC, assume that the dsplink folder is in L:\dsplink_#_##_##\packages\dsplink

set DSPLINK=L:\dsplink_#_##_##\packages\dsplink

Method 2: Using Provided Shell Scripts

Scripts to export the DSPLINK environment variable and and add it to the path are provided with DSPLink.

For Linux tcsh you need to edit:

$(DSPLINK)/etc/host/scripts/Linux/dsplinkenv

For Linux bash you need to edit:

$(DSPLINK)/etc/host/scripts/Linux/dsplinkenv.bash

This file should be sourced from the command line in order to add the environment variables into your shell:

$ cd etc/host/scripts/Linux
$ source dsplinkenv 

For Windows you need to edit:

$(DSPLINK)\etc\host\scripts\msdos\dsplinkenv.bat

You can then source the batch file from the command prompt:

C:\> cd L:\dsplink_#_##_##\packages\dsplink\etc\host\scripts\msdos
L:\dsplink_#_##_##\packages\dsplink\etc\host\scripts\msdos> dsplinkenv.bat

Build Configuration

Now that the DSPLINK environment variable is set, you need to execute the DSPLink configuration perl script dsplinkcfg.pl. This script is present within $(DSPLINK)/config/bin.

If you set the DSPLINK environment variable directly in your shell then go to $(DSPLINK)/config/bin and invoke:

$ perl dsplinkcfg.pl

If you modified the included scripts and then sourced them from your shell, then you can invoke the script by simply calling:

$ dsplinkcfg

Run through the configuration script and enter all required information as asked. If any of the configuration options are not clear, please refer to the DSPLink UserGuide, which gives information about what the options mean.

Note that there's a related article on the configurations Codec Engine uses here.

Enabling XDC-based integration

If you will be integrating DSPLink into your system using XDCtools-based configuration (e.g. using Codec Engine), there are 2 more steps required before the Build Configuration step is complete.

cd into the $(DSPLINK)/dsp directory and run:

$ $(XDC_INSTALL_DIR)/xdc clean
$ $(XDC_INSTALL_DIR)/xdc .interfaces

cd into the $(DPLINK)/gpp directory and run:

$ $(XDC_INSTALL_DIR)/xdc clean
$ $(XDC_INSTALL_DIR)/xdc .interfaces

These two steps prepare the dsplink.dsp and dsplink.gpp XDC packages for consumption by the XDC config tooling.

Modifying Makefiles to Setup Build Paths

Before moving to actually building the sources, it is important to ensure that the paths to the dependencies are given to the DSPLink build system. When you run the dsplinkcfg.pl build configuration script, it prints out information at the end, indicating where this information is to be specified. For example:

  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  Edit GPP and DSP distribution files for user specific path
  settings for OS base directory, tool chain path etc

  Edit GPP distribution file:
  /home/user/dsplink/make/Linux/davinci_mvlpro4.0.mk
  Edit DSP distribution file:
  /home/user/dsplink/make/DspBios/c64xxp_5.xx_linux.mk

  ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

This information is also available within the file generated as a result of this configuration step: $(DSPLINK)/config/CURRENTCFG.MK. Fields GPPDISTRIBUTION and DSPDISTRIBUTION in this file give the names of the distribution files to be updated.
Details of the variables within these make files that need to be modified, are present in the UserGuide section on customizing the build environment.

Building DSPLink

Make sure you've completed all the prior steps. If you close your shell and come back later you'll need to set the environment variables again.

DSPLink has dependency on include/linux/autoconf.h, the automatically generate header file in Linux kernel. That means you need to build the kernel first before building DSPLink.

To build the GPP-side of DSPLink, cd into the $(DSPLINK)/gpp/src directory and invoke:

$ make -s

This builds in both debug and release build by default. If you wish to build only for debug or release build, invoke:

$ make -s debug
$ make -s release

Similarly, to build DSP-side, go into $(DSPLINK)/dsp/src directory and invoke make in the same way as above. To build the DSPLink sample applications, invoke make from $(DSPLINK)/gpp/src/samples and $(DSPLINK)/dsp/src/samples directories.

How to Simplify the Build/Update Process

IMPORTANT: This section is intended as an alternative to the sections "Modifying Makefiles to Setup Build Paths" and "Building DSPLink". It is assumed/expected that you have run the configuration GUI (dsplinkcfg.pl) at least once before using these scripts.

Background

The "normal" build flow for DSPLink involves modifying files that are embedded inside the DSPLink directory structure. This method can be inconvenient when new versions of DSPLink are released because the user needs to make all of those same changes again. These changes include things such as the path to your codegen tools and Linux kernel. In order to make it easier to migrate/update to new versions of DSPLink we need a way to make these changes OUTSIDE the DSPLink directory structure.

Overriding Makefile Variables

An easy way to accomplish this goal is by overriding the makefile variables at the command line. That is, rather than editing variables in makefiles scattered throughout the code, we can instead just pass those variable names to make at the command line. The command line variables will override the makefile variables.

Here's a snippet from davinci_mvlpro4.0.mk referenced earlier:

#   ----------------------------------------------------------------------------
#   Base for code generation tools - compiler, linker, archiver etc.
#   ----------------------------------------------------------------------------
BASE_CGTOOLS    := /opt/montavista/pro/devkit/arm/v5t_le/bin

If you are using different codegen tools, or if you simply have them at a different path on your own computer, all you need to do is pass that variable at the command line:

$ make -s debug BASE_CGTOOLS=/opt/arm/arm-2006q3

This will override the variable in the makefile, but without needing to change the makefile. There are many of these variables so it can get quite lengthy when invoking make in this way.

Script it!

To keep things simple, you might want to create a file or two that does the build for you. My preference is to have two files, one with the path info and the other with the make commands. Here's an example of paths.tcsh which contains all the relevant path info for your build environment:

#!/bin/tcsh
# paths.tcsh
# This file simply creates environment variables.  We will utilize
# these variables in build_dsplink.tcsh by passing them on the
# command line.
 
setenv PERL_DIR /usr/bin
 
setenv ARM_BASE_BUILDOS /data/WorkArea/Brad/CSSD_Linux_18.6baseport/src/linux/kernel_org/2.6_kernel
setenv ARM_BASE_CGTOOLS /opt/arm/arm-2006q3
 
# ARM_CGTOOLS_NAME is just a "helper variable" (i.e. not directly used in make)
setenv ARM_CGTOOLS_NAME arm-none-linux-gnueabi
 
# ARM_CGTOOLS_VERSION is just a "helper variable" (i.e. not directly used in make)
setenv ARM_CGTOOLS_VERSION 4.1.1
 
setenv ARM_COMPILER $ARM_BASE_CGTOOLS/bin/$ARM_CGTOOLS_NAME-gcc
setenv ARM_LINKER $ARM_BASE_CGTOOLS/bin/$ARM_CGTOOLS_NAME-ld
setenv ARM_ARCHIVER $ARM_BASE_CGTOOLS/bin/$ARM_CGTOOLS_NAME-ar
setenv ARM_OSINC_TARGET $ARM_BASE_CGTOOLS/include
setenv ARM_OSINC_PLATFORM $ARM_BASE_CGTOOLS/lib/gcc/$ARM_CGTOOLS_NAME/$ARM_CGTOOLS_VERSION/include
 
setenv DSP_BASE_CGTOOLS /opt/ti/cg6x_6_0_18
setenv DSP_BASE_SABIOS /opt/ti/bios_5_32_03

Now here's the other piece, build_dsplink.tcsh, which will invoke make and pass it command line parameters to override all the relevant makefile variables:

#!/bin/tcsh
# You shouldn't need to modify this file.  Only your paths should change
# and that should be done in paths.tcsh.
#
# You should make this file executable and putting it in the "dsplink"
# directory for your build.
source paths.tcsh
 
# set the DSPLINK path to point to the directory containing this script
# This needs to be invoked from the dsplink directory in order to work!
setenv DSPLINK $cwd
 
setenv MAKE_ARGS_ARM "DSPLINK=$DSPLINK BASE_CGTOOLS=$ARM_BASE_CGTOOLS COMPILER=$ARM_COMPILER LD=$ARM_LINKER ARCHIVER1=$ARM_LINKER ARCHIVER2=$ARM_ARCHIVER LINKER=$ARM_COMPILER BASE_BUILDOS=$ARM_BASE_BUILDOS BASE_OSINC=$ARM_BASE_BUILDOS/include OSINC_PLATFORM=$ARM_OSINC_PLATFORM OSINC_TARGET=$ARM_OSINC_TARGET BASE_PERL=$PERL_DIR"
 
make -s -C $DSPLINK/gpp/src $1 $MAKE_ARGS_ARM
 
# if the gpp side had an error then stop the build so you can see the error, i.e. don’t build the dsp code
if ($? != "0") then 
	exit 1
endif
 
setenv MAKE_ARGS_DSP "DSPLINK=$DSPLINK BASE_CGTOOLS=$DSP_BASE_CGTOOLS BASE_SABIOS=$DSP_BASE_SABIOS"
 
make -s -C $DSPLINK/dsp/src $1 $MAKE_ARGS_DSP

Notice that the "make" command in the above file has a $1 inside. This is such that you can provide arguments to the build script. For example:

$ ./build_dsplink debug

Invoking the build script as shown above will build only the debug configuration of dsplink. Similarly you could give "clean" or "release" as arguments. Giving no argument at all is the same as specifying "all".

Once you have paths.tcsh and build_dsplink.tcsh configured to point to your codegen and kernel, future updates are very easy:

  1. Install/extract new version of DSPLink
  2. Set DSPLINK environment variable
  3. Run configuration GUI
  4. Copy paths.tcsh and build_dsplink.tcsh to your new DSPLink directory
  5. Execute the build script, build_dsplink.tcsh. You don't need to edit multiple makefiles any more!

Using a Top-Level Makefile

Now that we've shown all the gory details, many of the steps above can be wrapped in an easier-to-use makefile. This section describes that approach. Here are the necessary steps:

1. Install DSPLink: --> dsplink_linux_1_65_##_##/dsplink

2. Download and unpack the following file into the dsplink_linux_1_65_##_##/dsplink folder. File:DSPLink top level makefiles.zip

3. Edit products.mak to specify the install path for the following products.

  • BIOS
  • ARM Code Gen
  • DSPLink
  • Linux Kernel
  • TI Code Gen
  • XDC

4. Check your setup with the following command.

make .show-products

5. Optional. Edit the makefile if you need to change the DSPLink configuration.

6. Build DSPLink and the samples with the following command.

make all