1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
|
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
<chapter id='adt-eclipse'>
<title>Working Within Eclipse</title>
<para>
The Eclipse IDE is a popular development environment and it fully supports
development using Yocto Project.
When you install and configure the Eclipse Yocto Project Plug-in into
the Eclipse IDE, you maximize your Yocto Project design experience.
Installing and configuring the Plug-in results in an environment that
has extensions specifically designed to let you more easily develop software.
These extensions allow for cross-compilation, deployment, and execution of
your output into a QEMU emulation session.
You can also perform cross-debugging and profiling.
The environment also supports a suite of tools that allows you to perform
remote profiling, tracing, collection of power data, collection of
latency data, and collection of performance data.
</para>
<para>
This section describes how to install and configure the Eclipse IDE
Yocto Plug-in and how to use it to develop your Yocto Project.
</para>
<section id='setting-up-the-eclipse-ide'>
<title>Setting Up the Eclipse IDE</title>
<para>
To develop within the Eclipse IDE, you need to do the following:
<orderedlist>
<listitem><para>Install the optimal version of the Eclipse IDE.</para></listitem>
<listitem><para>Configure the Eclipse IDE.</para></listitem>
<listitem><para>Install the Eclipse Yocto Plug-in.</para></listitem>
<listitem><para>Configure the Eclipse Yocto Plug-in.</para></listitem>
</orderedlist>
</para>
<section id='installing-eclipse-ide'>
<title>Installing the Eclipse IDE</title>
<para>
It is recommended that you have the Indigo 3.7.2 version of the
Eclipse IDE installed on your development system.
If you don’t have this version, you can find it at
<ulink url='&ECLIPSE_MAIN_URL;'></ulink>.
From that site, choose the Eclipse Classic version particular to your development
host.
This version contains the Eclipse Platform, the Java Development
Tools (JDT), and the Plug-in Development Environment.
</para>
<para>
Once you have downloaded the tarball, extract it into a clean
directory.
For example, the following commands unpack and install the Eclipse IDE
tarball found in the <filename>Downloads</filename> area
into a clean directory using the default name <filename>eclipse</filename>:
<literallayout class='monospaced'>
$ cd ~
$ tar -xzvf ~/Downloads/eclipse-SDK-3.7.1-linux-gtk-x86_64.tar.gz
</literallayout>
</para>
<para>
One issue exists that you need to be aware of regarding the Java
Virtual machine’s garbage collection (GC) process.
The GC process does not clean up the permanent generation
space (PermGen).
This space stores metadata descriptions of classes.
The default value is set too small and it could trigger an
out-of-memory error such as the following:
<literallayout class='monospaced'>
Java.lang.OutOfMemoryError: PermGen space
</literallayout>
</para>
<para>
This error causes the application to hang.
</para>
<para>
To fix this issue, you can use the <filename>--vmargs</filename>
option when you start Eclipse to increase the size of the permanent generation space:
<literallayout class='monospaced'>
eclipse --vmargs --XX:PermSize=256M
</literallayout>
</para>
</section>
<section id='configuring-the-eclipse-ide'>
<title>Configuring the Eclipse IDE</title>
<para>
Before installing and configuring the Eclipse Yocto Plug-in, you need to configure
the Eclipse IDE.
Follow these general steps to configure Eclipse:
<orderedlist>
<listitem><para>Start the Eclipse IDE.</para></listitem>
<listitem><para>Make sure you are in your Workbench and select
"Install New Software" from the "Help" pull-down menu.
</para></listitem>
<listitem><para>Select <filename>indigo - &ECLIPSE_INDIGO_URL;</filename>
from the "Work with:" pull-down menu.</para></listitem>
<listitem><para>Expand the box next to <filename>Programming Languages</filename>
and select the <filename>Autotools Support for CDT (incubation)</filename>
and <filename>C/C++ Development Tools</filename> boxes.</para></listitem>
<listitem><para>Expand the box next to "Linux Tools" and select the
"LTTng - Linux Tracing Toolkit(incubation)" boxes.</para></listitem>
<listitem><para>Complete the installation and restart the Eclipse IDE.</para></listitem>
<listitem><para>After the Eclipse IDE restarts and from the Workbench, select
"Install New Software" from the "Help" pull-down menu.</para></listitem>
<listitem><para>Click the
"Available Software Sites" link.</para></listitem>
<listitem><para>Check the box next to
<filename>&ECLIPSE_UPDATES_URL;</filename>
and click "OK".</para></listitem>
<listitem><para>Select <filename>&ECLIPSE_UPDATES_URL;</filename>
from the "Work with:" pull-down menu.</para></listitem>
<listitem><para>Check the box next to <filename>TM and RSE Main Features</filename>.
</para></listitem>
<listitem><para>Expand the box next to <filename>TM and RSE Optional Add-ons</filename>
and select every item except <filename>RSE Unit Tests</filename> and
<filename>RSE WinCE Services (incubation)</filename>.</para></listitem>
<listitem><para>Complete the installation and restart the Eclipse IDE.</para></listitem>
<listitem><para>If necessary, select
"Install New Software" from the "Help" pull-down menu so you can click the
"Available Software Sites" link again.</para></listitem>
<listitem><para>After clicking "Available Software Sites", check the box next to
<filename>http://download.eclipse.org/tools/cdt/releases/indigo</filename>
and click "OK".</para></listitem>
<listitem><para>Select <filename>&ECLIPSE_INDIGO_CDT_URL;</filename>
from the "Work with:" pull-down menu.</para></listitem>
<listitem><para>Check the box next to <filename>CDT Main Features</filename>.
</para></listitem>
<listitem><para>Expand the box next to <filename>CDT Optional Features</filename>
and select <filename>C/C++ Remote Launch</filename> and
<filename>Target Communication Framework (incubation)</filename>.</para></listitem>
<listitem><para>Complete the installation and restart the Eclipse IDE.</para></listitem>
</orderedlist>
</para>
</section>
<section id='installing-the-eclipse-yocto-plug-in'>
<title>Installing or Accessing the Eclipse Yocto Plug-in</title>
<para>
You can install the Eclipse Yocto Plug-in into the Eclipse IDE
one of two ways: use the Yocto Project update site to install the pre-built plug-in,
or build and install the plug-in from the latest source code.
If you don't want to permanently install the plug-in but just want to try it out
within the Eclipse environment, you can import the plug-in project from the
Yocto Project source repositories.
</para>
<section id='new-software'>
<title>Installing the Pre-built Plug-in from the Yocto Project Eclipse Update Site</title>
<para>
To install the Eclipse Yocto Plug-in from the update site,
follow these steps:
<orderedlist>
<listitem><para>Start up the Eclipse IDE.</para></listitem>
<listitem><para>In Eclipse, select "Install New Software" from the "Help" menu.</para></listitem>
<listitem><para>Click "Add..." in the "Work with:" area.</para></listitem>
<listitem><para>Enter
<filename>&ECLIPSE_DL_PLUGIN_URL;</filename>
in the URL field and provide a meaningful name in the "Name" field.</para></listitem>
<listitem><para>Click "OK" to have the entry added to the "Work with:"
drop-down list.</para></listitem>
<listitem><para>Select the entry for the plug-in from the "Work with:" drop-down
list.</para></listitem>
<listitem><para>Check the box next to <filename>Development tools and SDKs for Yocto Linux</filename>.
</para></listitem>
<listitem><para>Complete the remaining software installation steps and
then restart the Eclipse IDE to finish the installation of the plug-in.
</para></listitem>
</orderedlist>
</para>
</section>
<section id='zip-file-method'>
<title>Installing the Plug-in Using the Latest Source Code</title>
<para>
To install the Eclipse Yocto Plug-in from the latest source code, follow these steps:
<orderedlist>
<listitem><para>Open a shell and create a Git repository with:
<literallayout class='monospaced'>
$ git clone git://git.yoctoproject.org/eclipse-poky yocto-eclipse
</literallayout>
For this example, the repository is named
<filename>~/yocto-eclipse</filename>.</para></listitem>
<listitem><para>Locate the <filename>build.sh</filename> script in the
Git repository you created in the previous step.
The script is located in the <filename>scripts</filename>.</para></listitem>
<listitem><para>Be sure to set and export the <filename>ECLIPSE_HOME</filename> environment
variable to the top-level directory in which you installed the Indigo
version of Eclipse.
For example, if your Eclipse directory is <filename>$HOME/eclipse</filename>,
use the following:
<literallayout class='monospaced'>
$ export ECLIPSE_HOME=$HOME/eclipse
</literallayout></para></listitem>
<listitem><para>Run the <filename>build.sh</filename> script and provide the
name of the Git branch along with the Yocto Project release you are
using.
Here is an example that uses the <filename>master</filename> Git repository
and the <filename>1.1M4</filename> release:
<literallayout class='monospaced'>
$ scripts/build.sh master 1.1M4
</literallayout>
After running the script, the file
<filename>org.yocto.sdk-<release>-<date>-archive.zip</filename>
is in the current directory.</para></listitem>
<listitem><para>If necessary, start the Eclipse IDE and be sure you are in the
Workbench.</para></listitem>
<listitem><para>Select "Install New Software" from the "Help" pull-down menu.
</para></listitem>
<listitem><para>Click "Add".</para></listitem>
<listitem><para>Provide anything you want in the "Name" field.</para></listitem>
<listitem><para>Click "Archive" and browse to the ZIP file you built
in step four.
This ZIP file should not be "unzipped", and must be the
<filename>*archive.zip</filename> file created by running the
<filename>build.sh</filename> script.</para></listitem>
<listitem><para>Check the box next to the new entry in the installation window and complete
the installation.</para></listitem>
<listitem><para>Restart the Eclipse IDE if necessary.</para></listitem>
</orderedlist>
</para>
<para>
At this point you should be able to configure the Eclipse Yocto Plug-in as described in the
"<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring the Eclipse Yocto Plug-in</link>"
section.</para>
</section>
<section id='yocto-project-source'>
<title>Importing the Plug-in Project into the Eclipse Environment</title>
<para>
Importing the Eclipse Yocto Plug-in project from the Yocto Project source repositories
is useful when you want to try out the latest plug-in from the tip of plug-in's
development tree.
It is important to understand when you import the plug-in you are not installing
it into the Eclipse application.
Rather, you are importing the project and just using it.
To import the plug-in project, follow these steps:
<orderedlist>
<listitem><para>Open a shell and create a Git repository with:
<literallayout class='monospaced'>
$ git clone git://git.yoctoproject.org/eclipse-poky yocto-eclipse
</literallayout>
For this example, the repository is named
<filename>~/yocto-eclipse</filename>.</para></listitem>
<listitem><para>In Eclipse, select "Import" from the "File" menu.</para></listitem>
<listitem><para>Expand the "General" box and select "existing projects into workspace"
and then click "Next".</para></listitem>
<listitem><para>Select the root directory and browse to
<filename>~/yocto-eclipse/plugins</filename>.</para></listitem>
<listitem><para>Three plug-ins exist: "org.yocto.bc.ui", "org.yocto.sdk.ide", and
"org.yocto.sdk.remotetools".
Select and import all of them.</para></listitem>
</orderedlist>
</para>
<para>
The left navigation pane in the Eclipse application shows the default projects.
Right-click on one of these projects and run it as an Eclipse application.
This brings up a second instance of Eclipse IDE that has the Yocto Plug-in.
</para>
</section>
</section>
<section id='configuring-the-eclipse-yocto-plug-in'>
<title>Configuring the Eclipse Yocto Plug-in</title>
<para>
Configuring the Eclipse Yocto Plug-in involves setting the Cross
Compiler options and the Target options.
The configurations you choose become the default settings for all projects.
You do have opportunities to change them later when
you configure the project (see the following section).
</para>
<para>
To start, you need to do the following from within the Eclipse IDE:
<itemizedlist>
<listitem><para>Choose <filename>Windows -> Preferences</filename> to display
the <filename>Preferences</filename> Dialog</para></listitem>
<listitem><para>Click <filename>Yocto ADT</filename></para></listitem>
</itemizedlist>
</para>
<section id='configuring-the-cross-compiler-options'>
<title>Configuring the Cross-Compiler Options</title>
<para>
To configure the Cross Compiler Options, you must select the type of toolchain,
point to the toolchain, specify the sysroot location, and select the target architecture.
<itemizedlist>
<listitem><para><emphasis>Selecting the Toolchain Type:</emphasis>
Choose between <filename>Standalone pre-built toolchain</filename>
and <filename>Build system derived toolchain</filename> for Cross
Compiler Options.
<itemizedlist>
<listitem><para><emphasis>
<filename>Standalone Pre-built Toolchain:</filename></emphasis>
Select this mode when you are using a stand-alone cross-toolchain.
For example, suppose you are an application developer and do not
need to build a target image.
Instead, you just want to use an architecture-specific toolchain on an
existing kernel and target root filesystem.
</para></listitem>
<listitem><para><emphasis>
<filename>Build System Derived Toolchain:</filename></emphasis>
Select this mode if the cross-toolchain has been installed and built
as part of the Yocto Project build tree.
When you select <filename>Build system derived toolchain</filename>,
you are using the toolchain bundled
inside the Yocto Project build tree.
</para></listitem>
</itemizedlist>
</para></listitem>
<listitem><para><emphasis>Point to the Toolchain:</emphasis>
If you are using a stand-alone pre-built toolchain, you should be pointing to the
<filename>&YOCTO_ADTPATH_DIR;</filename> directory.
This is the location for toolchains installed by the ADT Installer or by hand.
Sections "<link linkend='configuring-and-running-the-adt-installer-script'>Configuring
and Running the ADT Installer Script</link>" and
"<link linkend='using-an-existing-toolchain-tarball'>Using a Cross-Toolchain
Tarball</link>" describe two ways to install
a stand-alone cross-toolchain in the
<filename>/opt/poky</filename> directory.
<note>It is possible to install a stand-alone cross-toolchain in a directory
other than <filename>/opt/poky</filename>.
However, doing so is discouraged.</note></para>
<para>If you are using a system-derived toolchain, the path you provide
for the <filename>Toolchain Root Location</filename>
field is the Yocto Project's build directory.
See section "<link linkend='using-the-toolchain-from-within-the-build-tree'>Using
BitBake and the Yocto Project Build Tree</link>" for
information on how to install the toolchain into the Yocto
Project build tree.</para></listitem>
<listitem><para><emphasis>Specify the Sysroot Location:</emphasis>
This location is where the root filesystem for the
target hardware is created on the development system by the ADT Installer.
The QEMU user-space tools, the
NFS boot process, and the cross-toolchain all use the sysroot location.
</para></listitem>
<listitem><para><emphasis>Select the Target Architecture:</emphasis>
The target architecture is the type of hardware you are
going to use or emulate.
Use the pull-down <filename>Target Architecture</filename> menu to make
your selection.
The pull-down menu should have the supported architectures.
If the architecture you need is not listed in the menu, you
will need to build the image.
See the "<ulink url='&YOCTO_DOCS_QS_URL;#building-image'>Building an Image</ulink>" section
of The Yocto Project Quick Start for more information.</para></listitem>
</itemizedlist>
</para>
</section>
<section id='configuring-the-target-options'>
<title>Configuring the Target Options</title>
<para>
You can choose to emulate hardware using the QEMU emulator, or you
can choose to run your image on actual hardware.
<itemizedlist>
<listitem><para><emphasis><filename>QEMU:</filename></emphasis> Select this option if
you will be using the QEMU emulator.
If you are using the emulator, you also need to locate the kernel
and specify any custom options.</para>
<para>If you selected <filename>Build system derived toolchain</filename>,
the target kernel you built will be located in the
Yocto Project build tree in <filename>tmp/deploy/images</filename> directory.
If you selected <filename>Standalone pre-built toolchain</filename>, the
pre-built image you downloaded is located
in the directory you specified when you downloaded the image.</para>
<para>Most custom options are for advanced QEMU users to further
customize their QEMU instance.
These options are specified between paired angled brackets.
Some options must be specified outside the brackets.
In particular, the options <filename>serial</filename>,
<filename>nographic</filename>, and <filename>kvm</filename> must all
be outside the brackets.
Use the <filename>man qemu</filename> command to get help on all the options
and their use.
The following is an example:
<literallayout class='monospaced'>
serial ‘<-m 256 -full-screen>’
</literallayout></para>
<para>
Regardless of the mode, Sysroot is already defined as part of the
Cross Compiler Options configuration in the
<filename>Sysroot Location:</filename> field.</para></listitem>
<listitem><para><emphasis><filename>External HW:</filename></emphasis> Select this option
if you will be using actual hardware.</para></listitem>
</itemizedlist>
</para>
<para>
Click the <filename>OK</filename> button to save your plug-in configurations.
</para>
</section>
</section>
</section>
<section id='creating-the-project'>
<title>Creating the Project</title>
<para>
You can create two types of projects: Autotools-based, or Makefile-based.
This section describes how to create Autotools-based projects from within
the Eclipse IDE.
For information on creating Makefile-based projects in a terminal window, see the section
"<link linkend='using-the-command-line'>Using the Command Line</link>".
</para>
<para>
To create a project based on a Yocto template and then display the source code,
follow these steps:
<orderedlist>
<listitem><para>Select <filename>File -> New -> Project</filename>.</para></listitem>
<listitem><para>Double click <filename>CC++</filename>.</para></listitem>
<listitem><para>Double click <filename>C Project</filename> to create the project.</para></listitem>
<listitem><para>Expand <filename>Yocto ADT Project</filename>.</para></listitem>
<listitem><para>Select <filename>Hello World ANSI C Autotools Project</filename>.
This is an Autotools-based project based on a Yocto Project template.</para></listitem>
<listitem><para>Put a name in the <filename>Project name:</filename> field.
Do not use hyphens as part of the name.</para></listitem>
<listitem><para>Click <filename>Next</filename>.</para></listitem>
<listitem><para>Add information in the <filename>Author</filename> and
<filename>Copyright notice</filename> fields.</para></listitem>
<listitem><para>Be sure the <filename>License</filename> field is correct.</para></listitem>
<listitem><para>Click <filename>Finish</filename>.</para></listitem>
<listitem><para>If the "open perspective" prompt appears, click "Yes" so that you
in the C/C++ perspective.</para></listitem>
<listitem><para>The left-hand navigation pane shows your project.
You can display your source by double clicking the project's source file.
</para></listitem>
</orderedlist>
</para>
</section>
<section id='configuring-the-cross-toolchains'>
<title>Configuring the Cross-Toolchains</title>
<para>
The earlier section, "<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring
the Eclipse Yocto Plug-in</link>", sets up the default project
configurations.
You can override these settings for a given project by following these steps:
<orderedlist>
<listitem><para>Select <filename>Project -> Change Yocto Project Settings</filename>:
This selection brings up the <filename>Project Yocto Settings</filename> Dialog
and allows you to make changes specific to an individual project.
</para>
<para>By default, the Cross Compiler Options and Target Options for a project
are inherited from settings you provide using the <filename>Preferences</filename>
Dialog as described earlier
in the "<link linkend='configuring-the-eclipse-yocto-plug-in'>Configuring the Eclipse
Yocto Plug-in</link>" section.
The <filename>Project Yocto Settings</filename>
Dialog allows you to override those default settings
for a given project.</para></listitem>
<listitem><para>Make your configurations for the project and click "OK".</para></listitem>
<listitem><para>Select <filename>Project -> Reconfigure Project</filename>:
This selection reconfigures the project by running
<filename>autogen.sh</filename> in the workspace for your project.
The script also runs <filename>libtoolize</filename>, <filename>aclocal</filename>,
<filename>autoconf</filename>, <filename>autoheader</filename>,
<filename>automake --a</filename>, and
<filename>./configure</filename>.
Click on the <filename>Console</filename> tab beneath your source code to
see the results of reconfiguring your project.</para></listitem>
</orderedlist>
</para>
</section>
<section id='building-the-project'>
<title>Building the Project</title>
<para>
To build the project, select <filename>Project -> Build Project</filename>.
The console should update and you can note the cross-compiler you are using.
</para>
</section>
<section id='starting-qemu-in-user-space-nfs-mode'>
<title>Starting QEMU in User Space NFS Mode</title>
<para>
To start the QEMU emulator from within Eclipse, follow these steps:
<orderedlist>
<listitem><para>Expose the <filename>Run -> External Tools</filename> menu.
Your image should appear as a selectable menu item.
</para></listitem>
<listitem><para>Select your image from the menu to launch the
emulator in a new window.</para></listitem>
<listitem><para>If needed, enter your host root password in the shell window at the prompt.
This sets up a <filename>Tap 0</filename> connection needed for running in user-space
NFS mode.</para></listitem>
<listitem><para>Wait for QEMU to launch.</para></listitem>
<listitem><para>Once QEMU launches, you can begin operating within that
environment.
For example, you could determine the IP Address
for the user-space NFS by using the <filename>ifconfig</filename> command.
</para></listitem>
</orderedlist>
</para>
</section>
<section id='deploying-and-debugging-the-application'>
<title>Deploying and Debugging the Application</title>
<para>
Once the QEMU emulator is running the image, using the Eclipse IDE
you can deploy your application and use the emulator to perform debugging.
Follow these steps to deploy the application.
<orderedlist>
<listitem><para>Select <filename>Run -> Debug Configurations...</filename></para></listitem>
<listitem><para>In the left area, expand <filename>C/C++Remote Application</filename>.</para></listitem>
<listitem><para>Locate your project and select it to bring up a new
tabbed view in the <filename>Debug Configurations</filename> Dialog.</para></listitem>
<listitem><para>Enter the absolute path into which you want to deploy
the application.
Use the <filename>Remote Absolute File Path for C/C++Application:</filename> field.
For example, enter <filename>/usr/bin/<programname></filename>.</para></listitem>
<listitem><para>Click on the <filename>Debugger</filename> tab to see the cross-tool debugger
you are using.</para></listitem>
<listitem><para>Click on the <filename>Main</filename> tab.</para></listitem>
<listitem><para>Create a new connection to the QEMU instance
by clicking on <filename>new</filename>.</para></listitem>
<listitem><para>Select <filename>TCF</filename>, which means Target Communication
Framework.</para></listitem>
<listitem><para>Click <filename>Next</filename>.</para></listitem>
<listitem><para>Clear out the <filename>host name</filename> field and enter the IP Address
determined earlier.</para></listitem>
<listitem><para>Click <filename>Finish</filename> to close the
<filename>New Connections</filename> Dialog.</para></listitem>
<listitem><para>Use the drop-down menu now in the <filename>Connection</filename> field and pick
the IP Address you entered.</para></listitem>
<listitem><para>Click <filename>Debug</filename> to bring up a login screen
and login.</para></listitem>
<listitem><para>Accept the debug perspective.</para></listitem>
</orderedlist>
</para>
</section>
<section id='running-user-space-tools'>
<title>Running User-Space Tools</title>
<para>
As mentioned earlier in the manual, several tools exist that enhance
your development experience.
These tools are aids in developing and debugging applications and images.
You can run these user-space tools from within the Eclipse IDE through the
<filename>YoctoTools</filename> menu.
</para>
<para>
Once you pick a tool, you need to configure it for the remote target.
Every tool needs to have the connection configured.
You must select an existing TCF-based RSE connection to the remote target.
If one does not exist, click <filename>New</filename> to create one.
</para>
<para>
Here are some specifics about the remote tools:
<itemizedlist>
<listitem><para><emphasis><filename>OProfile</filename>:</emphasis> Selecting this tool causes
the <filename>oprofile-server</filename> on the remote target to launch on
the local host machine.
The <filename>oprofile-viewer</filename> must be installed on the local host machine and the
<filename>oprofile-server</filename> must be installed on the remote target,
respectively, in order to use.
You must compile and install the <filename>oprofile-viewer</filename> from the source code
on your local host machine.
Furthermore, in order to convert the target's sample format data into a form that the
host can use, you must have <filename>oprofile</filename> version 0.9.4 or
greater installed on the host.</para>
<para>You can locate both the viewer and server from
<ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/oprofileui/'></ulink>.
<note>The <filename>oprofile-server</filename> is installed by default on
the <filename>core-image-sato-sdk</filename> image.</note></para></listitem>
<listitem><para><emphasis><filename>Lttng-ust</filename>:</emphasis> Selecting this tool runs
<filename>usttrace</filename> on the remote target, transfers the output data back
to the local host machine, and uses the <filename>lttng</filename> Eclipse plug-in to
graphically display the output.
For information on how to use <filename>lttng</filename> to trace an application, see
<ulink url='http://lttng.org/files/ust/manual/ust.html'></ulink>.</para>
<para>For <filename>Application</filename>, you must supply the absolute path name of the
application to be traced by user mode <filename>lttng</filename>.
For example, typing <filename>/path/to/foo</filename> triggers
<filename>usttrace /path/to/foo</filename> on the remote target to trace the
program <filename>/path/to/foo</filename>.</para>
<para><filename>Argument</filename> is passed to <filename>usttrace</filename>
running on the remote target.</para>
<para>Before you use the <filename>lttng-ust</filename> tool, you need to setup
the <filename>lttng</filename> Eclipse plug-in and create a <filename>lttng</filename>
project.
Do the following:
<orderedlist>
<listitem><para>Follow these
<ulink url='http://wiki.eclipse.org/Linux_Tools_Project/LTTng#Downloading_and_installing_the_LTTng_parser_library'>instructions</ulink>
to download and install the <filename>lttng</filename> parser library.
</para></listitem>
<listitem><para>Select <filename>Window -> Open Perspective -> Other</filename>
and then select <filename>LTTng</filename>.</para></listitem>
<listitem><para>Click <filename>OK</filename> to change the Eclipse perspective
into the <filename>LTTng</filename> perspective.</para></listitem>
<listitem><para>Create a new <filename>LTTng</filename> project by selecting
<filename>File -> New -> Project</filename>.</para></listitem>
<listitem><para>Choose <filename>LTTng -> LTTng Project</filename>.</para></listitem>
<listitem><para>Click <filename>YoctoTools -> lttng-ust</filename> to start user mode
<filename>lttng</filename> on the remote target.</para></listitem>
</orderedlist></para>
<para>After the output data has been transferred from the remote target back to the local
host machine, new traces will be imported into the selected <filename>LTTng</filename> project.
Then you can go to the <filename>LTTng</filename> project, right click the imported
trace, and set the trace type as the <filename>LTTng</filename> kernel trace.
Finally, right click the imported trace and select <filename>Open</filename>
to display the data graphically.</para></listitem>
<listitem><para><emphasis><filename>PowerTOP</filename>:</emphasis> Selecting this tool runs
<filename>powertop</filename> on the remote target machine and displays the results in a
new view called <filename>powertop</filename>.</para>
<para><filename>Time to gather data(sec):</filename> is the time passed in seconds before data
is gathered from the remote target for analysis.</para>
<para><filename>show pids in wakeups list:</filename> corresponds to the
<filename>-p</filename> argument
passed to <filename>powertop</filename>.</para></listitem>
<listitem><para><emphasis><filename>LatencyTOP and Perf</filename>:</emphasis>
<filename>latencytop</filename> identifies system latency, while
<filename>perf</filename> monitors the system's
performance counter registers.
Selecting either of these tools causes an RSE terminal view to appear
from which you can run the tools.
Both tools refresh the entire screen to display results while they run.</para></listitem>
</itemizedlist>
</para>
</section>
<section id='customizing-an-image-using-a-bitbake-commander-project-and-hob'>
<title>Customizing an Image Using a BitBake Commander Project and Hob</title>
<para>
Within Eclipse, you can create a Yocto BitBake Commander project,
edit the metadata, and then use the
<ulink url='&YOCTO_HOME_URL;/projects/hob'>Hob</ulink> to build a customized
image all within one IDE.
</para>
<section id='creating-the-yocto-bitbake-commander-project'>
<title>Creating the Yocto BitBake Commander Project</title>
<para>
To create a Yocto BitBake Commander project, follow these steps:
<orderedlist>
<listitem><para>Select <filename>Window -> Open Perspective -> Other</filename>
and then choose <filename>Bitbake Commander</filename>.</para></listitem>
<listitem><para>Click <filename>OK</filename> to change the Eclipse perspective into the
Bitbake Commander perspective.</para></listitem>
<listitem><para>Select <filename>File -> New -> Project</filename> to create a new Yocto
Bitbake Commander project.</para></listitem>
<listitem><para>Choose <filename>Yocto Project Bitbake Commander -> New Yocto Project</filename>
and click <filename>Next</filename>.</para></listitem>
<listitem><para>Enter the Project Name and choose the Project Location.
The Yocto project's metadata files will be put under the directory
<filename><project_location>/<project_name></filename>.
If that directory does not exist, you need to check
the "Clone from Yocto Git Repository" box, which would execute a
<filename>git clone</filename> command to get the Yocto project's metadata files.
</para></listitem>
<listitem><para>Select <filename>Finish</filename> to create the project.</para></listitem>
</orderedlist>
</para>
</section>
<section id='editing-the-metadata-files'>
<title>Editing the Metadata Files</title>
<para>
After you create the Yocto Bitbake Commander project, you can modify the metadata files
by opening them in the project.
When editing recipe files (<filename>.bb</filename> files), you can view BitBake
variable values and information by hovering the mouse pointer over the variable name and
waiting a few seconds.
</para>
<para>
To edit the metadata, follow these steps:
<orderedlist>
<listitem><para>Select your Yocto Bitbake Commander project.</para></listitem>
<listitem><para>Select <filename>File -> New -> Yocto BitBake Commander -> BitBake Recipe</filename>
to open a new recipe wizard.</para></listitem>
<listitem><para>Point to your source by filling in the "SRC_URL" field.
For example, you can add a recipe in the
<ulink url='&YOCTO_DOCS_DEV_URL;#yocto-project-source-files'>Yocto Project Source Files</ulink>,
input the "SRC_URL" as follows:
<literallayout class='monospaced'>
ftp://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
</literallayout></para></listitem>
<listitem><para>Click "Populate" to calculate the archive md5, sha256,
license checksum values and to auto-generate the recipe filename.</para></listitem>
<listitem><para>Fill in the "Description" field.</para></listitem>
<listitem><para>Be sure values for all required fields exist.</para></listitem>
<listitem><para>Click <filename>Finish</filename>.</para></listitem>
</orderedlist>
</para>
</section>
<section id='buiding-and-customizing-the-image'>
<title>Building and Customizing the Image</title>
<para>
To build and customize the image in Eclipse, follow these steps:
<orderedlist>
<listitem><para>Select your Yocto Bitbake Commander project.</para></listitem>
<listitem><para>Select <filename>Project -> Launch HOB</filename>.</para></listitem>
<listitem><para>Enter the build directory where you want to put your final images.</para></listitem>
<listitem><para>Click <filename>OK</filename> to launch Hob.</para></listitem>
<listitem><para>Use Hob to customize and build your own images.
For information on Hob, see the
<ulink url='&YOCTO_HOME_URL;/projects/hob'>Hob Project Page</ulink> on the
Yocto Project website.</para></listitem>
</orderedlist>
</para>
</section>
</section>
</chapter>
<!--
vim: expandtab tw=80 ts=4
-->
|