Difference between revisions of "User:Pau pajuelo"
From IGEP - ISEE Wiki
(→Download and install Qt demo image to a SD) |
|||
Line 88: | Line 88: | ||
<pre>cd Desktop/ | <pre>cd Desktop/ | ||
wget http://downloads.isee.biz/denzil/binary/qt4e-demo-image-igep00x0.tar.bz2 | wget http://downloads.isee.biz/denzil/binary/qt4e-demo-image-igep00x0.tar.bz2 | ||
− | + | git clone git://git.isee.biz/pub/scm/igep-tools.git | |
− | + | cd igep-tools/scripts</pre> | |
− | cd | ||
Insert a SD-Card media and use the igep-media-create script to copy the firmware to SD-Card media, required options are: | Insert a SD-Card media and use the igep-media-create script to copy the firmware to SD-Card media, required options are: | ||
Revision as of 10:23, 30 July 2012
Contents
Write your first C Program using Eclipse IDE
Overview
Eclipse IDE is a software development environtment, this software package is very popular because you can extend its functionalities using pluggins. C applications can be compiled in Eclipse using Autoconf tools or Makefile. Autoconf tools can be useful if you want to develop a huge application with a lot of software dependencies, but this method can be tedious if you want to develop a simple application.
At IGEP v3.0 VM, Eclipse includes Linux tools and Yocto plugin to develop C applications for IGEP firmware as quickly and easily as possible.
Pre-requisites
To follow this How-to you need:
- VMware or VirtualBox virtualization software
- IGEP SDK v3.0 Virtual Machine RC2 with Eclipse IDE
- IGEP BOARD with Ethernet communication (for example IGEPv2)
- MANUAL IGEP SDK v3.0 VM
Getting started
First at all, you should read MANUAL IGEP SDK v3.0 VM and follow the next instructions:
- Install your Virtual Machine
- Install your Virtual Machine Guest additions
- Prepare your Rootfs in your Micro SD Card
- Connect to your IGEP Board using Ethernet Commnication
- Build programs using Eclipse IDE
Hello world compiled with Eclipse
If you follow "Getting started" chapter you have compiled some source example programs for Eclipse, these programs use Autotools to generate binary code for IGEP. Now is time to compile your Helloworld example program without using autotools.
Create your new project:
Open Eclipse->File->New->C Project
At C Project Window:
Yocto Project ADT Project ->Empty Project
Insert your project name and finish. At Project explorer panel you will see your new project
Create your source files:
Go to New C/C++ Source File button and write at "Source file:" field your source file name, for example main.c. Finish the assistant and copy the next code at this file:
#include <stdio.h> int main(void) { printf("Hello world\n"); return 0; }
Follow the instructions above and create a Source File named Makefile and copy the next code:
all: main.c $(CC) -g -O0 -o main main.c clean: rm -f main main.o
CC is an environment variable that links with arm-poky-linux-gnueabi-gcc binary (IGEP SDK GCC). Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. It is very useful because you can generate a Makefile that can be compiled with multiple toolchains.
IGEP SDK Environtment variables are located at /opt/poky/1.2/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi. You can add this variables using "source" command or see your current environtment variables using "env" command.
If you need to develop more complex programs, you should read this Makefile tutorial.
Compile your program:
Now you can compile, run and debug your program using the MANUAL IGEP SDK v3.0 VM
How to develop with Qt under IGEP
Overview
This guide can be helpful to learnt to develop Qt applications under IGEP Boards. 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.
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 Qt Demo: follow the IGEP SDK SOFTWARE USER MANUAL (chapter 6.1 "Create IGEP firmware bootable micro-sd card") and install qt4e-demo-image-igep00x0.tar.bz2 instead IGEP firmware.
- IGEPv2, IGEP BERLIN or IGEP PARIS
- MicroSD Card (at least 2Gbytes)
"Link software "
Download and install Qt demo image to a SD
Once you have open IGEP SDK VM, launch a terminal and type:
cd Desktop/ wget http://downloads.isee.biz/denzil/binary/qt4e-demo-image-igep00x0.tar.bz2 git clone git://git.isee.biz/pub/scm/igep-tools.git cd igep-tools/scripts
Insert a SD-Card media and use the igep-media-create script to copy the firmware to SD-Card media, required options are:
- --mmc </dev/sdX>
unformated MMC Card
- --image <filename>
specify file used to create the bootable SD card.
- --machine <machine>
specify the machine. Options are igep0020, igep0030 or igep0032
For example, assuming the SD card device takes "/dev/sdf" and you have and IGEPv2 board (igep0020), type:
./igep-media-create --mmc /dev/sdf --machine igep0020 --image /home/jdoe/Desktop/qt4e-demo-image-igep00x0.tar.bz2
This should give you a bootable SD-card
Prepare Qt demo image
Qt demo image is a root filesystem build by Yocto that contains Qt embedded libraries, also this image has some Qt examples for testing purposes.
This image doesn't have openssh and gdbserver, so we should install these packages to develop Qt applications. Open a shell prompt using serial communication (IGEP SDK SOFTWARE MANUAL chapter 3.1 "Using serial mode") and type the following commands:
zypper ref zypper in openssh zypper in gdbserver
Now you can connect between IGEP and VM using SSH protocol:
ssh root@"IGEP IP for example: 192.168.5.1"
Using Qt Creator
First Steeps
Open Program:
Go to Applications -> IGEP development -> Qt Creator
|
|
Open an example:
Copy your desired example from: /opt/QtSDK/Examples/4.7 to your desktop.
NOTE: some examples (like hellogl) cannot be compiled to ARM
Open this example with Qt Creator, set Desktop target and use for each Qt Version one debug and one release
ARM Platform
Build Programs
To compile to ARM for IGEP go to Project use the following configuration at Projects field -> Build:
NOTE: Use Debug Release if you want to debug later
Compile with: Build->Clean All and Build->Build All (Ctrl+Shift+B).
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"
NOTE: You cannot use igep-remote-x program because Qt-demo image doesn't have X installed.
Debug 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 gdbserver:
ssh root@"IGEP IP for example: 192.168.5.1" gdbserver "hostip,for example "VM IP for example: 192.168.5.10":1000 "pathtobinary" "optional:armguments"
Now use the followings steps to debug program:
Set breakpoints in your source code
At Start Debugger window (image 3), use the following configuration:
- Debugger: /opt/poky/1.2/sysroots/i686-pokysdk-linux/usr/bin/armv7a-vfp-neon-poky-linux-gnueabi/arm-poky-linux-gnueabi-gdb
- Local executable: "pathtohostbinary"
- Host and port: "IGEP IP for example: 192.168.5.1":1000
- Architecture: arm
- GNU target: arm-none-linux-gnueabi
- Sysroot: /opt/poky/1.2/sysroots/armv7a-vfp-neon-poky-linux-gnueabi
- Location of debugging information: (empty)
- Override host GDB starrt script. (empty)
NOTE: You cannot use igep-remote-x program because Qt-demo image doesn't have X installed.
x86 Platform
Build Programs
To compile to x86 go to Project use the following configuration at Projects field -> Build:
NOTE: Use Debug Release if you want to debug later
Compile with: Build->Clean All and Build->Build All (Ctrl+Shift+B).
Run Programs
Use run button (Ctrl+R).
Debug Programs
Set breakpoints in your source code and press debug button (F5)