Programming for A13 in debian

Revision as of 01:06, 30 December 2012 by Scott (talk | contribs)

THIS IS A WORK IN PROGRESS

Programming for A13 in debian

There are 2 main methods to create programs for your A13 board.

  • Cross compiling - Setting up a tool chain to compile on another system, which is typically faster and easier to manage.
  • Programming on board - installing a compiler to compile directly on the board


The sections below contain instructions for these 2 methods

Cross Compiling

Cross compiling is usually performed on another linux machine, it seems the most common for doing this is ubuntu.

If you have compiled the kernel and setup the SD card you will already have most of the tool chain setup on your machine

Setting up the tool chain

The following instructions are to be performed on a linux machine which is not the A13 board.

Complete the following steps to setup the tool chain.

These instructions have been tested on ubuntu only however they may work for other distributions.

Install eclipse

Eclipse is a GUI which enables easy compilation and debugging when the appropriate tools have been installed.

This may be able to be installed using the package manager on your linux system.

Manual eclipes install
To manually install the most up to date eclipse perform the following

Go to the eclipse download section

Eclipse download Download to your linux machine the suitable eclipse version.

Decompress the downloaded file into any directory you like by moving the downloaded file to your desired directory. Open a terminal, go to the directory and decompress with the command

tar -xzvf FILENAME.

This will create a directory in this location called eclipse Within this directory is the executable eclipse.exe

It is recommended to create a launcher on your desktop which points to this executable file to make it easier to start.

Manual Java runtime install
As eclipse is written in java the jave runtime is required as well.

Download the java runtime.

Java download page Download the java RPM file that your eclipse version requires.

Follow the instructions on the java download page beside the download to install

Your eclipse installation should now start up.

Install the tool chain

The instructions contained in this wiki were originally sourced from this page Debugging on embedded using opensource tools

To compile code for the A13 the ArmV5 tool chain is required.

Change to super user
# sudo su

Install compilers, libs and make # apt-get install gcc g++ make libncurses5-dev

Open the repository file
/etc/apt/sources.list

Add the following line
deb http://www.emdebian.org/debian/ squeeze main

update the repository info
# apt-get update

install some packages
# apt-get install linux-libc-dev-armel-cross
# apt-get install libc6-armel-cross
# apt-get install libc6-dev-armel-cross
# apt-get install binutils-arm-linux-gnueabi
# apt-get install gcc-4.4-arm-linux-gnueabi
# apt-get install g++-4.4-arm-linux-gnueabi
# apt-get install uboot-mkimage

The tool chain should now be installed

Creating a hello world program using eclipse

Follow this tutorial to create a hello world program Debugging on embedded using opensource tools


Some issues found for some users:

- Issue : After having installed eclipse and the toolchain the path and prefix for the compiler as listed in the example could not be found.

Solution : Look for the same prefix in a different path, /usr/bin is likely to hold the files.

- Issue : Having built the program and copied it to the A13 board it will not run resulting in "permission denied"

Solution: Check the permissions for the file are set to allow execution by typing #ls -l . if you dont see a lot of x's (3) in the first column its likely your cause. To change the permissions type #chmod ugo+x FileName

- Issue : executing the file returns "command not found"

Solution: A library file can not be found this is either /lib/ld-linux.so.3 or /lib/ld-linux-armhf.so.3 . To find the specific one your file is looking for open the executable in a text editor on the first line or 2 you will find the file name its looking for ld-linux.so.3 .

Programming on the A13 board