Difference between revisions of "ECE497 Notes on DSP via c6run"

From eLinux.org
Jump to: navigation, search
m (Added Notes tag)
(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:ECE497]]
+
[[Category:ECE497 |Notes]]
  
 +
Use [[EBC Exercise 09 Using the DSP for Audio Processing]] instead, though you need to follow these instructions to cross compile c6run.
 +
 +
 +
c6run is an easy way to use the DSP on the BeagleBoard.  You can either setup your host computer to cross compile c6run for the Beagle, or compile right on the Beagle.  Here's how to do each.
 +
 +
== Setting up cross compiling on a host computer ==
 
Here are some notes on how to get c6run going on the BeagleBoard.  This has been modified to add detail (4/27/2011) for the ECE4356 class.
 
Here are some notes on how to get c6run going on the BeagleBoard.  This has been modified to add detail (4/27/2011) for the ECE4356 class.
  
== Downloads ==
+
=== Downloads ===
=== from here ===
+
 
 +
There are some 350M of files that need to be downloaded and installed to use '''c6run'''. The good news is you don't have to install anything else.  The bad news is, if this is being used with a class, 350M * number_of_students can strain a campus internet connection.  Therefore we have two options, loading from the internet (works for everyone), and loading from your campus (works if someone on your campus has already downloaded for you).
 +
 
 +
The files you need to download are:
 +
 
 +
* C6run_m_yoder.tgz
 +
* ti_cgt_c6000_7.0.4_setup_linux_x86.bin
 +
* angstrom-2010.4-test-20100422-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.2.tar.bz2
 +
* bios_setuplinux_5_41_09_34.bin
  
This, [[Media:C6run_m_yoder.tgz]], contains the following:
+
'''C6run_m_yoder.tgz''' contains the following:
  
 
# /lib/modules from target FS
 
# /lib/modules from target FS
Line 16: Line 30:
 
## pre-compiled test and and example applications
 
## pre-compiled test and and example applications
  
=== from elsewhere ===
+
Pick your method of getting them.
  
*  DSP toolchain - point them to same one using
+
==== From the Internet ====
*  Angstrom distribution ARM compiler
+
*  DSP/BIOS 5.41 - point them to same one using
+
  
== Instructions for Host Setup and Build ==
+
* [[Media:C6run_m_yoder.tgz]] comes from the eLinux site.
 +
* Download the TI C6000 v7.0.4 code generation tools for Linux from [https://www-a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm here]
 +
* Download the angstrom ARM toolchain from [http://www.angstrom-distribution.org/toolchains/angstrom-2011.03-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2 here]
 +
* Download the 5.41.09.34 DSP/Bios package from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/bios/dspbios/5_41_09_34/exports/bios_setuplinux_5_41_09_34.bin here]
  
The download instructions have been modified. It is now assumed that you have already downloaded the following 4 files and placed them into your ~/Download directory (note ~ is /home/beagle below).  Since some of the download times are very slow for these, they have been made available on the EE4356 web site.  
+
==== From your Campus ====
* C6run_m_yoder.tgz
+
 
* ti_cgt_c6000_7.0.4_setup_linux_x86.bin
+
Go to your campus site and look for the files listed above.  The following schools have the files:
* angstrom-2010.4-test-20100422-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.2.tar.bz2
+
 
* bios_setuplinux_5_41_09_34.bin
+
; Rose-Hulman
 +
: The class dfs site
 +
; UTEP
 +
:  EE4356 web site
 +
 
 +
=== Instructions for Host Setup and Build ===
 +
 
 +
Now that you have downloaded the above files, here is how to install them. It's  assumed that the downloaded files are in your ~/Download directory (note ~ is /home/beagle below).
 +
 
 +
Now we create the toolchains directory and populate it
  
* (Already Done) Download the TI C6000 v7.0.4 code generation tools for Linux from [https://www-a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm here]
 
 
* Install the codegen tools to <code>~/toolchains/TI_CGT_C6000_7.04</code> (you implicitly accept a EULA when doing this)
 
* Install the codegen tools to <code>~/toolchains/TI_CGT_C6000_7.04</code> (you implicitly accept a EULA when doing this)
 
     host$ mkdir ~/toolchains
 
     host$ mkdir ~/toolchains
Line 37: Line 60:
 
     host$ ls -l ! Look for an x by ti_... to verify it is executable
 
     host$ ls -l ! Look for an x by ti_... to verify it is executable
 
     host$ ./ti_cgt_c6000_7.0.4_setup_linux_x86.bin --installto ~/toolchains --mode silent
 
     host$ ./ti_cgt_c6000_7.0.4_setup_linux_x86.bin --installto ~/toolchains --mode silent
 
* (Already Done) Download the angstrom ARM toolchain from [http://www.angstrom-distribution.org/toolchains/angstrom-2010.4-test-20100422-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.2.tar.bz2 here].
 
  
 
* Install the ARM toolchain
 
* Install the ARM toolchain
Line 44: Line 65:
  
 
The ARM toolchain will be in <code>~/toolchains/usr/local/angstrom/arm/</code>
 
The ARM toolchain will be in <code>~/toolchains/usr/local/angstrom/arm/</code>
 
* Download the 5.41.09.34 DSP/Bios package from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/bios/dspbios/5_41_09_34/exports/bios_setuplinux_5_41_09_34.bin here].
 
  
 
* Install the DSP/Bios package (you implicitly accept a EULA when doing this)
 
* Install the DSP/Bios package (you implicitly accept a EULA when doing this)
Line 51: Line 70:
 
     host$ ./bios_setuplinux_5_41_09_34.bin --mode silent --prefix ~/toolchains   
 
     host$ ./bios_setuplinux_5_41_09_34.bin --mode silent --prefix ~/toolchains   
  
* Install the pre-built C6Run package
+
* Install the pre-built C6Run package. To do this you must first untar the c6run_m_yoder.tgz file
 +
    host$ tar -xvzf c6run_m_yoder.tgz
 +
    host$ cd c6run_m_yoder
 
     host$ tar -C ~/toolchains -xzf c6run_0_95_02_02_beagleboard.tar.gz
 
     host$ tar -C ~/toolchains -xzf c6run_0_95_02_02_beagleboard.tar.gz
  
Line 57: Line 78:
 
     host$ cd ~/toolchains/c6run_0_95_02_02_beagleboard
 
     host$ cd ~/toolchains/c6run_0_95_02_02_beagleboard
 
     host$ vi environment.sh
 
     host$ vi environment.sh
 +
    /* the following command in vi would make the substitution on all cases */
 +
    :1,$s/\${HOME}/\/home\/beagle
 +
* We now want to set up our environment variables. But first we will check to see what they are currently.
 +
    host$ printenv ! Prints all the environment variables, note too many to see
 +
    host$ printenv | more  ! Prints out a page at a time, hit space bar to advance
 +
    host$ printenv | grep ARM ! Only prints lines that have “ARM” in them
 +
    host$ printenv | grep C6 ! Only prints lines that have “C6” in them
  
* Source the environment variables
+
* The above commands, unless you ran the <code>environment.sh</code> command previously, should show no environment variables with ARM or C6 in them
 +
* Source the environment variables and rerun the checks
 
     host$ source environment.sh
 
     host$ source environment.sh
 +
    host$ printenv | grep ARM ! Only prints lines that have “ARM” in them
 +
    host$ printenv | grep C6 ! Only prints lines that have “C6” in them
 +
 +
The preceding checks should now show that the following FOUR environment variables are set: ARM_TOOLCHAIN_PREFIX, ARM_TOOLCHAIN_PATH, CFLAGS, and C6RUN_TOOLCHAIN_PATH. At this point the environment and components are all setup to build the examples and test cases included in the the C6Run package. The compilation scripts (c6runlib and c6runapp scripts) rely on these and the other variables from the environment.sh file.
 +
 +
It is suggested that the test and example makefiles be used as a template for any builds done for your own code.
 +
 +
* Run '''make''' to compile the example code
 +
    host$ cd example ! You should be in /home/beagle/toolchains/c6run_0_95_02_02_beagleboard/examples
 +
    host$ make
 +
* Look at the output to make sure that no errors occurred. If errors occur then either correct them or seek instructor help
 +
* Go into the sub directories to see the compiled code
 +
    host$ cd c6runapp/emqbit
 +
    host$ ls
 +
* You should see in the directory listing the files bench_arm and bench_dsp (among others).
 +
 +
I added the following lines to my Makefile in the emqbit directory:
 +
<pre>
 +
install:
 +
scp bench_arm bench_dsp cfft_arm cfft_dsp root@beagle:c6run_target/examples/c6runlib/emqbit
 +
</pre>
 +
I can now automatically install on the Beagle by running:
 +
<pre>
 +
host$ make install
 +
</pre>
 +
 +
=== Target Preparation ===
 +
 +
It appears that if you are running a recent image, (from [http://beagleboard-validation.s3.amazonaws.com/deploy/201008201549/sd/list.html here] for example) you don't have to install a new uImage or the modules in /lib/modules.  Skip 1 and 2 below and just do 3.  If it doesn't work, go back and do 1 and 2 also.
 +
 +
1. Setup the beagleboard to boot using the included kernel image (uImage binary file). This should just require replacing the uImage file on your SD card with the provided one (rename the file to be just 'uImage'). This step can be accomplished with the following commands, after the SD card which has the Angstrom linux system has been put into the card reader and mounted on the host system.
 +
    host$ df ! Verify that /media/BEAGLE and /media/ANGSTROM file systems are available
 +
    host$ cd /media/BEAGLE ! Or whichever file system has the uImage file
 +
    host$ mv uImage uImage.bak ! Save a copy in case you mess up
 +
    host$ cd ~/Downloads/C6run_m_yoder
 +
    host$ cp uImage /media/BEAGLE
 +
 +
2. Copy the the contents of the provided /lib/modules to the target's /lib/modules path. I (Yoder) found I didn't need to do this. I (Usevitch) concur.
 +
 +
3. Copy the contents of c6run_target.tar.gz to the target file system. I placed it in /opt. It contains the kernel modules from the TI components and the loadmodules.sh script which should be used to install them. The pre-built examples and test cases are also included in this archive. However, we also want to see if our compiled example code will work. Therefore we will copy over our examples directory.
 +
    host$ mkdir /media/ANGSTROM/opt
 +
    host$ cp c6run_target.tar.gz /media/ANGSTROM/opt
 +
    host$ cd /media/ANGSTROM/opt
 +
    host$ tar -xvf c6run_target.tgz ! This can be done on the host or on the beagleboard when linux boots
 +
    host$ cp -R ~/toolchains/c6run_0_95_02_02_beagleboard/examples .  ! copy our examples directory onto the SD card
 +
    host$ cd ! can't unmount a file system in use
 +
    host$ umount /media/ANGSTROM
 +
    host$ umount /media/BEAGLE
 +
 +
=== Target Running ===
 +
* Remove the SD card, place it into the beagleboard, and boot Angstrom linux.
 +
* Before running any c6run based application, make sure you run the loadmodules.sh script to load the needed kernel modules.
 +
    beagle$ cd /opt/home/daniel/c6run_target
 +
    beagle$ ./unloadmodules.sh  ! sometimes modules are left over and need to be removed
 +
    beagle$ ./loadmodules.sh
 +
* Now we will run our compiled fft benchmark examples
 +
    beagle$ cd /opt/examples/c6runapp/emqbit
 +
    beagle$ ./bench_arm
 +
    beagle$ ./bench_dsp
 +
 +
== Compiling on the BeagleBoard ==
  
A this point the environment and components are all setup to build the examples and test cases
+
== Notes on upgrading ==
included in the the C6Run package.  All the makefiles for the examples and test cases rely on
+
FOUR environment variables: ARM_TOOLCHAIN_PREFIX, ARM_TOOLCHAIN_PATH, CFLAGS, and
+
C6RUN_TOOLCHAIN_PATH.  The compilation scripts (c6runlib and c6runapp scripts) rely on these
+
and the other variables from the environment.sh file. 
+
  
It is suggested that the test and example makefiles be used as a template for any builds done
+
Here's some of the things I did to upgrade from c6run_0_95_02_02_beagleboard to C6Run_0_97_03_03.
for your own code.
+
  
== Target Preparation ==
+
I haven't been successful at this yet.
  
# Setup the beagleboard to boot using the included kernel image (uImage binary file). This should just require replacing the uImage file on your SD card with the provided one (rename the file to be just '<code>uImage</code>').
+
* Download new version of bios from [http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/bios/index.html here]. I got 5.41.10.36
# Copy the the contents of the provided <code>/lib/modules</code> to the target's <code>/lib/modules</code> path. I found I didn't need to do this.
+
* Download new 'C6000 code generation tools from [https://www-a.ti.com/downloads/sds_support/TICodegenerationTools/download.htm  here]. I got v7.2.2 since that's what the files pointed to. v7.2.4 is the newest, it might work too.
# Copy the contents of c6run_target.tar.gz to the target file system.  I place it in <code>/opt</code>. It contains the kernel modules form the TI components and the loadmodules.sh script which should be used to install them.  The pre-built examples and test cases are also included in this archive
+
* Copied config.mak from c6run_0_95_02_02_beagleboard to C6Run_0_97_03_03.  I fixed the C6RUN_INSTALL_DIR path. <code>C6RUN_INSTALL_DIR=/home/yoder/BeagleBoard/C6Run_0_97_03_03/toolchains</code>
# Before running any c6run based application, make sure you run the loadmodules.sh script to load the needed kernel modules.
+

Revision as of 14:25, 18 July 2012


Use EBC Exercise 09 Using the DSP for Audio Processing instead, though you need to follow these instructions to cross compile c6run.


c6run is an easy way to use the DSP on the BeagleBoard. You can either setup your host computer to cross compile c6run for the Beagle, or compile right on the Beagle. Here's how to do each.

Setting up cross compiling on a host computer

Here are some notes on how to get c6run going on the BeagleBoard. This has been modified to add detail (4/27/2011) for the ECE4356 class.

Downloads

There are some 350M of files that need to be downloaded and installed to use c6run. The good news is you don't have to install anything else. The bad news is, if this is being used with a class, 350M * number_of_students can strain a campus internet connection. Therefore we have two options, loading from the internet (works for everyone), and loading from your campus (works if someone on your campus has already downloaded for you).

The files you need to download are:

  • C6run_m_yoder.tgz
  • ti_cgt_c6000_7.0.4_setup_linux_x86.bin
  • angstrom-2010.4-test-20100422-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.2.tar.bz2
  • bios_setuplinux_5_41_09_34.bin

C6run_m_yoder.tgz contains the following:

  1. /lib/modules from target FS
  2. uImage itself
  3. C6Run package prebuilt for the above
  4. C6Run target software
    1. Kernel modules for TI components
    2. loadmodules.sh and unloadmodules.sh
    3. pre-compiled test and and example applications

Pick your method of getting them.

From the Internet

  • Media:C6run_m_yoder.tgz comes from the eLinux site.
  • Download the TI C6000 v7.0.4 code generation tools for Linux from here
  • Download the angstrom ARM toolchain from here
  • Download the 5.41.09.34 DSP/Bios package from here

From your Campus

Go to your campus site and look for the files listed above. The following schools have the files:

Rose-Hulman
The class dfs site
UTEP
EE4356 web site

Instructions for Host Setup and Build

Now that you have downloaded the above files, here is how to install them. It's assumed that the downloaded files are in your ~/Download directory (note ~ is /home/beagle below).

Now we create the toolchains directory and populate it

  • Install the codegen tools to ~/toolchains/TI_CGT_C6000_7.04 (you implicitly accept a EULA when doing this)
    host$ mkdir ~/toolchains
    host$ cd ~/Downloads
    host$ chmod +x ti_cgt_c6000_7.0.4_setup_linux_x86.bin
    host$ ls -l ! Look for an x by ti_... to verify it is executable
    host$ ./ti_cgt_c6000_7.0.4_setup_linux_x86.bin --installto ~/toolchains --mode silent
  • Install the ARM toolchain
    host$ tar -C ~/toolchains -xjf angstrom-2010.4-test-20100422-i686-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.2.tar.bz2

The ARM toolchain will be in ~/toolchains/usr/local/angstrom/arm/

  • Install the DSP/Bios package (you implicitly accept a EULA when doing this)
    host$ chmod +x bios_setuplinux_5_41_09_34.bin
    host$ ./bios_setuplinux_5_41_09_34.bin --mode silent --prefix ~/toolchains  
  • Install the pre-built C6Run package. To do this you must first untar the c6run_m_yoder.tgz file
    host$ tar -xvzf c6run_m_yoder.tgz
    host$ cd c6run_m_yoder
    host$ tar -C ~/toolchains -xzf c6run_0_95_02_02_beagleboard.tar.gz
  • Edit the c6run environment settings to correctly point to the location of the components on your host PC (replace ${HOME} with the absolute path)
    host$ cd ~/toolchains/c6run_0_95_02_02_beagleboard
    host$ vi environment.sh
    /* the following command in vi would make the substitution on all cases */
    :1,$s/\${HOME}/\/home\/beagle
  • We now want to set up our environment variables. But first we will check to see what they are currently.
    host$ printenv ! Prints all the environment variables, note too many to see
    host$ printenv | more  ! Prints out a page at a time, hit space bar to advance
    host$ printenv | grep ARM ! Only prints lines that have “ARM” in them
    host$ printenv | grep C6 ! Only prints lines that have “C6” in them
  • The above commands, unless you ran the environment.sh command previously, should show no environment variables with ARM or C6 in them
  • Source the environment variables and rerun the checks
    host$ source environment.sh
    host$ printenv | grep ARM ! Only prints lines that have “ARM” in them
    host$ printenv | grep C6 ! Only prints lines that have “C6” in them

The preceding checks should now show that the following FOUR environment variables are set: ARM_TOOLCHAIN_PREFIX, ARM_TOOLCHAIN_PATH, CFLAGS, and C6RUN_TOOLCHAIN_PATH. At this point the environment and components are all setup to build the examples and test cases included in the the C6Run package. The compilation scripts (c6runlib and c6runapp scripts) rely on these and the other variables from the environment.sh file.

It is suggested that the test and example makefiles be used as a template for any builds done for your own code.

  • Run make to compile the example code
    host$ cd example ! You should be in /home/beagle/toolchains/c6run_0_95_02_02_beagleboard/examples
    host$ make
  • Look at the output to make sure that no errors occurred. If errors occur then either correct them or seek instructor help
  • Go into the sub directories to see the compiled code
    host$ cd c6runapp/emqbit
    host$ ls
  • You should see in the directory listing the files bench_arm and bench_dsp (among others).

I added the following lines to my Makefile in the emqbit directory:

install:
	scp bench_arm bench_dsp cfft_arm cfft_dsp root@beagle:c6run_target/examples/c6runlib/emqbit

I can now automatically install on the Beagle by running:

host$ make install

Target Preparation

It appears that if you are running a recent image, (from here for example) you don't have to install a new uImage or the modules in /lib/modules. Skip 1 and 2 below and just do 3. If it doesn't work, go back and do 1 and 2 also.

1. Setup the beagleboard to boot using the included kernel image (uImage binary file). This should just require replacing the uImage file on your SD card with the provided one (rename the file to be just 'uImage'). This step can be accomplished with the following commands, after the SD card which has the Angstrom linux system has been put into the card reader and mounted on the host system.

    host$ df ! Verify that /media/BEAGLE and /media/ANGSTROM file systems are available
    host$ cd /media/BEAGLE ! Or whichever file system has the uImage file
    host$ mv uImage uImage.bak ! Save a copy in case you mess up
    host$ cd ~/Downloads/C6run_m_yoder
    host$ cp uImage /media/BEAGLE

2. Copy the the contents of the provided /lib/modules to the target's /lib/modules path. I (Yoder) found I didn't need to do this. I (Usevitch) concur.

3. Copy the contents of c6run_target.tar.gz to the target file system. I placed it in /opt. It contains the kernel modules from the TI components and the loadmodules.sh script which should be used to install them. The pre-built examples and test cases are also included in this archive. However, we also want to see if our compiled example code will work. Therefore we will copy over our examples directory.

    host$ mkdir /media/ANGSTROM/opt
    host$ cp c6run_target.tar.gz /media/ANGSTROM/opt
    host$ cd /media/ANGSTROM/opt
    host$ tar -xvf c6run_target.tgz ! This can be done on the host or on the beagleboard when linux boots
    host$ cp -R ~/toolchains/c6run_0_95_02_02_beagleboard/examples .  ! copy our examples directory onto the SD card
    host$ cd ! can't unmount a file system in use
    host$ umount /media/ANGSTROM
    host$ umount /media/BEAGLE

Target Running

  • Remove the SD card, place it into the beagleboard, and boot Angstrom linux.
  • Before running any c6run based application, make sure you run the loadmodules.sh script to load the needed kernel modules.
   beagle$ cd /opt/home/daniel/c6run_target
   beagle$ ./unloadmodules.sh  ! sometimes modules are left over and need to be removed
   beagle$ ./loadmodules.sh 
  • Now we will run our compiled fft benchmark examples
   beagle$ cd /opt/examples/c6runapp/emqbit
   beagle$ ./bench_arm
   beagle$ ./bench_dsp

Compiling on the BeagleBoard

Notes on upgrading

Here's some of the things I did to upgrade from c6run_0_95_02_02_beagleboard to C6Run_0_97_03_03.

I haven't been successful at this yet.

  • Download new version of bios from here. I got 5.41.10.36
  • Download new 'C6000 code generation tools from here. I got v7.2.2 since that's what the files pointed to. v7.2.4 is the newest, it might work too.
  • Copied config.mak from c6run_0_95_02_02_beagleboard to C6Run_0_97_03_03. I fixed the C6RUN_INSTALL_DIR path. C6RUN_INSTALL_DIR=/home/yoder/BeagleBoard/C6Run_0_97_03_03/toolchains