Difference between revisions of "How to setup a cross compiler"

From IGEP - ISEE Wiki

Jump to: navigation, search
m
m
Line 11: Line 11:
 
IGEP SDK is included in IGEP SDK Virtual Machine but you can install in other Linux operating system.  
 
IGEP SDK is included in IGEP SDK Virtual Machine but you can install in other Linux operating system.  
  
= Download&Install IGEP SDK =
+
= Download&Install IGEP SDK =
  
 
Download IGEP SDK from [http://www.isee.biz/component/zoo/item/igep-yocto-toolcahin-sdk isee.biz] website and follow the next steps:  
 
Download IGEP SDK from [http://www.isee.biz/component/zoo/item/igep-yocto-toolcahin-sdk isee.biz] website and follow the next steps:  
  
 
*Open a terminal  
 
*Open a terminal  
*Located your downloaded file, in my case is in Downloads directory located in my home folder:
+
*Located your downloaded file, in my case is in /home/Downloads:
 
<pre>jdoe@ubuntu ~ $ cd Downloads/</pre>  
 
<pre>jdoe@ubuntu ~ $ cd Downloads/</pre>  
 
*Extract binaries in root directory with root privileges<br>
 
*Extract binaries in root directory with root privileges<br>
Line 22: Line 22:
 
*Make sure that binaries are installed correctly.
 
*Make sure that binaries are installed correctly.
 
<pre>jdoe@ubuntu ~/Downloads $ ls /opt/poky/
 
<pre>jdoe@ubuntu ~/Downloads $ ls /opt/poky/
1.2  1.2.1 </pre>  
+
1.2  1.2.1 </pre>
 +
 
 
= Use IGEP SDK  =
 
= Use IGEP SDK  =
  

Revision as of 16:46, 14 August 2012

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 virtual 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 IGEPv2 board
  • Execute arm executable file inside IGEP Board (remote shell)
root@igep00x0:~# ./hello-world 
Hello world !