We finally managed to get a simple DSP task node running on our Beagleboard using Android. The sources were taken from felipec’s dsp-dummy at github. Many thanks for sharing this!
In this post we will provide you with a step by step guide for doing the exact same thing:
1. Get the dsp-dummy sources aswell as a C6x compiler and doffbuild tools. Make sure that you get the latest dsp-dummy sources by downloading them with git (the provided ZIP and TAR files may contain older versions)
git clone git://github.com/felipec/dsp-dummy.git
The C6x Compiler for the DSP can be downloaded from Texas Instruments . We have been using the linux version of C6000 Code Generation Tools v6.1.12. Preferably install to /opt/dsptools
Doffbuild tools are downloaded through
git clone git://gitorious.org/ti-dspbridge/userspace.git
You will end up with three subfolders called binaries, documents and source. Doffbuild tools are located in ./source/dsp/bdsptools/packages/ti/dspbridge/dsp/doffbuild. Copy the doffbuild folder to /opt/doffbuild or anywhere you like.
2. Now that we have all needed sources and programs, we will build the ARM and DSP side applications (you may notice that we only build the DSP side though 🙂 ). Change to the dsp-dummy folder previously downloaded and issue
make DSP_TOOLS=/opt/dsptools DSP_DOFFBUILD=/opt/doffbuild CROSS_COMPILE=/opt/arm-2009q3/bin/arm-none-linux-gnueabi-
of course, you will have to adapt CROSS_COMPILE to whatever cross-compiler you are using. If everything went well, there will be two important files created, namely ‘dummy.dll64P’ for DSP-side, and ‘dummy’ for ARM-side. Copy dummy.dll64P to /lib/dsp on the android filesystem. If you try to run dummy on Android, you will end up with an error
dummy: not found
But dont panic, continue with step 3!
(or alternatively, set LDFLAGS to -static in the Makefile, and jump over to step 4… Oh no, now I spoiled everything! 😀 )
3. Now we will build the dummy userspace application especially for Android. In the Android sources, create a new folder under external/dsp-dummy
Copy and paste everything from the dsp-dummy source folder into it. Also create an Android.mk file in that new folder containing the following lines
LOCAL_PATH:= $(call my-dir)
LOCAL_MODULE := dsp-dummy
LOCAL_STATIC_LIBRARIES := libcutils libc
Now source envsetup.sh followed by choosecombo, to set all environment variables and dependecies
… and finally we create the dsp-dummy for Android …
If everything went well, you will find dsp-dummy in ./out/target/product/generic/system/bin/dsp-dummy. Copy this to the target file system.
4. In this step we will load a base image onto the DSP. We used to have DSP Bridge Driver statically included in the android omap.git kernel. One would normally load a base image with a DSP/BIOS Bridge Driver utility called ‘exec’ (sometimes called exec.out). However, until now we couldn’t get exec working on android so we will do this in a slightly different way. One can also load a DSP base image when inserting the bridgedriver.ko module into the kernel, and this is exactly what we’ll do!
First of all run
inside the kernel folder. Go to device drivers, and in the bottom you will find DSP Bridge driver. Press M to modularize it. Now you can try to build the modules with
make -j4 modules CROSS_COMPILE=<path to crosscompiler> CC_PATH=<path to crosscompiler>
However, the bridgedriver module will not succeed. We have to modify a source file in the kernel (this is probably not nice!)
and add the following on line 161; just after the function void __put_task_struct(struct task_struct *tsk) ends.
Now you can build the modules! As a result, you’ll get dspbridge.ko and bridgedriver.ko. Copy these two to the Beagleboard. We will load the dspbridge.ko module using insmod, and also load the bridgedriver.ko with an additional paramter specifying the location of a DSP base image.
insmod bridgedriver.ko base_img=<path to base image>
For the base image we use the provided dynbase_tiomap3430.dof64P, which can be found in the binaries subfolder from step 1 of this guide. Do you still remember? Therefore copy dynbase_tiomap3430.dof64P to the target filesystem and issue the command above.
5. Now you can finally run the dsp-dummy application on Android Beagleboard, what a relief!
info external/dsp-dummy/dummy_arm.c:67:create_node() dsp node created
info external/dsp-dummy/dummy_arm.c:114:run_task() dsp node running
info external/dsp-dummy/dummy_arm.c:124:run_task() running 14400 times
info external/dsp-dummy/dummy_arm.c:161:run_task() dsp node terminated
info external/dsp-dummy/dummy_arm.c:81:destroy_node() dsp node deleted