Difference between revisions of "BeagleBoard/DSP Howto"

From eLinux.org
Jump to: navigation, search
(gst-openmax: Add autogen instructions.)
(add dsp tools)
 
(64 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
[[Category: Linux]]
 
[[Category: Linux]]
 
[[Category: OMAP]]
 
[[Category: OMAP]]
This article explains how to use the DSP in [http://focus.ti.com/general/docs/gencontent.tsp?contentId=36915&DCMP=OMAP_Feb27_2008&HQS=Other+PR+omap3503pr OMAP3] at [[BeagleBoard|BeagleBoard]] with TI's deliverables. For DSP tool chain see [[BeagleBoard#C64x.2B_DSP|C64x+ DSP]].
+
 
 +
This article explains how to use the DSP in [http://focus.ti.com/general/docs/gencontent.tsp?contentId=36915&DCMP=OMAP_Feb27_2008&HQS=Other+PR+omap3503pr OMAP3] at [[BeagleBoard|BeagleBoard]] using the [[BeagleBoard/DSP_Clarification#dsp-bridge|bridge driver]] kernel module. For DSP tool chain see [[BeagleBoard#C64x.2B_DSP|C64x+ DSP]].
 +
 
 +
DSP Bridge driver provides features to control and communicate with DSP enabling parallel processing for multimedia acceleration. It enables the applications running on MPU to offload the processing to DSP [http://omappedia.org/wiki/DSPBridge_Project#About_DSP_Bridge].
 +
 
 +
Some of the key features of DSP Bridge are:
 +
 
 +
* ''Messaging'': Ability to exchange fixed size control messages with DSP
 +
* ''Dynamic memory management'': Ability to dynamically map files to DSP address space
 +
* ''Dynamic loading'': Ability to dynamically load new nodes on DSP at run time
 +
* ''Power Management'': Static and dynamic power management for DSP
 +
 
  
 
= Setup =
 
= Setup =
 +
 +
In order to enable the DSP in your OMAP3 the procedure is two-fold:
 +
 +
* GPP side (ARM side): Enable the bridge driver kernel module.
 +
* DSP side: Set the required files in the filesystem.
 +
** Most of these files are, right now, TI's proprietary binaries.
  
 
== Kernel driver ==
 
== Kernel driver ==
  
In order to use the DSP you would need TI's bridgedriver module on the kernel. For that you would need Hiroshi's [http://4869037.web.fc2.com/tidspbridge-20080922.tgz patches] on top of linux-omap:
+
<div id="deprecated">
 +
In order to use the DSP you would need TI's [[BeagleBoard/DSP_Clarification#dsp-bridge|bridgedriver]] module on the kernel. You can use the linux-omap repository's branch at kernel.org:
  
<code>
+
  git clone git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git
  git clone http://www.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git
 
 
  cd linux-omap-2.6
 
  cd linux-omap-2.6
  wget http://4869037.web.fc2.com/tidspbridge-20080922.tgz
+
  git checkout -b dspbridge orgin/dspbridge
  tar xvzf tidspbridge-20080922.tgz
+
</div>
  git am *.patch
+
 
  make omap3_beagle_defconfig
+
Since Jun of 2010 or so, the DSP/Bridge driver development was moved to the linux-staging repository, in order to speed up its integration to the linus's repository:
</code>
+
 
 +
git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-next-2.6.git
 +
cd staging-next-2.6
 +
git checkout -b dspbridge origin/staging-next
 +
 
 +
Warning: '''This module currently is under heavy development'''. If you want be updated you should pull for changes weekly or so. Besides, this how-to could be already deprecated.
 +
 
 +
For convenience we could export the architecture environment variable, otherwise we must set it as a <tt>make</tt> argument:
 +
 
 +
  export ARCH=arm
 +
 
 +
The default configuration for the beagle board doesn't enable de bridgedriver. You should build you own using
 +
 
 +
  make menuconfig
 +
 
 +
or fetching the one used in [http://gitorious.org/vjaquez-beagleboard/marmita marmita]:
 +
 
 +
  wget http://gitorious.org/vjaquez-beagleboard/marmita/blobs/raw/master/meta-marmita/linux/linux-omap-bridgedriver/defconfig -O .config
 +
 
 +
If you want DSS2 support for the Beagleboard, you should apply this patch in your kernel code: https://patchwork.kernel.org/patch/94049/
 +
 
 +
  wget -q https://patchwork.kernel.org/patch/94049/mbox/ -O - | git am --3way
 +
 
 +
Then build the '''uImage''' as usual and install the modules on your rootfs:
 +
 
 +
make oldconfig
 +
make
 +
make uImage
 +
  make INSTALL_MOD_PATH=/media/rootfs modules_install
 +
 
 +
== TI's DSP binaries ==
 +
 
 +
In order to get the DSP binaries for multimedia processing you need to download them from [http://omappedia.org/wiki/OpenMAX_Project TI's OpenMAX IL project]. The most important binary is <code>baseimage.dof</code>, which is the BIOS image to be loaded into the DSP.
 +
 
 +
The latests release of these binaries for mainstream Linux is '''v3.09''' for L23.i3.3.
 +
 
 +
Most of the public releases are published in TI's [https://gforge.ti.com/gf/project/openmax/frs/ gforge].
  
Then <code>make menuconfig</code> and add the following options in the menuconfig:
+
=== v3.09 ===
<pre>
 
CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE=14
 
CONFIG_MPU_BRIDGE=m
 
</pre>
 
  
== TI binaries ==
+
Download the binary package and extract its content:
  
In order to get the DSP binaries for multimedia processing you need to download TI's OpenMAX IL [https://omapzoom.org/gf/download/frsrelease/111/396/tiopenmax-0.3.tar.gz package]. Once you have extracted the tarball you'll have to run the installer ''TI-OMX-Sample-Firmware-0.3-Linux-x86-Install'' and accept the license agreement.
+
wget --no-check-certificate https://gforge.ti.com/gf/download/frsrelease/285/3260/DSPbinaries-3.09-Linux-x86-Install
 +
chmod +x ./DSPbinaries-3.09-Linux-x86-Install
 +
./DSPbinaries-3.09-Linux-x86-Install --mode console --prefix /tmp
  
You would end up with a bunch of binaries in <code>lib/dsp</code>, copy them to your root filesystem at the same location (/lib/dsp).
+
Then copy those binaries into the directory <code>lib/dsp</code> in your root filesystem (<code>/media/rootfs</code> is assumed here):
  
== OpenMAX IL ==
+
mkdir /media/rootfs/lib/dsp
 +
cp /tmp/Binaries/* /media/rootfs/lib/dsp
  
The easiest way to use the DSP capabilities is through the [http://www.khronos.org/openmax/ OpenMAX IL] API, but in order to compile TI's implementation a special DSP library is required.
+
=== v0.3.5 ===
  
=== libdspbridge ===
+
wget --no-check-certificate https://gforge.ti.com/gf/download/frsrelease/170/1399/tiopenmax-0.3.5.tar.gz
 +
tar xvf ./tiopenmax-0.3.5.tar.gz
 +
cd tiopenmax-0.3.5
 +
./TI-OMX-Sample-Firmware-0.3.5-Linux-x86-Install
  
git clone git://github.com/felipec/libdspbridge.git
+
Accept the license agreement and copy the binaries into the directory <code>lib/dsp</code> in your root filesystem:
cd libdspbridge
 
make DESTDIR='''rootfs''' install
 
  
=== libomxil-ti ===
+
mkdir /media/rootfs/lib/dsp
 +
cp ./lib/dsp/* /media/rootfs/lib/dsp
  
git clone git://github.com/felipec/libomxil-ti.git
+
=== v0.3 ===
cd libomxil-ti
 
make BRIDGE_CFLAGS=-I../'''libdspbridge'''/inc BRIDGE_LIBS=-L../'''libdspbridge'''/lib DESTDIR='''rootfs''' install
 
  
== gst-openmax ==
+
wget --no-check-certificate https://gforge.ti.com/gf/download/frsrelease/111/396/tiopenmax-0.3.tar.gz
 +
tar xvf ./tiopenmax-0.3.tar.gz
 +
cd tiopenmax-0.3
 +
./TI-OMX-Sample-Firmware-0.3-Linux-x86-Install
  
You would need to compile gst-openmax inside scratchbox:
+
Accept the license agreement and copy the binaries into the directory <code>lib/dsp</code> in your root filesystem:
  
  git clone git://github.com/felipec/gst-openmax.git
+
  mkdir /media/rootfs/lib/dsp
cd gst-openmax
+
  cp ./lib/dsp/* /media/rootfs/lib/dsp
  ./autogen.sh --noconfigure
 
./configure --prefix=/usr
 
make DESTDIR='''rootfs''' install
 
  
 
= Running =
 
= Running =
  
On the board use this to load the module:
+
On the board use these commands to load the module:
  
 +
modprobe mailbox
 
  modprobe bridgedriver base_img=/lib/dsp/baseimage.dof
 
  modprobe bridgedriver base_img=/lib/dsp/baseimage.dof
  
You should be able to use the gst-openmax elements now:
+
== ping test ==
 +
 
 +
If you want to test the DSP you can try the simple ping test provided in this [https://omapzoom.org/gf/download/frsrelease/132/632/dspbridge_binaries.tar.bz2 package]. The package provide a set of already compiled tests, either for ARM-side and DSP-side.
 +
 
 +
Installing shortcut:
 +
 
 +
# ARM-side app
 +
wget "http://dev.omapzoom.org/?p=tidspbridge/userspace-dspbridge.git;a=blob_plain;f=binaries/ping.out;hb=HEAD" -O ping.out
 +
chmod +x ping.out
 +
cp ping.out /media/rootfs
 +
 
 +
# DSP-side socket node
 +
wget "http://dev.omapzoom.org/?p=tidspbridge/userspace-dspbridge.git;a=blob_plain;f=binaries/pingdyn_3430.dll64P;hb=HEAD" -O pingdyn_3430.dll64P
 +
cp pingdyn_3430.dll64P /media/rootfs/lib/dsp
 +
 
 +
In the board just:
 +
 
 +
./ping.out
 +
 
 +
If you get an error like:
 +
DSPNode_Allocate failed: 0x80008008
 +
 
 +
Then it's possible that the ping DSP socket node is not loaded. If you use 'baseimage.dof' you need to load it dynamically:
 +
 
 +
./dynreg.out -r pingdyn_3430.dll64P
 +
 
 +
= Developing =
 +
 
 +
There are two ways to compile your own DSP nodes:
 +
 
 +
* The official one, which requires DSP/BIOS and RTSC/XDC tools
 +
* The simplified one (used by [[User:Felipec|Felipe Contreras]])
 +
 
 +
But either way, you will need the TI's DSP toolchain: [https://www-a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm C6x compiler CGT 6.0.22] (Code Generation Tools). Please note that you might be required to register to gain access to those files.
 +
 
 +
This HOWTO assumes that the DSP toolchain are installed under <code>/opt/dsp/cgt6x-6.0.22</code>.
 +
 
 +
== Official ==
 +
 
 +
These instructions are taken from [http://omappedia.org/wiki/DSPBridge_Project#Build_Userspace_Files DSPBridge project] wiki page at [http://omappedia.org/ omapedia].
 +
 
 +
=== Install build dependencies ===
 +
 
 +
* [http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent/bios/index.html DSP/BIOS] 5.33.04
 +
* [https://www-a.ti.com/downloads/sds_support/targetcontent/index.html RTSC/XDCtools] 3.10.02
 +
 
 +
Also, here is assumed that those packages are installed in <code>/opt/dsp</code>.
 +
 
 +
=== Building the user space binaries ===
 +
 
 +
git clone git://dev.omapzoom.org/pub/scm/tidspbridge/userspace-dspbridge.git
 +
cd userpace-dspbridge
 +
 
 +
Edit "product.mak" to match the version of your tools.
 +
 
 +
<code>
 +
# DSP BIOS
 +
SABIOS_VER  = 5.33.04
 +
SABIOS_VER_2 = 5_33_04
 +
 
 +
# CodeGen Tools
 +
CGT55_VER = 3.2.2
 +
CGT6X_VER = 6.0.22
 +
</code>
 +
 
 +
Then run:
 +
 
 +
make .dsp DD_XDCDIR=/opt/dsp/xdctools_3_10_02 SABIOS_DIR=/opt/dsp/bios_5_33_04/packages DEPOT=/opt/dsp
 +
 
 +
Other make options:
 +
 
 +
make clean    # clean all
 +
make all      # clean, compile and install all
 +
make .api      # clean, compile and install API only
 +
make .samples  # clean, compile and install samples only
 +
make .dsp      # clean, compile and install DSP binaires only
 +
 
 +
The output will be installed under <code>userpace-dspbridge/source/target</code>
 +
 
 +
== Simplified ==
 +
 
 +
In this mode we will only need the DSP toolchains and the doffbuild tools. In this case, the test C6x compiler version is '''v6.1.7''' or greater.
 +
 
 +
=== doffbuild tools ===
 +
 
 +
The only relevant tool is DLLcreate, which can be found in the userspace-dpsbridge repository, but we can only extract what we need in this way:
 +
 
 +
mkdir -p /opt/doffbuild/bin
 +
cd /opt
 +
wget -q "http://dev.omapzoom.org/?p=tidspbridge/userspace-dspbridge.git;a=blob_plain;f=source/dsp/bdsptools/bridge-tools.tar;hb=HEAD" -O - \
 +
    | tar xf - --strip-components 3 --wildcards ti/dspbridge/dsp/doffbuild/bin/*
 +
 
 +
=== DSP nodes samples ===
 +
 
 +
Here is a couple of [http://gitorious.org/vjaquez-beagleboard/dsp-samples DSP node samples] built using the simplified approach.
 +
 
 +
* '''dummy''' passes buffers back and forth
 +
* '''ping''' sends messages and waits for replies
 +
 
 +
git clone git://gitorious.org/vjaquez-beagleboard/dsp-samples.git
 +
make DSP_TOOLS=/opt/dsp/cgt6x-6.0.22 DSP_DOFFBUILD=/opt/doffbuild
 +
make install DESTDIR=/media/rootfs
 +
 
 +
Now you can run the '''dummy''' and the '''ping''' test applications.
 +
 
 +
= Further information =
 +
 
 +
# [http://omappedia.org/wiki/DSPBridge_Project DSP Bridge wiki page at Omappedia]
 +
# [https://gforge.ti.com/gf/project/omapbridge/docman/?subdir=3 Official OMAP DSP Bridge documentation]
 +
 
 +
= See also =
  
gst-launch-0.10 filesrc location="foobar.avi" ! avidemux ! omx_mpeg4dec ! omapfbsink
+
* [[BeagleBoard/dsp-tools]]
 +
* [[BeagleBoard/gst-dsp]]
 +
* [[BeagleBoard/gst-openmax]]

Latest revision as of 10:33, 13 August 2010


This article explains how to use the DSP in OMAP3 at BeagleBoard using the bridge driver kernel module. For DSP tool chain see C64x+ DSP.

DSP Bridge driver provides features to control and communicate with DSP enabling parallel processing for multimedia acceleration. It enables the applications running on MPU to offload the processing to DSP [1].

Some of the key features of DSP Bridge are:

  • Messaging: Ability to exchange fixed size control messages with DSP
  • Dynamic memory management: Ability to dynamically map files to DSP address space
  • Dynamic loading: Ability to dynamically load new nodes on DSP at run time
  • Power Management: Static and dynamic power management for DSP


Setup

In order to enable the DSP in your OMAP3 the procedure is two-fold:

  • GPP side (ARM side): Enable the bridge driver kernel module.
  • DSP side: Set the required files in the filesystem.
    • Most of these files are, right now, TI's proprietary binaries.

Kernel driver

In order to use the DSP you would need TI's bridgedriver module on the kernel. You can use the linux-omap repository's branch at kernel.org:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git
cd linux-omap-2.6
git checkout -b dspbridge orgin/dspbridge

Since Jun of 2010 or so, the DSP/Bridge driver development was moved to the linux-staging repository, in order to speed up its integration to the linus's repository:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-next-2.6.git
cd staging-next-2.6
git checkout -b dspbridge origin/staging-next

Warning: This module currently is under heavy development. If you want be updated you should pull for changes weekly or so. Besides, this how-to could be already deprecated.

For convenience we could export the architecture environment variable, otherwise we must set it as a make argument:

 export ARCH=arm 

The default configuration for the beagle board doesn't enable de bridgedriver. You should build you own using

 make menuconfig

or fetching the one used in marmita:

wget http://gitorious.org/vjaquez-beagleboard/marmita/blobs/raw/master/meta-marmita/linux/linux-omap-bridgedriver/defconfig -O .config

If you want DSS2 support for the Beagleboard, you should apply this patch in your kernel code: https://patchwork.kernel.org/patch/94049/

wget -q https://patchwork.kernel.org/patch/94049/mbox/ -O - | git am --3way

Then build the uImage as usual and install the modules on your rootfs:

make oldconfig
make
make uImage
make INSTALL_MOD_PATH=/media/rootfs modules_install

TI's DSP binaries

In order to get the DSP binaries for multimedia processing you need to download them from TI's OpenMAX IL project. The most important binary is baseimage.dof, which is the BIOS image to be loaded into the DSP.

The latests release of these binaries for mainstream Linux is v3.09 for L23.i3.3.

Most of the public releases are published in TI's gforge.

v3.09

Download the binary package and extract its content:

wget --no-check-certificate https://gforge.ti.com/gf/download/frsrelease/285/3260/DSPbinaries-3.09-Linux-x86-Install
chmod +x ./DSPbinaries-3.09-Linux-x86-Install
./DSPbinaries-3.09-Linux-x86-Install  --mode console --prefix /tmp

Then copy those binaries into the directory lib/dsp in your root filesystem (/media/rootfs is assumed here):

mkdir /media/rootfs/lib/dsp
cp /tmp/Binaries/* /media/rootfs/lib/dsp

v0.3.5

wget --no-check-certificate https://gforge.ti.com/gf/download/frsrelease/170/1399/tiopenmax-0.3.5.tar.gz
tar xvf ./tiopenmax-0.3.5.tar.gz
cd tiopenmax-0.3.5
./TI-OMX-Sample-Firmware-0.3.5-Linux-x86-Install

Accept the license agreement and copy the binaries into the directory lib/dsp in your root filesystem:

mkdir /media/rootfs/lib/dsp
cp ./lib/dsp/* /media/rootfs/lib/dsp

v0.3

wget --no-check-certificate https://gforge.ti.com/gf/download/frsrelease/111/396/tiopenmax-0.3.tar.gz
tar xvf ./tiopenmax-0.3.tar.gz
cd tiopenmax-0.3
./TI-OMX-Sample-Firmware-0.3-Linux-x86-Install

Accept the license agreement and copy the binaries into the directory lib/dsp in your root filesystem:

mkdir /media/rootfs/lib/dsp
cp ./lib/dsp/* /media/rootfs/lib/dsp

Running

On the board use these commands to load the module:

modprobe mailbox
modprobe bridgedriver base_img=/lib/dsp/baseimage.dof

ping test

If you want to test the DSP you can try the simple ping test provided in this package. The package provide a set of already compiled tests, either for ARM-side and DSP-side.

Installing shortcut:

# ARM-side app
wget "http://dev.omapzoom.org/?p=tidspbridge/userspace-dspbridge.git;a=blob_plain;f=binaries/ping.out;hb=HEAD" -O ping.out
chmod +x ping.out
cp ping.out /media/rootfs
# DSP-side socket node
wget "http://dev.omapzoom.org/?p=tidspbridge/userspace-dspbridge.git;a=blob_plain;f=binaries/pingdyn_3430.dll64P;hb=HEAD" -O pingdyn_3430.dll64P
cp pingdyn_3430.dll64P /media/rootfs/lib/dsp 

In the board just:

./ping.out

If you get an error like:

DSPNode_Allocate failed: 0x80008008

Then it's possible that the ping DSP socket node is not loaded. If you use 'baseimage.dof' you need to load it dynamically:

./dynreg.out -r pingdyn_3430.dll64P

Developing

There are two ways to compile your own DSP nodes:

  • The official one, which requires DSP/BIOS and RTSC/XDC tools
  • The simplified one (used by Felipe Contreras)

But either way, you will need the TI's DSP toolchain: C6x compiler CGT 6.0.22 (Code Generation Tools). Please note that you might be required to register to gain access to those files.

This HOWTO assumes that the DSP toolchain are installed under /opt/dsp/cgt6x-6.0.22.

Official

These instructions are taken from DSPBridge project wiki page at omapedia.

Install build dependencies

Also, here is assumed that those packages are installed in /opt/dsp.

Building the user space binaries

git clone git://dev.omapzoom.org/pub/scm/tidspbridge/userspace-dspbridge.git
cd userpace-dspbridge

Edit "product.mak" to match the version of your tools.

# DSP BIOS
SABIOS_VER   = 5.33.04
SABIOS_VER_2 = 5_33_04
# CodeGen Tools
CGT55_VER = 3.2.2
CGT6X_VER = 6.0.22

Then run:

make .dsp DD_XDCDIR=/opt/dsp/xdctools_3_10_02 SABIOS_DIR=/opt/dsp/bios_5_33_04/packages DEPOT=/opt/dsp

Other make options:

make clean     # clean all
make all       # clean, compile and install all
make .api      # clean, compile and install API only
make .samples  # clean, compile and install samples only
make .dsp      # clean, compile and install DSP binaires only

The output will be installed under userpace-dspbridge/source/target

Simplified

In this mode we will only need the DSP toolchains and the doffbuild tools. In this case, the test C6x compiler version is v6.1.7 or greater.

doffbuild tools

The only relevant tool is DLLcreate, which can be found in the userspace-dpsbridge repository, but we can only extract what we need in this way:

mkdir -p /opt/doffbuild/bin
cd /opt
wget -q "http://dev.omapzoom.org/?p=tidspbridge/userspace-dspbridge.git;a=blob_plain;f=source/dsp/bdsptools/bridge-tools.tar;hb=HEAD" -O - \
    | tar xf - --strip-components 3 --wildcards ti/dspbridge/dsp/doffbuild/bin/*

DSP nodes samples

Here is a couple of DSP node samples built using the simplified approach.

  • dummy passes buffers back and forth
  • ping sends messages and waits for replies
git clone git://gitorious.org/vjaquez-beagleboard/dsp-samples.git
make DSP_TOOLS=/opt/dsp/cgt6x-6.0.22 DSP_DOFFBUILD=/opt/doffbuild
make install DESTDIR=/media/rootfs

Now you can run the dummy and the ping test applications.

Further information

  1. DSP Bridge wiki page at Omappedia
  2. Official OMAP DSP Bridge documentation

See also