Difference between revisions of "Install and configure Codeblocks for IGEP devices"

From IGEP - ISEE Wiki

Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== Overview  ==
 
== Overview  ==
 +
<section begin=overview />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 [http://en.wikipedia.org/wiki/Codeblocks here].<br>
  
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 [http://en.wikipedia.org/wiki/Codeblocks here].<br>
+
Codeblocks is not installed by default in IGEP&nbsp;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.<section end=overview />
 
 
Codeblocks is not installed by default in IGEP&nbsp;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.<br>  
 
  
 
== Requirements  ==
 
== Requirements  ==
Line 9: Line 8:
 
There are some requisites to follow this guide:  
 
There are some requisites to follow this guide:  
  
*[http://isee.biz/component/zoo/item/igep-virtual-machine-sdk-yocto IGEP SDK VM]: follow the IGEP&nbsp;SDK&nbsp;SOFTWARE&nbsp;USER&nbsp;MANUAL (chapter 2.3 "Setting up and running the VM")<br>  
+
*[https://isee.biz/support/downloads/item/igep-virtual-machine-sdk-2-0 IGEP SDK VM]: follow the [http://isee.biz/component/zoo/item/igep-sdk-software-user-manual IGEP&nbsp;SDK&nbsp;SOFTWARE&nbsp;USER&nbsp;MANUAL] (chapter 2.3 "Setting up and running the VM")<br>  
*[http://isee.biz/component/zoo/item/igep-firmware-yocto-1-2 IGEP Firmware]: follow the IGEP&nbsp;SDK SOFTWARE&nbsp;USER&nbsp;MANUAL (chapter 6.1 "Create IGEP firmware bootable micro-sd card") <br>  
+
*[http://isee.biz/component/zoo/item/igep-firmware-yocto-1-2 IGEP Firmware]: follow the [http://isee.biz/component/zoo/item/igep-sdk-software-user-manual IGEP&nbsp;SDK SOFTWARE&nbsp;USER&nbsp;MANUAL] (chapter 6.1 "Create IGEP firmware bootable micro-sd card") <br>  
 
*IGEP Board  
 
*IGEP Board  
 
*[http://downloads.isee.biz/pub/files/CodeBlocks_examples.tar.bz2 Codeblocks examples]  
 
*[http://downloads.isee.biz/pub/files/CodeBlocks_examples.tar.bz2 Codeblocks examples]  
Line 31: Line 30:
 
<pre>chmod a+x ~/Desktop/IGEP\ development/Codeblocks.sh
 
<pre>chmod a+x ~/Desktop/IGEP\ development/Codeblocks.sh
 
</pre>  
 
</pre>  
{| cellspacing="1" cellpadding="1" border="1" width="200"
+
{| border="1" width="200" cellspacing="1" cellpadding="1"
 
|-
 
|-
 
| [[Image:Opencodeblocks1.png|331px]]<br>  
 
| [[Image:Opencodeblocks1.png|331px]]<br>  
Line 43: Line 42:
 
Follow the next instructions to add IGEP SDK&nbsp;Yocto support:  
 
Follow the next instructions to add IGEP SDK&nbsp;Yocto support:  
  
{| cellspacing="1" cellpadding="1" border="1" width="200"
+
{| border="1" width="200" cellspacing="1" cellpadding="1"
 
|-
 
|-
 
| [[Image:Addsdkcodeblocks1.png|250px]]  
 
| [[Image:Addsdkcodeblocks1.png|250px]]  
Line 82: Line 81:
 
Download CodeBlocks_examples.tar.bz2 and folow the next instructions:<br>  
 
Download CodeBlocks_examples.tar.bz2 and folow the next instructions:<br>  
  
{| cellspacing="1" cellpadding="1" border="1" width="200"
+
{| border="1" width="200" cellspacing="1" cellpadding="1"
 
|-
 
|-
 
| [[Image:Addcodeblockexample1.png|250px]]  
 
| [[Image:Addcodeblockexample1.png|250px]]  
Line 118: Line 117:
 
Now use the followings steps to debug program:<br>  
 
Now use the followings steps to debug program:<br>  
  
{| cellspacing="1" cellpadding="1" border="1" width="200"
+
{| border="1" width="200" cellspacing="1" cellpadding="1"
 
|-
 
|-
 
| [[Image:Debugcodeblocks1.png|331px]]  
 
| [[Image:Debugcodeblocks1.png|331px]]  
Line 129: Line 128:
 
Image 1: set breakpoints in your source code  
 
Image 1: set breakpoints in your source code  
  
'''NOTE:''' You cant use igep-remote-x program with IGEP firmware (chapter 3.3 "Remote X")<br>
+
'''NOTE:''' You cant use igep-remote-x program with IGEP firmware (chapter 3.3 "Remote X")
 +
 
 +
 
 +
{{Message/Forum}}
 +
 
 +
[[Category:Software]] [[Category:Software_applications]] [[Category:Tutorials]]

Latest revision as of 09:15, 25 November 2014

Overview

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.

Requirements

There are some requisites to follow this guide:

Install Codeblocks in VM

sudo apt-get install codeblocks codeblocks-contrib 

Configure Codeblocks

Startup script

Codeblocks startup script (Codeblocks.sh) will let you to load IGEP SDK YOCTO environtment variables to IDE. Don't execute this script if you want to compile with other environtments like x86.

cd Desktop/IGEP\ development/
gedit Codeblocks.sh

Copy this code to Codeblocks.sh

#! /bin/bash
source /opt/poky/1.2/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi 
exec codeblocks 

Give execute privileges to script:

chmod a+x ~/Desktop/IGEP\ development/Codeblocks.sh
Opencodeblocks1.png
Opencodeblocks2.png


Add IGEP SDK Compiler and Debugger

Follow the next instructions to add IGEP SDK Yocto support:

Addsdkcodeblocks1.png Addsdkcodeblocks2.png Addsdkcodeblocks3.png
Addsdkcodeblocks4.png Addsdkcodeblocks5.png Addsdkcodeblocks6.png

Click to enlarge image

Image 4: Compiler installation directory is: /opt/poky/1.2/sysroots/i686-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi

Image 6: Add to Debugger intialization commands:

  • set sysroot /opt/poky/1.2/sysroots/armv7a-vfp-neon-poky-linux-gnueabi/
  • set auto-solib-add off

Save all changes

Using Codeblocks

You can create two types of projects on Codeblocks: custom Makefile or managed by Codeblocks. These examples can be used as a template for your project. The examples are:

  • C_example, Codeblocks-based “Hello World” program written in C.
  • Cairo_example, generates a png file named hello.png.
  • Cpp_example, Codeblocks-based “Hello World” program written in C++
  • Dbus_example, sends "Hello Wolrd!" using D-Bus message system.
  • Glib_example, simple “Hello World" written using Glib library.
  • Gstreamer_example, ogg audio player using Gstreamer.
  • Gtk_example, Hello World in GTK.
  • C_example_without_autotools, custom Makefile “Hello World” program written in C.

Add Codeblocks examples to Workspace

Download CodeBlocks_examples.tar.bz2 and folow the next instructions:

Addcodeblockexample1.png Addcodeblockexample2.png Addcodeblockexample3.png
Addcodeblockexample4.png Addcodeblockexample4.png Addcodeblockexample6.png

Build programs

NOTE: Use Debug build if you want to debug later

Compile with: Build->Rebuild (Ctrl+F11).

Run programs

Once you compiled the program pass it from VM to IGEP via SSH, launch a terminal and type:

scp "pathtobinary" root@"IGEP IP for example: 192.168.5.1":/home/root

Get a remote shell prompt and run your program:

ssh root@"IGEP IP for example: 192.168.5.1"
./"binary"  "optional:arguments"

Debug programs

NOTE: When you debug programs using CodeBlocks "Step into" and "Step out" are not supported, because dinamic libraries symbols are not loaded by gdb.

Once you compiled the program pass it from VM to IGEP via SSH, launch a terminal and type:

scp "pathtobinary" root@"IGEP IP for example: 192.168.5.1":/home/root

Get a remote shell prompt and run gdbserver:

ssh root@"IGEP IP for example: 192.168.5.1"
gdbserver "VM IP for example: 192.168.5.10":1000 "pathtobinary" "optional:armguments"

Now use the followings steps to debug program:

Debugcodeblocks1.png Debugcodeblocks2.png
Debugcodeblocks3.png Debugcodeblocks4.png

Image 1: set breakpoints in your source code

NOTE: You cant use igep-remote-x program with IGEP firmware (chapter 3.3 "Remote X")


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