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

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

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.

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.