= Installing DSPLink on a BeagleBoard Outside !OpenEmbedded from Source = ''' Contents: ''' * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#IntroductiontoDSPLink Introduction to DSPLink] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#IntroductiontothisGuide Introduction to this Guide] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#DownloadingandInstallingRequiredFiles Downloading and Installing Required Files] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#DSPBIOSLink DSP/BIOS Link] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#LinuxKernel Linux Kernel] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#DSPBIOSXDCToolsandC6xcompiler DSP/BIOS, XDCTools, and C6x compiler] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#LocalPowerManager Local Power Manager] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#Optional-PlatformSupportPackage Optional - Platform Support Package] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#ConfiguringMakefiles Configuring Makefiles] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#BuildingDSPLinkFiles Building DSPLink Files] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#BuildingLPMModules Building LPM Modules] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#BeagleBoardConfiguration BeagleBoard Configuration] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#LoadModules Load Modules] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#LoadingModulesatBootup Loading Modules at Bootup] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#RunningandExecutingSampleApplications Running and Executing Sample Applications] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#message message] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#ringio ringio] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#ExternalLinks External Links] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink#ExternalLinks Attachments] == 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. * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_CodecEngine Building DSPLink inside OpenEmbedded] [[BR]] 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. [[BR]] [[BR]] * [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_DSPLink Building DSPLink outside OpenEmbedded] [[BR]] 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 == This guide will show you how to compile DSPLink from source specifying the target platform as the !BeagleBoard. Once finished compiling from source, you also have a working host environment to compose and compile your own applications. There are two main ways of compiling applications for TI's DSPs. One of which is Code Composer Studio, a full development studio to compile DSP applications. The drawbacks of this option is the high software licensing cost and that it is only compatible with Windows OS. A second option is to compile applications through command line using tools from TI such as the Code Generation Tools. This has the advantage of compiling applications on a wide variety of host operating systems including Linux and Windows. Additionally the software required is free on TI's website. This guide will walk you through setting up a Linux host system (Ubuntu 8.04) to compile applications from command line. Please see TI's !UserGuide for full instructions on how to compile on other host systems or for more advanced settings. The !UserGuide is located in the doc folder of the soon-to-be downloaded DSP/BIOS Link tar. The guide expects the user to have successfully completed the [http://elinux.org/BeagleBoardAndOpenEmbeddedGit OpenEmbedded] steps and created an x11-image. Additionally, it is necessary to copy files from the host system to the target !BeagleBoard. Two options of doing this is to plug the SD card in the host system or to use a file transfer protocol such as zmodem to transfer the files. If you would like to use the latter, please see the instructions for setting up [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard#TransferFilesoverSerialusingZMODEM zmodem on the BeagleBoard]. >'''Note:''' This guide was created after going through the steps of bitbaking and installing TI Codec Engine. You will need to follow the first half of the [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_CodecEngine Codec Engine guide] which will bitbake the Codec Engine recipe. == Downloading and Installing Required Files == There are multiple files needed to begin building applications in DSPLink. Registration at the TI website is needed for all files from TI and the user license(s) must be accepted. ==== DSP/BIOS Link ==== Download the DSP/BIOS Link. I used version 1.61.03 for linux. http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent//link/index.html Untar the file to your home directory. Assuming you downloaded dsplink_1_61_03.tar.gz to you Desktop, enter the following commands. {{{ $ cd ~/ $ tar xvzf ~/Desktop/dsplink_1_61_03.tar.gz }}} ==== Linux Kernel ==== A Linux Kernel is needed to compile DSPLink applications. The linking Kernel must be the same version or a compatible version with the Kernel installed on the !BeagleBoard. >'''Note:''' The Installation Guide uses a Linux Kernel that produces problems when compiling for the beagle. The problem is a build issue with the .tmp_vmlinux1 file using function omap3_beagle_map_io. Below is the error that is encountered when building the kernel. >arch/arm/mach-omap2/built-in.o: In function `omap3_beagle_map_io': >/home/ossie/omap3530/arm-2008q1/arch/arm/mach-omap2/board-omap3beagle.c:450: undefined reference to `omap2_set_sdram_vram' >make: *** [.tmp_vmlinux1] Error 1 Fortunately, our !OpenEmbedded build created enough of a kernel to use for compiling DSPLink. This kernel is located at ~/oe/tmp/staging/. Therefore, there is nothing to download as long as the !OpenEmbedded process was followed. ==== DSP/BIOS, XDCTools, and C6x compiler ==== You will need to download and install three binary files: C6x Compiler, DSP/BIOS Link, and XDCtools. * DSP/BIOS and XDCtools can be found at https://www-a.ti.com/downloads/sds_support/targetcontent/index.html * C6x compiler can be found at https://www-a.ti.com/downloads/sds_support/CodeGenerationTools.htm 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: [[BR]] * BIOS 5.33.02 (https://www-a.ti.com/downloads/sds_support/targetcontent/bios/bios_5_33/index_external.html) * XDCtools 3.10.03 (https://www-a.ti.com/downloads/sds_support/targetcontent/rtsc/xdctools_3_10/index.html) * C6000 Code Generation Tools v6.0.16 Linux Host (https://www-a.ti.com/downloads/sds_support/CodeGenerationTools.htm#C6000-6.0.x) 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 home 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 ==== Local Power Manager ==== Download the Local Power Manager (LPM). I used LPM version 1.23.01 which can be found at http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent//linuxutils/linuxutils_2_23/index.html . Untar the file in your TI directory and then untar ti_bios_power,omap3530.tar. {{{ $ cd ~/TI $ tar xvf ~/TI/local_power_manager_1_23_01/packages/ti/bios/power/ti_bios_power,omap3530.tar $ cd omap3530/lpm }}} ==== Optional - Platform Support Package ==== This !UserGuide uses the Platform Support Package (PSP) for the linux kernel it includes. Since we are using the Kernel from OpenEmbedded, the PSP is not necessary to be downloaded or installed. Therefore, this is optional as there are other uses for the PSP outside the scope of this guide. If you decide to download, download the OMAP35x PSP release 02.00.00.01 as this release matches the DSPLink guide's release. http://software-dl.ti.com/dsps/dsps_registered_sw/sdo_sb/targetcontent//psp/omap35x/index.html == Configuring Makefiles == There are a number of directories DSPLink looks for when compiling. To tell DSPLink where to find these, there are three make files that need to be tailored to your environment. The three files that need to be changed are: * 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 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. == Building DSPLink Files == When working with DSPLink, it is necessary to set an environment variable for the DSPLink directory. You can use the second command to add it to your default terminal shell. {{{ $ export DSPLINK=$HOME/dsplink_1_61_03/dsplink $ echo export DSPLINK=$HOME/dsplink_1_60/dsplink >>$HOME/.bashrc }}} 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 /lib/modules/2.6.29-omap1/kernel/drivers/dsp/dsplinkk.ko ~/TI/moduleBackups $ sudo rm /lib/modules/2.6.29-omap1/kernel/drivers/dsp/dsplinkk.ko $ sudo cp $DSPLINK/gpp/export/BIN/Linux/OMAP3530/DEBUG/dsplinkk.ko /lib/modules/2.6.29-omap1/kernel/drivers/dsp/ $ sudo mkdir /usr/share/ti-dsplink/cmd_compiled $ sudo mkdir /usr/share/ti-dsplink/cmd_compiled/DEBUG $ sudo mkdir /usr/share/ti-dsplink/cmd_compiled/RELEASE $ sudo cp $DSPLINK/gpp/export/BIN/Linux/OMAP3530/DEBUG/messagegpp /usr/share/ti-dsplink/cmd_compiled/DEBUG $ sudo cp $DSPLINK/gpp/export/BIN/Linux/OMAP3530/RELEASE/messagegpp /usr/share/ti-dsplink/cmd_compiled/RELEASE $ sudo cp $DSPLINK/dsp/export/BIN/DspBios/OMAP3530/OMAP3530_0/DEBUG/message.out /usr/share/ti-dsplink/cmd_compiled/DEBUG $ sudo cp $DSPLINK/dsp/export/BIN/DspBios/OMAP3530/OMAP3530_0/RELEASE/message.out /usr/share/ti-dsplink/cmd_compiled/RELEASE }}} == Building LPM Modules == {{{ $ cd omap3530/lpm $ gedit Makefile }}} Find the lines similar to this and add the following lines below it. {{{ #LINUXKERNEL_INSTALL_DIR = _your_kernel_installation_ #MVTOOL_PREFIX = _your_codegen_installation_and_name_prefix_ #DSPLINK_REPO = _your_dsplink_repository_ LINUXKERNEL_INSTALL_DIR = ${HOME}/oe/tmp/staging/beagleboard-angstrom-linux-gnueabi/kernel MVTOOL_PREFIX = ${HOME}/oe/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi- DSPLINK_REPO = ${HOME}/dsplink_1_61_03/ }}} Now perform make and it will create the lpm_omap3530.ko module needed. Remove any existing LPM module and then copy this module to the target in the proper location. You may want to backup the existing LPM module if it exists. In the code below, replace with the location of your target files system, i.e. /media/disk-1 if transferring directly to SD card. {{{ $ make $ sudo cp /lib/modules/2.6.29-omap1/kernel/drivers/dsp/lpm_omap3530.ko ~/TI/moduleBackups $ sudo rm /lib/modules/2.6.29-omap1/kernel/drivers/dsp/lpm_omap3530.ko $ sudo cp lpm_omap3530.ko /lib/modules/2.6.29-omap1/kernel/drivers/dsp/ }}} You will also need the lpmON and lpmOFF executables to reset the DSP. They have already been built for use on the omap3530. There are both DEBUG and RELEASE versions so you can copy both sets if unsure. {{{ $ cd /usr/share/ti-dsplink/ $ sudo mkdir lpm $ sudo cd lpm $ sudo mkdir DEBUG $ sudo mkdir RELEASE $ sudo cp ~/TI/local_power_manager_1_23_01/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/debug/lpmON.x470uC ./DEBUG $ sudo cp ~/TI/local_power_manager_1_23_01/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/debug/lpmOFF.x470uC ./DEBUG $ sudo cp ~/TI/local_power_manager_1_23_01/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/release/lpmON.x470uC ./RELEASE $ sudo cp ~/TI/local_power_manager_1_23_01/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/release/lpmOFF.x470uC ./RELEASE $ sudo cp ~/TI/local_power_manager_1_23_01/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/debug/lpmON.x470uC /usr/bin $ sudo cp ~/TI/local_power_manager_1_23_01/packages/ti/bios/power/test/bin/ti_platforms_evm3530/linux/debug/lpmOFF.x470uC /usr/bin }}} == 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.[[BR]] {{{ 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 }}} == Load Modules == Download the loadmodules.sh and unloadmodules.sh which are attached to this wiki. Change permissions of each script and then copy them to the beagle. These scripts will load/unload both the dsplinkk.ko and lpm_omap3530.ko modules. Assuming you downloaded the scripts to the Desktop: {{{ $ cd ~/Desktop $ chmod +x loadmodules.sh $ chmod +x unloadmodules.sh $ sudo cp loadmodules.sh /usr/share/ti-dsplink/ $ sudo cp unloadmodules.sh /usr/share/ti-dsplink/ }}} Now that you have copied your executables, modules, and scripts to your target file system, ensure the SD card is in the BeagleBoard and then turn it on. It is required to run the loadmodules.sh script to load both dsplink and lpm modules. Verify that both were loaded using the lsmod command. {{{ root@beagleboard:~/# cd /usr/share/ti-dsplink root@beagleboard:~/# ./loadmodules.sh root@beagleboard:~/# lsmod Module Size Used by lpm_omap3530 8168 0 dsplinkk 244552 1 lpm_omap3530 }}} ==== Loading Modules at Bootup ==== If you would like to load the script on bootup, you can add the script to init.d and use the update-rc.d command. >'''Note:''' If you have previously set a loadmodules script to run at startup, you will need to remove it. The following commands apply only if you have installed Codec Engine loadmodules script found [http://ossie.wireless.vt.edu/trac/wiki/BeagleBoard_CodecEngine#StartingDSPLink here]. Modifications to the script name are needed if a different script was used.[[BR]] >> `root@beagleboard:~/# update-rc.d -f loadmodules-ti-dsplink-apps.sh remove` >> `root@beagleboard:~/# rm /etc/init.d/loadmodules-ti-dsplink-apps.sh` >> `root@beagleboard:~/# rm /etc/init.d/unloadmodules-ti-dsplink-apps.sh` Use the following commands to copy the loadmodules script to the init.d folder and perform update-rc.d. The option "defaults" will start the script at the different runlevels specified by "defaults". {{{ root@beagleboard:~# cp /usr/share/ti-dsplink/loadmodules.sh /etc/init.d/ root@beagleboard:~# cd /etc/init.d/ root@beagleboard:~# update-rc.d loadmodules.sh defaults Adding system startup for /etc/init.d/loadmodules.sh. }}} Reset the !BeagleBoard. During bootup, it should have loaded the dsplinkk.ko and lpm_omap3530.ko modules. You can verify that both are loaded using the lsmod command. {{{ root@beagleboard:~/# lsmod Module Size Used by lpm_omap3530 8168 0 dsplinkk 244552 1 lpm_omap3530 }}} == Running and Executing Sample Applications == You should now be ready to run the sample applications. Enter the ti-dsplink directory and run GPP/DSP executables with appropriate parameters for the applications. >'''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. === message === 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 The following contains test arguments and the resulting output. {{{ root@beagleboard:~/# lpmON.x470uC root@beagleboard:~/# lpmOFF.x470uC root@beagleboard:~/# cd /usr/share/ti-dsplink/cmd_compiled/DEBUG root@beagleboard:/usr/share/ti-dsplink/cmd_compiled/DEBUG# ./messagegpp message.out 1000 ========== Sample Application : MESSAGE ========== Entered MESSAGE_Create () Leaving MESSAGE_Create () Entered MESSAGE_Execute () Transferring 1000 iterations took 0 seconds 161774 microseconds. RoundTrip Time for 1 message is 161 microseconds. Leaving MESSAGE_Execute () Entered MESSAGE_Delete () Leaving MESSAGE_Delete () ==================================================== }}} === ringio === 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 The following contains test arguments and the resulting output. {{{ root@beagleboard:~/# lpmON.x470uC root@beagleboard:~/# lpmOFF.x470uC root@beagleboard:~/# cd /usr/share/ti-dsplink/cmd_compiled/DEBUG root@beagleboard:/usr/share/ti-dsplink/cmd_compiled/DEBUG# ./ringiogpp 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 () ==================================================== }}} == External Links == For more information, see: [[BR]] http://elinux.org/BeagleBoard/DSP_Howto [[BR]] https://gstreamer.ti.com/gf/project/gstreamer_ti/wiki/?pagename=BuildingWithAngstrom [[BR]] http://groups.google.com/group/beagleboard/browse_thread/thread/3d2560c087941100 [[BR]] http://www.pixhawk.ethz.ch/wiki/tutorials/omap/dsplink [[BR]]