How to setup a cross compiler

From IGEP - ISEE Wiki

Revision as of 16:55, 14 August 2012 by Pau (talk | contribs)

Jump to: navigation, search

Overview

Cross-development in general, refers to the overall software development process that eventually produces a single application or a complete system running on an platform that is different from the development platform. This is accomplished using a cross-compiler toolchain and cross-compiled libraries.

Peter Seebach defines cross-compilation as follows: "Cross compilation occurs when a compiler running on one system produces executables for another system -- this is an important concept when the target system doesn't have a native set of compilation tools, or when the host system is faster or has greater resources."

Cross-development usually involves two different platforms, the host platform where actual development work takes place, and the target platform where the final application is tested and run.

IGEP SDK provides all necessary tools like a cross compiler, embedded libraries, etc. to compile program sources for IGEP devices.

IGEP SDK is included in IGEP SDK Virtual Machine but you can install in other Linux operating system.

Download/Install IGEP SDK

Download IGEP SDK from isee.biz website and follow the next steps:

  • Open a terminal
  • Located your downloaded file, in my case is in /home/Downloads:
jdoe@ubuntu ~ $ cd Downloads/
  • Extract binaries in root directory with root privileges
jdoe@ubuntu ~/Downloads $ sudo tar jxf igep-sdk-yocto-toolchain-*.tar.bz2 -C /
  • Make sure that binaries are installed correctly.
jdoe@ubuntu ~/Downloads $ ls /opt/poky/
1.2  1.2.1 

Use IGEP SDK

IGEP SDK can be integrated with multiple IDEs, but the simplest method to prove it is using terminal:

  • Create source code text file:

First of all you need to initialize a suitable environment in the bash shell console inside your machine.
You can do this sourcing once the environment-setup script.

jdoe@ubuntu ~ $ source /opt/poky/1.2/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi 

Create a single .c file (hello-world.c), using your preferred editor (vi, nano, gedit, ...)
hello-world.c:

#include <stdio.h> 
int main (int argc, char **argv)
{
  printf("Hello world !\n");
  return 0;
}
  • Build arm binary executable:

Cross toolchain tools are available into the built-in virtual machine Poky SDK. You only need open bash terminal prompt and write commands:

jdoe@ubuntu ~/Desktop $ arm-poky-linux-gnueabi-gcc -o hello-world hello-world.c
  • Check binary created:
jdoe@ubuntu ~/Desktop $ file hello-world
hello-world: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
  • Transfer arm executable file from virtual machine to IGEP Board
  • Execute arm executable file inside IGEP Board (remote shell):
root@igep00x0:~# ./hello-world 
Hello world !

Other Cross compilers for IGEP Boards

Linaro Toolchain

Information.jpg Tested in Ubuntu 12.04.

Install