Guide to Installing DSPLink inside OpenEmbedded using Codec Engine Recipe

Contents:

Introduction to DSPLink

There are multiple options of how to make use of the onboard TI TMS320C64x+ DSP. The first step is to install the GPP/DSP interface. Two of the more popular interface options are DSPBridge and DSPLink. Both were developed by TI but DSPLink is still supported, which makes DSPLink a more preferable option. After selecting DSPLink as the GPP/DSP interface, you need to build DSPLink for your specific platform. There are two options of doing this as well. Both of these options will install DSPLink and also configure your host system so you can compile your own GPP and DSP applications.

  • Building DSPLink inside OpenEmbedded
    This is generally the preferred method. DSPLink can be built using the Codec Engine bitbake recipe. This will install a full version of DSPLink 1.60 in the tmp/staging directory. It will also creates packages to quickly install prebuilt DSPLink sample applications. Further configuration allows you to compile GPP and DSP code.

  • Building DSPLink outside OpenEmbedded
    This method installs DSPLink from source which can be downloaded from TI. Version 1.61.03 is used in the guide. Use this option if you need a newer version of DSPLink than 1.60. Following the steps creates modules to install on the BeagleBoard along with setting up your host system to compile GPP and DSP code.

Although the instructions written at this website were designed around a BeagleBoard which has an OMAP3530 + TMS320C64x+ DSP, the instructions should be compatible across a variety of platforms with only a minimal number of changes.

Introduction to this Guide

OpenEmbedded includes a bitbake recipe to install ti-codec-engine. However, multiple files are needed for this bitbake recipe to complete. This guide will instruct how to get the ti-codec-engine to build successfully for use on the BeagleBoard. The guide expects you to have already built an OpenEmbedded image according to elinux and installed the root file system and uImage onto a formatted SD card.

Once DSPLink has been installed on both your BeagleBoard and your Linux Host System, further configuration is necessary to compile GPP and DSP code. The second half of this guide will show you how to do this.

To start, make sure that you have set the directory environment variable for OpenEmbedded. Replace "oe" to whatever your OpenEmbedded root directory is called.

$ export OE_HOME=$HOME/oe

Downloading and Installing Files

You will need to download and install three binary files: C6x Compiler, DSP/BIOS Link, and XDCtools. Registration at the TI website is needed for all three files and the user license must be accepted.

The latest versions of the three files might work just fine but I have not tested them. The versions I used to get it working, as suggested by various forums, were:

TI frequently updates their site so searching for these files may be required. A newer version of BIOS 5.33.02 should be tested since this version has a Critical 283xx (28x floating point) bug.

Once all three are downloaded, change permissions of each .bin file to make it an executable like such:

$ cd ~/Desktop
$ chmod +x bios_setuplinux_5_33_02.bin

Run the binary file to open a graphical installer

$ ./bios_setuplinux_5_33_02.bin

Do this for all three binaries.

Install the files to a folder TI under your root directory. The installation of each binary file should be located as such:

  • BIOS 5.33.02 -> $HOME/TI/bios_5_33_02
  • XDCtools 3.10.03 -> $HOME/TI/xdctools_3_10_03
  • C6x Compiler -> $HOME/TI/cg6x_6_0_16

Download the codec engine tarball, codec_engine_2_21.tar.gz at https://www-a.ti.com/downloads/sds_support/targetcontent/CE/index.html. Version 2.21 is required by the bitbake recipe. There is no need to untar this file. Copy the file to your tmp/downloads folder and create a md5 checksum.

$ cd ~/Desktop
$ cp codec_engine_2_21.tar.gz $OE_HOME/tmp/downloads
$ md5sum $OE_HOME/tmp/downloads/codec_engine_2_21.tar.gz > $OE_HOME/tmp/downloads/codec_engine_2_21.tar.gz.md5

Changing Configuration Settings

Open ti-paths.inc which is also located under the dsplink recipe directory.

$ gedit $OE_HOME/beagleboard/beagleboard/conf/local.conf

Add the following lines of code to the bottom of the file. Version numbers and directory locations should be adjusted accordingly if using. In the line TITOOLSDIR = "/home/user/TI", change "user" to whatever your username is.

# Path to the dir where the TI tools are unpacked
TITOOLSDIR = "/home/user/TI"
# Path under TITOOLSDIR where dspbios is unpacked
TIBIOSDIR = "bios_5_33_02"
TIXDCTOOLSDIR = "${TITOOLSDIR}/xdctools_3_10_03"
# Path under TITOOLSDIR where the dsp toolchain is unpacked
TICGTOOLSDIR = "cg6x_6_0_16"

Bitbake and Install

Now enter openembedded shell, update, and bitbake ti-codec-engine

$ source $OE_HOME/beagleboard/beagleboard/profile.sh
$ cd $OE_HOME
$ git checkout origin/stable/2009 -b stable/2009
$ git pull
$ bitbake ti-codec-engine

Bitbake should complete successfully. Once completed, the following packages are added to $OE_HOME/tmp/deploy/glibc/ipk/beagleboard directory:

  • ti-cmem-module_221-r19.1_beagleboard.ipk
  • ti-lpm-module_221-r19.1_beagleboard.ipk
  • ti-sdma-module_221-r19.1_beagleboard.ipk
  • ti-codec-engine-apps_221-r19.1_beagleboard.ipk
  • ti-codec-engine-dbg_221-r19.1_beagleboard.ipk
  • ti-codec-engine-dev_221-r19.1_beagleboard.ipk
  • ti-dsplink-apps_221-r19.1_beagleboard.ipk
  • ti-dsplink-module_221-r19.1_beagleboard.ipk

Copy these files to the the rfs of the BeagleBoard and use opkg to install them. There may be a correct order of installing the files to avoid the warnings of "ti-codec-engine-xxx: unsatisfied recommendation for xxx". Install all 8 packages.

# opkg install ti-cmem-module_221-r19.1_beagleboard.ipk

BeagleBoard Configuration



Memory settings need to be adjusted on the BeagleBoard. Reset the board and stop the board from autobooting by pressing any key. Insert the following commands and save the environment. This will set the kernel memory to 80MB which leaves 48MB for DSPLink, CMEM, and DDRALGHEAP. Reset the board once finished.
OMAP3 beagleboard.org # setenv bootargs 'console=ttyS2,115200n8 console=tty0 root=/dev/mmcblk0p2 rw rootwait rootdelay=2 mem=80M video=omapfb:vram:2M,vram:4M'
OMAP3 beagleboard.org # saveenv
OMAP3 beagleboard.org # reset

Starting DSPLink

Additionally, you will need to install the DSPLink kernel module every time you reboot the BeagleBoard. There are two scripts at /usr/share/ti-dsplink with the option of either loading or unloading the modules.

root@beagleboard:~# cd /usr/share/ti-dsplink
root@beagleboard:/usr/share/ti-dsplink# ./loadmodules-ti-dsplink-apps.sh
You have 60916kB total memory for Linux
[ 663.001068] DSPLINK Module (1.60) created on Date: Jun 15 2009 Time: 17:38:41

Instead of loading the modules manually every time on reboot, you can instruct the BeagleBoard to load the modules on startup.

root@beagleboard:~# cp /usr/share/ti-dsplink/loadmodules-ti-dsplink-apps.sh /etc/init.d/
root@beagleboard:~# cd /etc/init.d/
root@beagleboard:~# update-rc.d loadmodules-ti-dsplink-apps.sh defaults
Adding system startup for /etc/init.d/loadmodules-ti-dsplink-apps.sh.

Using "defaults" start the service in runlevels 2345 and to stop the service in runlevels 016. Please see the update-rc.d man page for more information on this command.

Sample Applications

Once installed, there are some sample applications provided that can be used to test the installation. They are also located in /usr/share/ti-dsplink. Please see the DSPLink programmers guide for more information on each application.

Note: There is an option for DSPLink to save past instructions in cache memory which can cause issues if the user is not aware of it. If the user loads an application, that application will be stored in cache. The user can rerun that same application multiple times. If the user tries to load a different application, the second application will fail since the first application is still in cache. Therefore, you can use lpmOFF and lpmON to reset the DSP which will clear the cache. Another option would be to disable the cache feature altogether during DSPLink build.

messagegpp

Messagegpp is a simple application that transfers a user defined amount of messages. It expects the user to start the application in the following format:
messagegpp <absolute path of DSP executable> <number of transfers> <DSP Processor Id>
The following contains test arguments and the resulting output.

root@beagleboard:/usr/share/ti-dsplink# lpmON.x470uC
root@beagleboard:/usr/share/ti-dsplink# lpmOFF.x470uC
root@beagleboard:/usr/share/ti-dsplink# messagegpp message.out 1000
========== Sample Application : MESSAGE ==========
Entered MESSAGE_Create ()
Leaving MESSAGE_Create ()
Entered MESSAGE_Execute ()
Transferred 100 messages
Transferred 200 messages
Transferred 300 messages
Transferred 400 messages
Transferred 500 messages
Transferred 600 messages
Transferred 700 messages
Transferred 800 messages
Transferred 900 messages
Transferred 1000 messages
Leaving MESSAGE_Execute ()
Entered MESSAGE_Delete ()
Leaving MESSAGE_Delete ()
====================================================

ringio_gpp

Ringiogpp provides Ring Buffer based data streaming between the GPP and DSP. It expects the user to start the application in the following format:
Usage : ./ring_iogpp <absolute path of DSP executable> <RingIO data Buffer Size in bytes> <number of bytes to transfer><DSP Processor Id>
The following contains test arguments and the resulting output.

root@beagleboard:/usr/share/ti-dsplink# lpmON.x470uC
root@beagleboard:/usr/share/ti-dsplink# lpmOFF.x470uC
root@beagleboard:/usr/share/ti-dsplink# ./ring_iogpp ringio.out 1024 4096
========== Sample Application : RING_IO ==========
Bytes to transfer :4096
Data buffer size :1024
Entered RING_IO_Create ()
Leaving RING_IO_Create ()
Entered RING_IO_WriterClient ()
GPP-->DSP:Sent Data Transfer Start Attribute
Entered RING_IO_ReaderClient ()
GPP-->DSP:Sent Data Transfer Start Notification
GPP<--DSP:Received Data TransferStart Attribute
GPP-->DSP:Total Bytes Transmitted 4096
RingIO_setAttribute succeeded to set the RINGIO_DATA_END. Status = [0x8100]
GPP-->DSP:Sent Data Transfer End Attribute
GPP-->DSP:Sent Data Transfer End Notification
Leaving RING_IO_WriterClient ()
GPP<--DSP:Received Data TransferEnd Attribute
GPP<--DSP:Bytes Received 4096
GPP<--DSP:Received Data Transfer End Notification
Leaving RING_IO_ReaderClient ()
Entered RING_IO_Delete ()
Leaving RING_IO_Delete ()
====================================================

mpcsxfergpp

Mpcsxfergpp provides data transfer between the GPP and DSP through shared buffers with mutually exclusive access protection. It expects the user to start the application in the following format:
Usage : ./mpcsxfergpp <absolute path of DSP executable> <Buffer Size> <number of transfers> <DSP ProcessorId>
The following contains test arguments and the resulting output.

root@beagleboard:/usr/share/ti-dsplink# lpmON.x470uC
root@beagleboard:/usr/share/ti-dsplink# lpmOFF.x470uC
root@beagleboard:/usr/share/ti-dsplink# ./mpcsxfergpp mpcsxfer.out 1024 1000
========== Sample Application : MPCSXFER ==========
Entered MPCSXFER_Create ()
Leaving MPCSXFER_Create ()
Entered MPCSXFER_Execute ()
GPP->DSP: Transferred 100 buffers
DSP->GPP: Transferred 100 buffers
GPP->DSP: Transferred 200 buffers
DSP->GPP: Transferred 200 buffers
GPP->DSP: Transferred 300 buffers
DSP->GPP: Transferred 300 buffers
GPP->DSP: Transferred 400 buffers
DSP->GPP: Transferred 400 buffers
GPP->DSP: Transferred 500 buffers
DSP->GPP: Transferred 500 buffers
GPP->DSP: Transferred 600 buffers
DSP->GPP: Transferred 600 buffers
GPP->DSP: Transferred 700 buffers
DSP->GPP: Transferred 700 buffers
GPP->DSP: Transferred 800 buffers
DSP->GPP: Transferred 800 buffers
GPP->DSP: Transferred 900 buffers
DSP->GPP: Transferred 900 buffers
GPP->DSP: Transferred 1000 buffers
DSP->GPP: Transferred 1000 buffers
Leaving MPCSXFER_Execute ()
Entered MPCSXFER_Delete ()
Leaving MPCSXFER_Delete ()
====================================================

Compiling GPP and DSP Applications

After following the first half of this guide, you will have installed a full version of DSPLink 1.60.0 on your host machine. It is located inside your oe directory at

$HOME/oe/tmp/staging/beagleboard-angstrom-linux-gnueabi/ti-codec-engine/cetools/packages/dsplink

To command line compile the sample applications located in this directory, you will need edit two makefiles. In the makefiles, you will link to the tools you have already installed including the C64+ Compiler, the XDCTools, and DSP/BIOS. Additionally, you will link to files within the OpenEmbedded directory such as the omap3530 cross compilers and the OE kernel.

If you are looking to develop your own DSP applications, it is highly suggested to start off with one of the sample applications provided by TI. It has much of the low level framework already in place including initializing the DSP, allocating buffers, transferring messages, etc. Therefore, research which sample application would most fit the needs of your project and begin with that. You can read about each sample application in the Sample Applications section of the TI User Guide located in the docs folder.

When working with DSPLink, it is necessary to set an environment variable for the DSPLink directory. You can use the second optional command to add it to your default terminal shell.

$ export DSPLINK=$HOME/oe/tmp/staging/beagleboard-angstrom-linux-gnueabi/ti-codec-engine/cetools/packages/dsplink
$ echo export DSPLINK=$HOME/oe/tmp/staging/beagleboard-angstrom-linux-gnueabi/ti-codec-engine/cetools/packages/dsplink >>$HOME/.bashrc

Configuring Makefiles

There are a number of directories DSPLink looks for when compiling. To tell DSPLink where to find these, there are two make files that need to be tailored to your environment. The two files that need to be changed are:

  • GPP side distribution file: $DSPLINK/make/Linux/omap3530_2.6.mk
  • DSP side distribution file: $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk


If you have followed the previous steps of installing all other files without changing the directory locations, you can use the custom versions of these files I created. They are attached to the bottom of this wiki. They can be found at the bottom of the wiki. It would be best to not replace your existing files with the wiki's files but instead, compare the two files and note the differences. If any folder locations do not match up with the setup of your files, fix the links.

There is one change needed in the omap3530_2.6.mk makefile that is not as straightforward as the others. You need to add additional options to STD_KRNL_FLAGS which will make it properly link to ARM kernel header files such as memory.h and IO.h. Edit STD_KRNL_FLAGS to the following: STD_KRNL_FLAGS := -c -nostdinc -include $(BASE_OSINC)/linux/autoconf.h -isystem $(OSINC_PLATFORM) -D__KERNEL__ -Iinclude -I$(BASE_BUILDOS)/arch/arm/include \
-mlittle-endian -I$(BASE_OSINC)/../arch/arm/mach-omap2/include -I$(BASE_OSINC)/../arch/arm/plat-omap/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common -Os -marm -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 \
-march=armv7-a -msoft-float -Uarm -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fno-stack-protector -Wdeclaration-after-statement -Wno-pointer-sign \
-g -DUSE_UDEV=1 -DOS_LINUX -DLINUX_KERNEL

Building DSPLink Files

Everything should now be set up to compile your sample applications. To do this, you will need to compile the GPP source API, the GPP/DSP source code, and the GPP/DSP samples. If you receive any errors, check your three makefiles for the correct directory locations.

$ cd $DSPLINK/gpp/src/api
$ make -s clean
$ make -s debug
$ make -s release
$ cd $DSPLINK/gpp/src
$ make -s clean
$ make -s debug
$ make -s release
$ cd $DSPLINK/gpp/src/samples
$ make -s clean
$ make -s debug
$ make -s release
$ cd $DSPLINK/dsp/src
$ make -s clean
$ make -s debug
$ make -s release
$ cd $DSPLINK/dsp/src/samples
$ make -s clean
$ make -s debug
$ make -s release

The GPP side executables will now be in $DSPLINK/gpp/export/BIN/Linux/OMAP3530 and the DSP side executables will be in $DSPLINK/dsp/export/BIN/DspBios/OMAP3530/OMAP3530_0. Both DEBUG and RELEASE executables are built. Also, a dsplinkk.ko module has been built which you can replace the existing module. Make a backup of the existing module. Copy these files to your target. In the code below, I have copied the DEBUG version of the dsplinkk.ko only and only the message executable. Also copy over any other sample applications you would like to test out such as ringio and loop.

$ mkdir ~/TI/moduleBackups
$ sudo cp <target>/lib/modules/2.6.29-omap1/kernel/drivers/dsp/dsplinkk.ko ~/TI/moduleBackups
$ sudo rm <target>/lib/modules/2.6.29-omap1/kernel/drivers/dsp/dsplinkk.ko
$ sudo cp $DSPLINK/gpp/export/BIN/Linux/OMAP3530/DEBUG/dsplinkk.ko <target>/lib/modules/2.6.29-omap1/kernel/drivers/dsp/
$ sudo mkdir <target>/usr/share/ti-dsplink/cmd_compiled
$ sudo mkdir <target>/usr/share/ti-dsplink/cmd_compiled/DEBUG
$ sudo mkdir <target>/usr/share/ti-dsplink/cmd_compiled/RELEASE
$ sudo cp $DSPLINK/gpp/export/BIN/Linux/OMAP3530/DEBUG/messagegpp <target>/usr/share/ti-dsplink/cmd_compiled/DEBUG
$ sudo cp $DSPLINK/gpp/export/BIN/Linux/OMAP3530/RELEASE/messagegpp <target>/usr/share/ti-dsplink/cmd_compiled/RELEASE
$ sudo cp $DSPLINK/dsp/export/BIN/DspBios/OMAP3530/OMAP3530_0/DEBUG/message.out <target>/usr/share/ti-dsplink/cmd_compiled/DEBUG
$ sudo cp $DSPLINK/dsp/export/BIN/DspBios/OMAP3530/OMAP3530_0/RELEASE/message.out <target>/usr/share/ti-dsplink/cmd_compiled/RELEASE

Note: The sample application "loop" will not successfully compile because Channels are not defined to be used in the build configuration. You will need to reconfigure your build to include channels. See the TI Install Guide for more information on how to do this.

External Links

For more information, see:
http://elinux.org/BeagleBoard/DSP_Howto
https://gstreamer.ti.com/gf/project/gstreamer_ti/wiki/?pagename=BuildingWithAngstrom
http://groups.google.com/group/beagleboard/browse_thread/thread/3d2560c087941100
http://www.pixhawk.ethz.ch/wiki/tutorials/omap/dsplink

Attachments




注:Guide to Installing DSPLink inside OpenEmbedded using Codec Engine Recipe(原文出处,翻译整理仅供参考!