Getting Started With C6Run On Beagleboard

From Texas Instruments Wiki
Jump to: navigation, search

END OF LIFE

C6Run is still available for download, but is no longer being actively developed or maintained. Please consider other alternatives such as, Codec Engine IUNIVERSAL support, OpenCL or RCM.

^ Up to main C6EZRun Main Page ^

This article is part of a collection of articles describing the C6EZRun Software Development Project. Select the link above to return to the main project page.

Introduction

This page contains info on how to get started using C6Run on the Beagleboard or Beagleboard-XM community platforms.


System Setup for Angstrom Development

Before running the various scripts and utilities required to download and build the Beagleboard components, you will need to setup your Linux development box. The examples below are intended for use in an Ubuntu 10.04 host environment. They may vary depending on what Linux distribution you are using.

Proxy Setup

This step may not be required depending on your Internet connection.

  • Set http_proxy and ftp_proxy environment variables
~$ export http_proxy=http://<proxy server>:<port>
~$ export ftp_proxy=http://<proxy server>:<port>
  • Set no_proxy environment variable:
~$ export no_proxy=localhost,127.0.0.0/8
  • Force proxy for wget utility (OEBB can override your environment variable settings):
~$ sudo chmod a+w /etc/wgetrc
~$ vi /etc/wgetrc

(Uncomment and set lines containing http_proxy, ftp_proxy, and use_proxy)

Git Setup

  • Install git
     ~$ apt-get install git-core
  • Setup git proxy (this step will not be required if you are not behind a proxy):
    • Install corkscrew
       ~$ apt-get install corkscrew
    • Create git proxy file (i.e. ~/git-proxy.sh) with contents:
      #!/bin/bash
      export PROXYHOST=<proxy server>
      export PROXYPORT=<proxy port>
      exec env corkscrew ${PROXYHOST} ${PROXYPORT} $*
    • Set GIT_PROXY_COMMAND environment variable:
       ~$ export GIT_PROXY_COMMAND=/path/to/git-proxy.sh

OpenEmbedded and Angstrom Setup

  1. Create local repository for OEBB:
      ~/Git$ git clone git://gitorious.org/angstrom/angstrom-setup-scripts.git angstrom-setup-scripts
  2. From repository, run OEBB config (select the platform you want to build for) and update. This may take a while to execute:
     ~/Git/angstrom-setup-scripts$ ./oebb.sh config beagleboard
     ~/Git/angstrom-setup-scripts$ ./oebb.sh update
    Note that if you later switch platforms you need to manually delete the build/conf path, as the oebb.sh script does not create a new one if one already exists.
     ~/Git/angstrom-setup-scripts$ rm -Rf build/conf


Building Base Image for Beagleboard

  • Source the OpenEmbedded environment settings.
     ~/Git/angstrom-setup-scripts$ . ~/.oe/environment
  • Use Angstrom to build console-image for the configured platform. This can take an extremely long time (>24 hours).
     ~/Git/angstrom-setup-scripts$ bitbake base-image console-image

At this point, you will have a base console root filesystem and binary bootloader and kernel images in the angstrom-setup-scripts/build/tmp-angstrom_2008_1/deploy/glibc/images/beagleboard directory.


Installing Images for Beagleboard to SD card for Boot

We are only interested in the kernel image and the filesystem archive, and we will simply replace the ones on the bootable SD card with these new versions. Note that we are assuming that you are starting with an SD card that actually already boots. If you haven't yet reached that milestone, please look here for information on how to get started.

  • Insert the SD card into the host PC and mount the boot partition and the rootfs partition. The following instructions will assume that the boot partition of the SD card is mounted as /media/boot and the rootfs partition of the SD card is mounted as /media/rootfs. Depending on the type of SD card reader in use, they also could be mounted as /dev/sdb1 and /dev/sdb2, or something similar. The mount point may vary from system to system. You can use the 'mount -l' command to see what file systems are mounted and where.
  • Replace the uImage kernel image file on the boot partition.
     ~/Git/angstrom-setup-scripts$ mv /media/boot/uImage /media/boot/uImage.old
     ~/Git/angstrom-setup-scripts$ cp build/tmp-angstrom_2008_1/deploy/glibc/images/beagleboard/uImage-beagleboard.bin /media/boot/uImage
  • Replace the file system on the rootfs partition.
     ~/Git/angstrom-setup-scripts$ sudo rm -Rf /media/rootfs/*
     ~/Git/angstrom-setup-scripts$ sudo tar -C /media/rootfs/ -xjf build/tmp-angstrom_2008_1/deploy/glibc/images/beagleboard/console-image-beagleboard.tar.bz2
  • Attempt to boot using the new kernel and file system. If the SD card was previously bootable, it should now boot in the same way.


Building and installing an Angstrom SDK

To build applications that rely on the ARM and the DSP we want to have a target SDK on our host, with a GCC cross compiler for the ARM and the TI C6000 compiler tools.

  • Use Angstrom to build an SDK package. This can take an extremely long time (>24 hours).
     ~/Git/angstrom-setup-scripts$ bitbake meta-toolchain
  • Install the SDK package.
     ~/Git/angstrom-setup-scripts$ sudo tar -C / -xjf build/tmp-angstrom_2008_1/deploy/glibc/sdk/angstrom-<stuff>-toolchain.tar.bz2 
    The Angstrom SDK is now installed in /usr/local/angstrom/arm. You may also have an extras package. Install it the same way.
     ~/Git/angstrom-setup-scripts$ sudo tar -C / -xjf build/tmp-angstrom_2008_1/deploy/glibc/sdk/angstrom-<stuff>-toolchain-extras.tar.bz2 
  • Claim ownership of the SDK path so you have complete access to it.
     ~/Git/angstrom-setup-scripts$ chown -R $USER:$USER /usr/local/angstrom/arm

Now we need to get the TI C6000 Code Generation tools. These can be downloaded from the TI website. You need a my.ti.com login to actually get to the download. The latest release is recommended for use.

  • Install the C6000 code generation tools into the SDK path.
     ~$ chmod +x Downloads/ti_cgt_c6000_7.0.4_setup_linux_x86.bin
     ~$ ./Downloads/ti_cgt_c6000_7.0.4_setup_linux_x86.bin --mode silent --prefix /usr/local/angstrom/arm/ti_cgt_c6000_7.0.4

At this point, we have the ARM cross-compiler and the DSP cross-compiler installed and ready to be used.


Downloading and installing C6Run for DSP Development

  • You should follow these instructions to download the latest C6Run package for stand-alone use.
  • Open a new terminal window, and go into the SDK directory you installed earlier.
     ~$ cd /usr/local/angstrom/arm
    Source the Angstrom SDK environment variables.
     /usr/local/angstrom/arm$ . ./environment-setup
  • Untar the C6Run package into the SDK path.
     /usr/local/angstrom/arm$ tar xzf C6Run_x_yy_zz_ww.tar.gz
    Enter into the C6Run path.
     /usr/local/angstrom/arm$ cd C6Run_x_yy_zz_ww
  • Edit the Rules.mak file to point to the correct install directory for the ARM and DSP compilers. Here is an example version (unzip it), based on the preceding instructions: File:Rules.zip
  • Get the required dependent components.
     /usr/local/angstrom/arm/C6Run_x_yy_zz_ww$ make get_components
  • Edit the platforms/beagleboard/platforms.mak to point to the Angstrom build of the Linux kernel. Here is an example version (unzip it), based on the preceding instructions: File:Platform.zip
  • You can also edit the platforms/beagleboard/platform.mak file to specify the DSP memory map. You simply need to set the DSP_REGION_BASE_ADDR, DSP_REGION_CMEM_SIZE, and DSP_REGION_CODE_SIZE variables. The sum of DSP_REGION_CMEM_SIZE and DSP_REGION_CODE_SIZE specify the total amount of memory, starting at the physical address specified in DSP_REGION_BASE_ADDR, that will be allocated to DSP use (as shared buffer memory and actual DSP code). These values can also be overridden on the command-line during the config step. Based on the values provided here, the kernek bootargs used in u-boot will need to specify what physical memory region the Linux OS uses for itself such that the kernel will not use the physical memory given to the DSP.
  • Select the appropriate platform (beagleboard/beagleboard-xM) for C6Run.
     /usr/local/angstrom/arm/C6Run_x_yy_zz_ww$ make beagleboard_config
  • Build the C6Run backend libaries for the selected platform.
     /usr/local/angstrom/arm/C6Run_x_yy_zz_ww$ make all
  • Build the kernel modules against the Linux kernel pointed to by the platform.mak file.
     /usr/local/angstrom/arm/C6Run_x_yy_zz_ww$ make modules
  • Build the examples and test programs for the selected platform. First you need to source the correct environment variables that the C6Run example Makefile needs.
     /usr/local/angstrom/arm/C6Run_x_yy_zz_ww$ source ./environment.sh
    Now you can build the examples and tests.
     /usr/local/angstrom/arm/C6Run_x_yy_zz_ww$ make examples tests


Running C6Run programs on the Beagleboard

  • Put the SD card back in the host PC. Install the test and example programs, the kernel modules, and the module loading scripts to the target file system.
     /usr/local/angstrom/arm/C6Run_x_yy_zz_ww$ su -c 'make INSTALL_DIR=/media/rootfs/opt install_programs'
  • Safely remove (unmount, flush writes, etc.) the SD card and use it to boot the beagleboard.
  • Boot the beagleboard with this SD card. Login as root
  • If you followed the directions above, the examples. tests, and kernel modules will all be in /opt of the beagleboard root filesystem. Load the kernel modules.
     root@beagleboard:~# cd /opt
     root@beagleboard:/opt# ./loadmodules.sh
  • Now you can go into the examples or test paths and run the programs available there. Most programs have both an '_arm' and '_dsp' version, indicating that the same code was built for both target processor cores.