DSP on Beagleboard running Android

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

mkdir /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)
include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
 dummy_arm.c \
 dsp_bridge.c \
 log.c

LOCAL_C_INCLUDES:= external/dsp-dummy/

LOCAL_MODULE := dsp-dummy

LOCAL_STATIC_LIBRARIES := libcutils libc
include $(BUILD_EXECUTABLE)

Now source envsetup.sh followed by choosecombo, to set all environment variables and dependecies

. build/envsetup.sh
choosecombo

… and finally we create the dsp-dummy for Android …

mmm external/dsp-dummy/

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

make menuconfig

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!)

gedit ./kernel/fork.c

and add the following on line 161; just after the function void __put_task_struct(struct task_struct *tsk) ends.

EXPORT_SYMBOL(__put_task_struct);

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 dspbridge.ko
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!

# dsp-dummy
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

24 Replies to “DSP on Beagleboard running Android”

  1. Great Job…
    Could you please let me know the steps followed to make the DSPBridge up on Android for Beageboard.
    1. I took the Omap kernel and put in Android/Kernel folder
    2. I tried make menuconfig with DSP bridge option , and the modules are compiled successfully.
    3. I built android with make -j, and build stuck in external/jpeg folder and the out/target/* files are updated.
    4. I replace uImage in my exisiting SD card to boot android(I am succesfully running android with the downloaded images from embunix )
    5.I am getting kernel panic error
    Load Address: 80008000
    Entry Point: 80008000
    Verifying Checksum … OK
    Loading Kernel Image … OK
    OK

    Starting kernel …

    Uncompressing Linux…………………………………………………………………………………………………… done, booting the kernel.
    and I’m stuck up in kernel panick.
    Please guide me as to how i can proceed.
    Thanks and Regards
    Aparna

  2. Hi Aparna!

    You will not have to change your uImage (keep the Embinux one). With the make command you will build the modules used for dspbridge.
    I can’t exactly recall where they are put after compilation but you can search for them by issuing command

    $find . -name ‘*.ko’

    in your kernel directory.
    I hope this will work for you.

    Cheers
    Manuel

  3. OMAP3 beagleboard.org # mmcinit
    OMAP3 beagleboard.org # fatload mmc 0 80300000 uImage
    reading uImage
    Hello Manuel,
    I tried the same and on the board I’m getting the following error:

    1710832 bytes read
    OMAP3 beagleboard.org # setenv bootargs console=ttyS2,115200n8 noinitrd root=/dev/mmcblk0p2 video=omapfb.mode=dvi:1280x720MR-24@50 init=/init rootfstype=ext
    OMAP3 beagleboard.org # bootm 80300000
    ## Booting kernel from Legacy Image at 80300000 …
    Image Name: Linux-2.6.29-omap1
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 1710768 Bytes = 1.6 MB
    Load Address: 80008000
    Entry Point: 80008000
    Verifying Checksum … OK
    Loading Kernel Image … OK
    OK

    Starting kernel …

    Uncompressing Linux……………………………………………………………………………………………….. done, booting the kernel.
    Please help me out .. I’m stuck at this point….
    Regards
    Aparna

  4. Hello Manuel,
    I ran with the kernel image from embinux and getting the following error:
    # ls
    dspbridge.ko
    bridgedriver.ko
    # insmod dspbridge.ko
    dspbridge: no symbol version for struct_module
    insmod: init_module ‘dspbridge.ko’ failed (Exec format error)
    # insmod bridgedriver.ko
    bridgedriver: no symbol version for struct_module
    insmod: init_module ‘bridgedriver.ko’ failed (Exec format error)

    So it looks like the kernel doesn’t have the dspbridge support.
    Can you please tell me the steps for the correct method to be followed.??
    Thanks in advance,
    Aparna

  5. @Aparna
    Hello Aparna,
    we have not tried using dspbridge with the embinux kernel image, so we are not sure if it will work. Instead we have been using the official android omap.git kernel. It is also these kernel sources we are refering to in step 4 of the above post. You can use our config file from this post to compile that kernel. If everything works fine, you’ll get a new uImage to put on your SD card.

    Good luck and dont hesitate to contact us again
    Andreas

  6. Hello Andreas,

    Thanks for the reply..
    I’ve tried integrating the dspbridge with the kernel from android omap.git kernel. official site.
    It’s running successfully But the keyboard and mouse doest get detected….!
    Now I’m using the images from embinux So.. any help for this kernel would be highly appreciated….

    Warm regards
    Aparna

  7. @Aparna
    Hello again
    where did you plugin your mouse and keyboard? With the said android omap.git kernel, the normal usb host connector will not work. You need to plugin a USB hub to the USB OTG connector (“the mini socket”). And then plugin all peripherals to this hub. Also, if I remember correctly, the USB hub needs an external power source.

    By the way, I dont want to discourage you or anybody else at all to use dspbridge, however we recently had more success using DSP/BIOS Link. There is a good guide on the ossie project site. I will also make a new post for running dsplink with detailed instructions in the next few days.

    Unfortunately, we dont have much experience using the embinux kernel images. Have you ever tried “make menuconfig” in the kernel sources, and then look for an option that may enable dspbridge? Im sorry I cant be of any more help to you…

    Best wishes
    Andreas

  8. Hi ALL,
    I tried to build dspbridge driver in “android-
    omap-2.6.29-eclair kernel” as stated in STEP-4 . “android-omap-2.6.29-eclair kernel” can be
    downloaded from repostory:

    http://android.git.kernel.org/?p=kernel/omap.git;a=summary

    I have run $make menuconfig
    and then enabled dspbridge driver as a module.
    Then I tried to build the kernel using following command :

    make -j4 modules CROSS_COMPILE=/media/EXTRA_SPACE/home/jitin/Documents/
    tapas/arm-2007q3/bin/arm-none-linux-gnueabi- CC_PATH=/media/
    EXTRA_SPACE/home/jitin/Documents/tapas/arm-2007q3/bin/arm-none-linux-
    gnueabi-

    But it gives errors and I failed to build dspbridge.ko as a module :

    ers/dsp/bridge/services/kfile.o
    CC [M] fs/isofs/joliet.o
    CC [M] fs/isofs/compress.o
    CC [M] net/dccp/ccids/lib/loss_interval.o
    CC [M] drivers/dsp/bridge/services/sync.o
    LD [M] fs/isofs/isofs.o
    CC [M] drivers/dsp/bridge/services/clk.o
    CC [M] fs/jffs2/compr.o
    drivers/dsp/bridge/services/clk.c: In function ‘SSI_Clk_Prepare’:
    drivers/dsp/bridge/services/clk.c:359: error: implicit declaration of
    function ‘IO_ADDRESS’
    make[2]: *** [drivers/dsp/bridge/services/clk.o] Error 1
    make[1]: *** [drivers/dsp/bridge] Error 2
    make: *** [drivers] Error 2
    make: *** Waiting for unfinished jobs….
    CC [M] net/dccp/sysctl.o
    CC [M] sound/pci/ice1712/delta.o
    CC [M] fs/jffs2/dir.o

    It seems to me clk.c file has some problem and dspbridge driver has
    some problem. Can anyone help me to solve this problem?

  9. @ Andreas ,
    Please help me to solve this problem. I followed all the steps mentioned in STEP-4. But I failed to build dspbridge.ko modules. Please help me to solve this problem. My email address is : tapascst@gmail.com.

  10. Hi,
    By following step by step guide mentioned on your technical report, I am getting following errors :
    root@Danger:/opt/dsplink/config/bin# perl dsplinkcfg.pl –platform=OMAP3530 –nodsp=1 –dspcfg_0=OMAP3530SHMEM –dspos_0=DSPBIOS5XX –gppos=OMAPLSP –comps=ponslrm –trace=0

    Welcome to DSP/BIOS(TM) Link Configuration Utility
    ——————————————————

    !!DSPLINK will be configured for Build OS: LINUX!!

    !!DSPLINK Directory : /opt/dsplink!!

    =========================================================
    Chosen configuration is as follows:

    Chosen platform:
    Identifier: OMAP3530
    Description: OMAP3530 SoC – C64P DSP interfaced directly to ARM9
    This platform does not support multi DSP scenario

    No of DSPs: 1

    Chosen combination for DSP0:
    Identifier : OMAP3530
    DSP Description : On-Chip DSP of OMAP 3530 SoC
    Physical Interface (PHY): OMAP3530SHMEM
    PHY Description : Shared Memory Physical Interface

    Chosen DSP OS for DSP0:
    Identifier: DSPBIOS5XX
    Description: DSP/BIOS (TM) Version 5.XX

    ****************** ADVICE !!! ***************************
    Binaries for DSP can be generated at preferred location
    For example: –dsp0_temp=/home/dsplink/dsp/bin

    Chosen GPP OS for selected DSP(s):
    Identifier: OMAPLSP
    Description: OMAP LSP for OMAP2530 and OMAP3530

    ****************** ADVICE !!! ***************************
    Binaries for GPP can be generated at preferred location
    For example: –gpp_temp=/home/dsplink/gpp/bin

    Chosen Components for DSPLink:
    USE_PROC = 1
    USE_NOTIFY = 1
    USE_POOL = 1
    USE_MPCS = 1
    USE_MPLIST = 1
    USE_RINGIO = 1
    USE_MSGQ = 1
    USE_CHNL = 0

    ****************** ADVICE !!! ***************************
    To enable trace use option: –trace=1
    Provided: 0
    Assuming trace disable and continuing…

    ****************** ADVICE !!! ***************************
    To enable legacy support use option: –legacy=1
    Provided:
    Assuming legacy support disable and continuing…

    ****************** ADVICE !!! ***************************
    To enable DSP TSK mode select: –DspTskMode=1
    Provided:
    Assuming DSP SWI mode enabled and continuing…
    =========================================================

    Configuration done successfully!!
    Generating CURRENTCFG.MK file…
    Generating multimake script…
    Generating CFG_system.c File…
    Generating GPP RTSC xdc file…
    Generating DSP RTSC xdc file…
    =========================================================
    Please edit the following files for toolchains, kernel sources, etc changes.
    GPP side distribution file: $DSPLINK/make/Linux/omap3530_2.6.mk
    GPP side distribution file: $DSPLINK/gpp/src/Rules.mk
    DSP side distribution file: $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk
    ==========================================================
    Users consuming DSPLINK as XDC package, Need to do the following.
    cd into the $(DSPLINK)/dsp directory and run:
    $(XDC_INSTALL_DIR)/xdc clean
    $(XDC_INSTALL_DIR)/xdc .interfaces
    cd into the $(DSPLINK)/gpp directory and run:
    $(XDC_INSTALL_DIR)/xdc clean
    $(XDC_INSTALL_DIR)/xdc .interfaces
    ==========================================================
    root@Danger:/opt/dsplink/config/bin# export C6X_C_DIR=/opt/dsp
    dsplink/ dsptools/
    root@Danger:/opt/dsplink/config/bin# echo $C6X_C_DIR

    root@Danger:/opt/dsplink/config/bin#
    root@Danger:/opt/dsplink/config/bin#
    root@Danger:/opt/dsplink/config/bin#
    root@Danger:/opt/dsplink/config/bin# cd ..
    root@Danger:/opt/dsplink/config# ls
    all bin BUILD
    root@Danger:/opt/dsplink/config# cd ..
    root@Danger:/opt/dsplink# ls
    config doc dsp etc gpp make
    root@Danger:/opt/dsplink# cd gpp/src/a
    api/ arch/
    root@Danger:/opt/dsplink# cd gpp/src/api/
    root@Danger:/opt/dsplink/gpp/src/api#
    root@Danger:/opt/dsplink/gpp/src/api#
    root@Danger:/opt/dsplink/gpp/src/api# make -s clean
    [API ] ——- CLEAN —————– DEBUG ————–
    [API ] ——- CLEAN —————– RELEASE ————
    root@Danger:/opt/dsplink/gpp/src/api# make -s debug
    [API ] ——- DIRS —————— INCLUDE ————
    [API ] ——- DIRS —————— DEBUG ————–
    [API ] ——- DIRS —————— EXPORT ————-
    [API ] ——- BLDINFO ————— DEBUG ————–
    [API ] ——- CLEAN —————– DEBUG ————–
    [API ] ——- INCLUDES ———————————–
    [API ] ——- OBJECT —————- DEBUG ————–
    Fetching the configuration file CFG_OMAP3530_SHMEM.c …
    Fetching the configuration file CFG_Linux.c …
    Fetching the configuration file CFG_ARM.c …
    Compiling CFG_system.c…
    Compiling CFG_Linux.c…
    Compiling CFG_ARM.c…
    Compiling CFG_OMAP3530_SHMEM.c…
    Compiling proc.c…
    Compiling msgq.c…
    Compiling mpcs.c…
    Compiling _mpcs.c…
    Compiling _idm_usr.c…
    Compiling ringio.c…
    Compiling _ringio.c…
    Compiling mplist.c…
    Compiling _mplist.c…
    Compiling pool.c…
    Compiling _pool.c…
    Compiling pool_arch.c…
    Compiling _sync_usr.c…
    Compiling _mem_usr.c…
    Compiling drv_api.c…
    drv_api.c:61: fatal error: asm/page.h: No such file or directory
    compilation terminated.
    make[1]: *** [drv_api.c.deb] Error 1
    make: *** [objdeb] Error 2

    Please let me know how to solve it.
    Thanks
    Tapas

  11. Pingback: c6x
  12. Pingback: Kylie Batt
  13. Hey guys…I’m on my final year project …I’m thinking of doing a digital filter using Beagle Board and Android…Well I downloaded few files 0xkernel-beagle.bin,uImage.bin, android-beagle.ubi..from Oxdriod site..and my beagle board is set up as said ..but I’m having no idea at all about programming the DSP.Can u guys pls tell me what tools i need to program the DSP..and how to set it up…pls?..thanx,,,

  14. @Jishnu
    Hi Jishnu!
    I have the same project to do this year. Do you have DSP code and a guide for realised an equalizer on BeagleBoard whith XDroid? This will be perfect :). Thanks

  15. I’m getting troubles when i do make DSP_TOOLS=/opt/dsptools DSP_DOFFBUILD=/opt/doffbuild

    This is the output

    CC dummy_arm.o
    In file included from dummy_arm.c:13:

    dummy_arm.c:196: warning: implicit declaration of function ‘signal’
    dummy_arm.c:196: error: ‘SIGINT’ undeclared (first use in this function)
    dummy_arm.c:213: error: ‘NULL’ undeclared (first use in this function)
    make: *** [dummy_arm.o] Error 1

    Somebody can help me?

      1. Thanks on that Manuel, now i’m getting this error, as far as i know i’ve got to give the path to my cross compiler but even when i do that it does not recognize it, for example arm-eabi-gcc…….

        CC dummy_arm.o
        /bin/sh: 1: arm-linux-gcc: not found
        make: *** [dummy_arm.o] Error 127

  16. Hi, thanks for your job it’s amazing, i’m stuck in step 4 when i do mmm external/dsp-dummy/ i got the following error.

    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=4.0.3
    TARGET_PRODUCT=full
    TARGET_BUILD_VARIANT=eng
    TARGET_BUILD_TYPE=release
    TARGET_BUILD_APPS=
    TARGET_ARCH=arm
    TARGET_ARCH_VARIANT=armv7-a
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_BUILD_TYPE=release
    BUILD_ID=IML74K
    ============================================
    make: se ingresa al directorio «/home/monica/rowboat-android»
    make: *** No hay ninguna regla para construir el objetivo «out/target/product/generic/obj/lib/crtbegin_dynamic.o», necesario para «out/target/product/generic/obj/EXECUTABLES/dsp-dummy_intermediates/LINKED/dsp-dummy». Alto.
    make: se sale del directorio «/home/monica/rowboat-android»
    ………………………………………………………………………………………………………………………………………………….

    This is the way i’ve got configured my Android.mk file

    LOCAL_PATH:= $(call my-dir)
    include $(CLEAR_VARS)

    LOCAL_SRC_FILES:= \
    dummy_arm.c \
    dsp_bridge.c \
    log.c

    LOCAL_C_INCLUDES:= /home/monica/rowboat-android/external/dsp-dummy/
    LOCAL_MODULE := dsp-dummy
    LOCAL_MODULE_TAGS := optional
    LOCAL_STATIC_LIBRARIES := libcutils libc
    include $(BUILD_EXECUTABLE)

    I’ll apprecciate any help!

  17. Hello, me again, i hope not to be an headache for someone of you.
    I’m on step 4 but when doin this mmm external/dsp-dummy/ i got the following error……

    ============================================
    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=4.0.3
    TARGET_PRODUCT=full
    TARGET_BUILD_VARIANT=eng
    TARGET_BUILD_TYPE=release
    TARGET_BUILD_APPS=
    TARGET_ARCH=arm
    TARGET_ARCH_VARIANT=armv7-a
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_BUILD_TYPE=release
    BUILD_ID=IML74K
    ============================================
    make: se ingresa al directorio «/home/joematz/rowboat-android2»
    make: *** No hay ninguna regla para construir el objetivo «out/target/product/generic/obj/lib/crtbegin_dynamic.o», necesario para «out/target/product/generic/obj/EXECUTABLES/dsp-dummy_intermediates/LINKED/dsp-dummy». Alto.
    make: se sale del directorio «/home/joematz/rowboat-android2»

    I just configure my Android.mk File as well

    LOCAL_PATH:= $(call my-dir)

    include $(CLEAR_VARS)

    LOCAL_SRC_FILES:= \
    dummy_arm.c \
    dsp_bridge.c \
    log.c

    LOCAL_C_INCLUDES:= external/dsp-dummy/

    LOCAL_MODULE := dsp-dummy
    LOCAL_MODULE_TAGS := optional

    LOCAL_STATIC_LIBRARIES := libcutils libc
    include $(BUILD_EXECUTABLE)

    Thanks for your help 🙁

Leave a Reply

Your email address will not be published. Required fields are marked *


*