Mark Tyndall August 3, 2011 Compiling and Installing the DSPLink Linux Kernel Modules for the TI OMAP3530 Processor The Texas Instruments OMAP3530 ARM processor contains a TMS320C64x+ DSP core. To access the DSP it will need to be loaded with a BIOS. This document will guide you through the process of compiling and installing the Linux drivers and tools need to use the DSP core. There are alternative ways of installing a BIOS into the DSP through Code Composer Studio and an application called OpenEmbedded but these are outside the scope of this guide. This guide assumes that you already have a properly installed cross compiler environment. If you have not done this, you should see the document titled ‘Creating a Custom Linux Kernel and Root File System for the TI OMAP3530 Processor’. Installing the TI Tools The first thing that you will need to do is download and install TI’s DSP development tools. In your TI folder, download the following files. These were the most current versions as of this writing. These files may require a TI account to download. DSP/BIOS Link for Linux 1.63[1] BIOS 5.33.06[2] XDCtools 3.10.05.61 Linux[3] C6000 Code Generation Tools v6.0.28[4] Local Power Manager (LPM) 1.23.01[5] DSP Binaries[6] Once all the downloads have completed, open a terminal and extract dsplink tar file with the following command and create a system path variable. Also, extract the Local Power Manager tar file. The ‘backup’ directory will be needed later on in this tutorial. $ cd TI $ cd mkdir backup $ tar xvzf dsplink_linux_1_63.tar.gz $ export DSPLINK=$HOME/TI/dsplink_linux_1_63/dsplink $ tar xvzf local_power_manager_1_23_01.tar.gz $ cd local_power_manager_1_23_01/packages/ti/bios/power/ $ tar xvf ti_bios_power,omap3530.tar 1 Mark Tyndall August 3, 2011 The system path variable is not persistent across reboots. If you wish not to have to do this, use the following command to add it to your bashrc file. Else, you will have to re-export the file path every time you reboot. $ echo export DSPLINK=$HOME/TI/dsplink_linux_1_63/dsplink >> $HOME/.bashrc To test to see if the path variable is functioning cd into $DSPLINK. Next, install the bin files. Install each file to its own sub-directory in the TI folder. Make the executable and run the graphic installer with the following commands. $ sudo chmod +x bios_setuplinux_5_33_06.bin $ ./bios_setuplinux_5_33_06.bin Repeat this step for the other two bin files. Be sure that each program installs into separate directories. Once the three files are installed into their respective directories make note of the directory names. With this information, edit the following files, changing any instances in the file where the Kernel, BIOS, XDCtools and Code Generation Tools are defined. Also change the name of the cross compiler tools references to “arm-linux-gnueabi-“. $DSPLINK/make/Linux/omap3530_2.6.mk $DSPLINK/gpp/src/Rules.mk $DSPLINK/make/DspBios/c64xxp_5.xx_linux.mk Compiling DSPLink The DSPLink Kernel modules need to cross compiled against the same Kernel version that is running on your processor. At the time of this writing, the current Kernel version is 2.6.38+. If necessary checkout the proper Kernel version using git and recompile your kernel. Before compiling DSPLink some changes need to be made to the source code to correct some bugs that exist in the current versions. Follow these steps to correct these issues: In your kernel sources, copy the “include/generated/autoconf.h” file to “/include/linux/autoconf.h” In the omap3530_phy_shmem.c file located in “$DSPLINK/gpp/src/arch/OMAP3530/shmem/Linux/” add the following after the #include statements: 2 Mark Tyndall August 3, 2011 #define IO_PHYS 0xFFFB0000 #define IO_OFFSET 0x01000000 #define IO_VIRT (IO_PHYS - IO_OFFSET) #define IO_SIZE 0x40000 #define IO_ADDRESS(x) ((x) - IO_OFFSET) /* Virtual IO = 0xfefb0000 */ In the $DSPLINK/gpp/src/pmgr/Linux/2.6.18/drv_pmgr.c file under the "file_operations driverOps" function change "ioctl: DRV_Ioctl" to "unlocked_ioctl: DRV_Ioctl". In the c64xxp_5.xx_linux.mk file change XDCTOOLS_DIR = $(BASE_SABIOS)/... to XDCTOOLS_DIR = $(BASE_INSTALL)/. Download lpm_driver.c from the Senior Design website and overwrite the file in the “$HOME/TI/local_power_manager_1_23_01/packages/ti/bios/power/omap3530/lpm/” directory Now that we have corrected the know bugs we can continue with compiling the tools. The DSP in the OMAP3530 only supports the 5.x BIOS. So, execute the following command to generate the proper base configuration for the DSP. $ perl $DSPLINK/config/bin/dsplinkcfg.pl --platform=OMAP3530 --nodsp=1 -- dspcfg_0=OMAP3530SHMEM --dspos_0=DSPBIOS5XX --gppos=OMAPLSP --comps=ponslrmc When the script completes, the message displayed contains some addition information and tasks. Complete these steps before continuing with compilation. Once these tasks are complete, execute the following commands from their respective directories to compile the GPP and DSP files. 3 Mark Tyndall August 3, 2011 $ cd $DSPLINK/gpp/src/api $ cd $DSPLINK/dsp/src $ make -s clean $ make -s clean $ make -s debug $ make -s debug $ make -s release $ make -s release $ cd $DSPLINK/gpp/src $ cd $DSPLINK/dsp/src/samples $ make -s clean $ make -s clean $ make -s debug $ make -s debug $ make -s release $ make -s release $ cd $DSPLINK/gpp/src/samples $ make -s clean $ make -s debug $ make -s release The GPP generated files will be located in the “/gpp/export/BIN/Linux/OMAP3530” directory. The DSP generated files will be located in “/dsp/export/BIN/DspBios/OMAP3530/OMAP3530_0” directory. These directories will both contain two folders named ‘RELEASE’ and ‘DEBUG’. The files we want are contained in these folders. Copy both the ‘RELEASE’ and ‘DEBUG’ folder and all of their contents to your ‘backup’ directory. Lastly, we can compile the Local Power Manager Modules. Before compiling, edit the ‘Makefile’ in the ‘/local_power_manager_1_23_01/packages/ti/bios/power/omap3530/lpm ’ directory, defining the location of your Kernel sources, cross compiler and dsplink locations. Execute the following commands to compile the power modules. $ cd local_power_manager_1_23_01/packages/ti/bios/power/omap3530/lpm $ make The Kernel module ‘lpm_omap3530.ko’ will be located in the same directory from which you ran the make command. Copy the ‘lpm_omap3530.ko’ file to your ‘backup’ directory. There are also ‘DEBUG’ and ‘RELEASE’ directories associated with the local power manger. The files are located in ’/TI/local_power_manager_1_23_01/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/’ directory. The lpmON.x470uC and lpmOFF.x470uC files located here are needed to release the DSP from 4 Mark Tyndall August 3, 2011 reset. In normal operation, the ARM processor holds the DSP in reset making the DSP inaccessible. DSP Binaries The DSP binaries are need for multimedia processing and contain the DSP base image needed for the DSP to communicate to the ARM. Download the binaries from the following link and commands. $ wget --no-check-certificate https://gforge.ti.com/gf/download/frsrelease/285/3260/DSPbinaries-3.09-Linux-x86Install $ chmod +x ./DSPbinaries-3.09-Linux-x86-Install $ ./DSPbinaries-3.09-Linux-x86-Install --mode console --prefix /tmp The files generated by the script will be located in the ‘tmp’ directory. The files will need to be transferred to the beagle board. Installing the BIOS and Kernel Modules Install each of the following files to their respective directories listed below. If the directories do not exist, create the directory. The ‘<ROOTFS>’ label is the root directory of your SD card and ‘.xx’ is your Linux version. lpm_omap3530.ko <ROOTFS>/lib/modules/2.6.xx/kernel/drivers/dsp/ DSPLINK DEGUG and RELEASE folders <ROOTFS>/usr/share/ti-dsplink/cmd_compiled/DEBUG <ROOTFS>/usr/share/ti-dsplink/cmd_compiled/RELEASE lpmON.x470uC and lpmOFF.x470uC <ROOTFS>/usr/bin DSP Binaries <ROOTFS>/lib/dsp To install the kernel drivers use the following commands. 5 Mark Tyndall August 3, 2011 $ sudo depmod –A $ sudo modprob lpm_omap3530.ko $ lsmod After running the command ‘lsmod’ a list of loaded kernel modules will be displayed. It should look something like the output below. root@beagleboard:~/# lsmod Module Size Used by lpm_omap3530 8168 0 dsplinkk 244552 1 lpm_omap3530 Load the DSP BISO base image using the following commands. $ modprobe mailbox $ modprobe bridgedriver base_img=/lib/dsp/baseimage.dof To test if the DSP is functioning, run the following commands. PING Test $ wget "http://dev.omapzoom.org/?p=tidspbridge/userspacedspbridge.git;a=blob_plain;f=binaries/ping.out;hb=HEAD" -O ping.out $ chmod +x ping.out $ ./ping.out Socket Node Test $ wget "http://dev.omapzoom.org/?p=tidspbridge/userspacedspbridge.git;a=blob_plain;f=binaries/pingdyn_3430.dll64P;hb=HEAD" -O pingdyn_3430.dll64P $ ./dynreg.out -r pingdyn_3430.dll64P If the tests have completed successfully, then the DSP and ARM are communicating. If not refer to the links located at the end of this document for further details. 6 Mark Tyndall August 3, 2011 Reference Links [1]: http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent//link/link_1_60/index.html [2]: http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent/bios/bios_5_33/index_external.html [3]: http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent/rtsc/xdctools_3_10/index.html [4]: https://www-a.ti.com/downloads/sds_support/CodeGenerationTools.htm#C6000-6.0.x [5]: http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent//linuxutils/linuxutils_2_23/index.html [6]: http://elinux.org/BeagleBoard/DSP_Howto#TI.27s_DSP_binaries Useful Links [1]: http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink [2]: http://geekwentfreak.wordpress.com/2010/10/23/arm-none-linux-gnueabi-vs-arm-linux-eabi-vs-non-eabi/ 7