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

From IGEP - ISEE Wiki

Jump to: navigation, search
(Created page with '= Install and configure Codeblocks for IGEP devices = == Overview == Codeblocks is a free and open source, cross-platform IDE which supports multiple compilers including GCC …')
 
Line 1: Line 1:
= Install and configure Codeblocks for IGEP devices  =
 
 
 
== Overview  ==
 
== Overview  ==
  

Revision as of 17:54, 6 August 2012

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:

  • IGEP SDK VM: follow the IGEP SDK SOFTWARE USER MANUAL (chapter 2.3 "Setting up and running the VM")
  • IGEP Firmware: follow the IGEP SDK SOFTWARE USER MANUAL (chapter 6.1 "Create IGEP firmware bootable micro-sd card")
  • IGEP Board
  • Codeblocks examples
  • MicroSD Card (optional)

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")