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

From IGEP - ISEE Wiki

Jump to: navigation, search
m
m
 
(30 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
__TOC__
 +
 
= Overview  =
 
= Overview  =
  
Line 7: Line 9:
 
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.  
 
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 Yocto Toolchain''' provides all necessary tools like a cross compiler, embedded libraries, etc. to compile program sources for IGEP devices.
 +
 
 +
'''IGEP SDK Yocto Toolchain''' 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 Yocto Toolchain  =
 +
 +
==='''IGEP OMAP3'''===
 +
Download - [http://www.isee.biz/support/downloads/item/igep-sdk-yocto-toolchain-1-2-2-3 isee.biz]
  
= Download&Install IGEP SDK =
+
follow the next steps:
 +
*Open a terminal
 +
*Located your downloaded file, in my case is inside /home/jdoe/Downloads:
 +
<pre>jdoe@ubuntu ~ $ cd Downloads/</pre>
 +
*Extract binaries in root directory with root privileges<br>
 +
<pre>jdoe@ubuntu ~/Downloads $ sudo tar jxf igep-sdk-yocto-toolchain-*.tar.bz2 -C /</pre>
 +
*Make sure that binaries are installed correctly.
 +
<pre>jdoe@ubuntu ~/Downloads $ ls /opt/poky/
 +
1.2 1.2.1 </pre>
  
Download IGEP SDK&nbsp;from [http://www.isee.biz/component/zoo/item/igep-yocto-toolcahin-sdk isee.biz] website and follow the next steps:
+
==='''IGEP iMX6'''===
 +
Download - [http://downloads.isee.biz/pub/releases/sdk/poky-glibc-x86_64-isee-fsl-image-dev-cortexa9hf-vfp-neon-toolchain-1.8.sh isee.biz]
  
 +
follow the next steps:
 
*Open a terminal  
 
*Open a terminal  
*Located your downloaded file, in my case is in /home/Downloads:
+
*Located your downloaded file, in my case is inside /home/jdoe/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>
<pre>jdoe@ubuntu ~/Downloads $ sudo tar jxf igep-sdk-yocto-toolchain-*.tar.bz2 -C /</pre>  
+
<pre>jdoe@ubuntu ~/Downloads $ sudo sh *.sh /</pre>
 
*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.8 </pre>
 +
 
  
= Use IGEP SDK  =
+
= Use IGEP SDK Yocto Toolchain =
  
IGEP SDK can be integrated with multiple IDEs, but the simplest method to prove it is using terminal:  
+
IGEP SDK Yocto Toolchain can be integrated with multiple IDEs, but the simplest method to prove it is using terminal:  
  
 
*Create source code text file:
 
*Create source code text file:
Line 47: Line 65:
 
<pre>jdoe@ubuntu ~/Desktop $ file hello-world
 
<pre>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</pre>  
 
hello-world: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped</pre>  
*Transfer arm executable file from virtual machine to IGEPv2 board
+
*Transfer arm executable file from virtual machine to IGEP Board
 
*Execute arm executable file inside IGEP Board (remote shell):<br>
 
*Execute arm executable file inside IGEP Board (remote shell):<br>
 
<pre>root@igep00x0:~# ./hello-world  
 
<pre>root@igep00x0:~# ./hello-world  
Hello world&nbsp;!</pre>  
+
Hello world&nbsp;!</pre>
[[Category:Work_in_progress]] [[Category:Development_tools]] [[Category:How_to_forge]]
+
 
 +
= Other Cross compilers for IGEP Boards  =
 +
 
 +
== Linaro Toolchain  ==
 +
 
 +
{{Message/Information Message|message=Tested in Ubuntu 12.04.}}
 +
 
 +
=== Install Toolchain  ===
 +
 
 +
Install Linaro Toolchain in Ubuntu distribution is simple, because it is officially supported at latest releases. Open a terminal and type:
 +
<pre>sudo apt-get install cpp-4.5-arm-linux-gnueabi g++-4.5-arm-linux-gnueabi </pre>
 +
For older releases you need to add Linaro Toolchain repositories:
 +
<pre>sudo add-apt-repository ppa:linaro-maintainers/toolchain
 +
sudo apt-get install cpp-4.5-arm-linux-gnueabi g++-4.5-arm-linux-gnueabi </pre>
 +
Link Linaro Toolchain 4.5:
 +
<pre>sudo ln -f -s /usr/bin/arm-linux-gnueabi-cpp-4.5  /usr/bin/arm-linux-gnueabi-cpp
 +
sudo ln -f -s /usr/bin/arm-linux-gnueabi-gcov-4.5  /usr/bin/arm-linux-gnueabi-gcov
 +
sudo ln -f -s /usr/bin/arm-linux-gnueabi-gcc-4.5  /usr/bin/arm-linux-gnueabi-gcc </pre>
 +
= IDE programs  =
 +
 
 +
An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of:
 +
 
 +
*a source code editor
 +
*build automation tools
 +
*a graphical debugger
 +
 
 +
IGEP SDK can be integrated with some popular IDEs like Eclipse, QT Creator and Codeblocks. IGEP SDK Virtual Machine includes by default Eclipse and Qt Creator to let develop applications quickly.<br>
 +
 
 +
== Eclipse  ==
 +
 
 +
''(from [[How to install Eclipse IDE]])''
 +
 
 +
{{#lst:How to install Eclipse IDE|overview}}
 +
 
 +
== QtCreator  ==
 +
 
 +
''(from [[How to install Qt Creator]])''
 +
 
 +
{{#lst:How to install Qt Creator|overview}}
 +
 
 +
== Codeblocks  ==
 +
 
 +
''(from [[Install and configure Codeblocks for IGEP devices]])''
 +
 
 +
{{#lst:Install and configure Codeblocks for IGEP devices|overview}}
 +
 
 +
 
 +
{{Message/Forum}}
 +
 
 +
[[Category:Development_tools]] [[Category:How_to_forge]]

Latest revision as of 12:48, 16 November 2016

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 Yocto Toolchain provides all necessary tools like a cross compiler, embedded libraries, etc. to compile program sources for IGEP devices.

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

Download/Install IGEP SDK Yocto Toolchain

IGEP OMAP3

Download - isee.biz

follow the next steps:

  • Open a terminal
  • Located your downloaded file, in my case is inside /home/jdoe/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 

IGEP iMX6

Download - isee.biz

follow the next steps:

  • Open a terminal
  • Located your downloaded file, in my case is inside /home/jdoe/Downloads:
jdoe@ubuntu ~ $ cd Downloads/
  • Extract binaries in root directory with root privileges
jdoe@ubuntu ~/Downloads $ sudo sh *.sh /
  • Make sure that binaries are installed correctly.
jdoe@ubuntu ~/Downloads $ ls /opt/poky/
1.8 


Use IGEP SDK Yocto Toolchain

IGEP SDK Yocto Toolchain 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 Toolchain

Install Linaro Toolchain in Ubuntu distribution is simple, because it is officially supported at latest releases. Open a terminal and type:

sudo apt-get install cpp-4.5-arm-linux-gnueabi g++-4.5-arm-linux-gnueabi 

For older releases you need to add Linaro Toolchain repositories:

sudo add-apt-repository ppa:linaro-maintainers/toolchain
sudo apt-get install cpp-4.5-arm-linux-gnueabi g++-4.5-arm-linux-gnueabi 

Link Linaro Toolchain 4.5:

sudo ln -f -s /usr/bin/arm-linux-gnueabi-cpp-4.5  /usr/bin/arm-linux-gnueabi-cpp 
sudo ln -f -s /usr/bin/arm-linux-gnueabi-gcov-4.5  /usr/bin/arm-linux-gnueabi-gcov 
sudo ln -f -s /usr/bin/arm-linux-gnueabi-gcc-4.5  /usr/bin/arm-linux-gnueabi-gcc 

IDE programs

An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of:

  • a source code editor
  • build automation tools
  • a graphical debugger

IGEP SDK can be integrated with some popular IDEs like Eclipse, QT Creator and Codeblocks. IGEP SDK Virtual Machine includes by default Eclipse and Qt Creator to let develop applications quickly.

Eclipse

(from How to install Eclipse IDE)


Eclipse is a multi-language software development environment comprising an integrated development environment (IDE) and an extensible plug-in system. It is written mostly in Java. It can be used to develop applications in Java and, by means of various plug-ins, other programming languages including Ada, C, C++, COBOL, Haskell, Perl, PHP, Python, R, Ruby (including Ruby on Rails framework), Scala, Clojure, Groovy, Android and Scheme. One of these interesting plugins is the Yocto Eclipse IDE Plug-in.

The Yocto Eclipse IDE Plug-in integrates the functionality of the Yocto Project Application Development Toolkit (ADT) and toolchain into the Eclipse IDE. This allows its users direct access to deploy, build, run and debug your own project. More information about Eclipse software here.

NOTE: If you use IGEP SDK Virtual Machine you don't need to follow this guide, go directly to How to develop with Eclipse IDE under IGEP technology


QtCreator

(from How to install Qt Creator)


This guide can be helpful to install and configure Qt SDK in your Linux Operating system. Qt is a cross-platform application framework that is widely used for developing application software with a graphical user interface, and also used for developing non-GUI programs such as command-line tools and consoles for servers. You can get more information here.

NOTE: If you use IGEP SDK Virtual Machine you don't need to follow this guide, go directly to How to develop with Qt under IGEP Technology


Codeblocks

(from Install and configure Codeblocks for IGEP devices)

Codeblocks is a free and open source, cross-platform IDE which supports multiple compilers including GCC and MSVC. It is developed in C++ using wxWidgets as the GUI toolkit. Using a plugin architecture, its capabilities and features are defined by the provided plugins. Currently, Codeblocks is oriented towards C and C++. It can also be used for creating ARM, AVR, D, DirectX, FLTK, Fortran, GLFW, GLUT, GTK+, Irrlicht, Lightfeather, MATLAB, OGRE, OpenGL, Qt, SDL, SFML, STL, SmartWin and wx programs and applications, although in some cases installing third-party SDKs or frameworks is necessary. More information here.

Codeblocks is not installed by default in IGEP SDK VM, because Eclipse IDE is full integrated with IGEP Firmware. If you don't like Eclipse IDE or you want to use Codeblocks anyway this How-to can be helpful to install, set up and use it.


Igep forum.png If you have any question, don't ask to ask at the IGEP Community Forum or the IGEP Community Chat Irc.png