Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
| 2 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" |
| 3 | [<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] > |
| 4 | |
| 5 | <appendix id='sdk-appendix-neon-yp-eclipse-plug-in'> |
| 6 | <title>Using <trademark class='trade'>Eclipse</trademark> Neon</title> |
| 7 | |
| 8 | <para> |
| 9 | This release of the Yocto Project supports both the Oxygen and Neon |
| 10 | versions of the Eclipse IDE. |
| 11 | This appendix presents information that describes how to obtain and |
| 12 | configure the Neon version of Eclipse. |
| 13 | It also provides a basic project example that you can work through |
| 14 | from start to finish. |
| 15 | For general information on using the Eclipse IDE and the Yocto |
| 16 | Project Eclipse Plug-In, see the |
| 17 | "<link linkend='sdk-eclipse-project'>Developing Applications Using <trademark class='trade'>Eclipse</trademark></link>" |
| 18 | Chapter. |
| 19 | </para> |
| 20 | |
| 21 | <section id='neon-setting-up-the-eclipse-ide'> |
| 22 | <title>Setting Up the Neon Version of the Eclipse IDE</title> |
| 23 | |
| 24 | <para> |
| 25 | To develop within the Eclipse IDE, you need to do the following: |
| 26 | <orderedlist> |
| 27 | <listitem><para>Install the Neon version of the Eclipse |
| 28 | IDE.</para></listitem> |
| 29 | <listitem><para>Configure the Eclipse IDE. |
| 30 | </para></listitem> |
| 31 | <listitem><para>Install the Eclipse Yocto Plug-in. |
| 32 | </para></listitem> |
| 33 | <listitem><para>Configure the Eclipse Yocto Plug-in. |
| 34 | </para></listitem> |
| 35 | </orderedlist> |
| 36 | <note> |
| 37 | Do not install Eclipse from your distribution's package |
| 38 | repository. |
| 39 | Be sure to install Eclipse from the official Eclipse |
| 40 | download site as directed in the next section. |
| 41 | </note> |
| 42 | </para> |
| 43 | |
| 44 | <section id='neon-installing-eclipse-ide'> |
| 45 | <title>Installing the Neon Eclipse IDE</title> |
| 46 | |
| 47 | <para> |
| 48 | Follow these steps to locate, install, and configure |
| 49 | Neon Eclipse: |
| 50 | <orderedlist> |
| 51 | <listitem><para><emphasis>Locate the Neon Download:</emphasis> |
| 52 | Open a browser and go to |
| 53 | <ulink url='http://www.eclipse.org/neon/'>http://www.eclipse.org/neon/</ulink>. |
| 54 | </para></listitem> |
| 55 | <listitem><para><emphasis>Download the Tarball:</emphasis> |
| 56 | Click the "Download" button and then use the "Eclipse |
| 57 | IDE for C/C++ Developers" |
| 58 | appropriate for your development system. |
| 59 | </para></listitem> |
| 60 | <listitem><para><emphasis>Unpack the Tarball:</emphasis> |
| 61 | Move to a clean directory and unpack the tarball. |
| 62 | Here is an example: |
| 63 | <literallayout class='monospaced'> |
| 64 | $ cd ~ |
| 65 | $ tar -xzvf ~/Downloads/eclipse-cpp-neon-3-linux-gtk-x86_64.tar.gz |
| 66 | </literallayout> |
| 67 | Everything unpacks into a folder named "Eclipse". |
| 68 | </para></listitem> |
| 69 | <listitem><para><emphasis>Launch Eclipse:</emphasis> |
| 70 | The following commands launch Eclipse assuming you |
| 71 | unpacked it in your home directory: |
| 72 | <literallayout class='monospaced'> |
| 73 | $ cd ~/eclipse |
| 74 | $ ./eclipse |
| 75 | </literallayout> |
| 76 | Accept the default "workspace" once Eclipse launches. |
| 77 | </para></listitem> |
| 78 | </orderedlist> |
| 79 | </para> |
| 80 | </section> |
| 81 | |
| 82 | <section id='neon-configuring-the-neon-eclipse-ide'> |
| 83 | <title>Configuring the Neon Eclipse IDE</title> |
| 84 | |
| 85 | <para> |
| 86 | Follow these steps to configure the Neon Eclipse IDE. |
| 87 | <note> |
| 88 | Depending on how you installed Eclipse and what you have |
| 89 | already done, some of the options will not appear. |
| 90 | If you cannot find an option as directed by the manual, |
| 91 | it has already been installed. |
| 92 | </note> |
| 93 | <orderedlist> |
| 94 | <listitem><para>Be sure Eclipse is running and |
| 95 | you are in your workbench. |
| 96 | </para></listitem> |
| 97 | <listitem><para>Select "Install New Software" from |
| 98 | the "Help" pull-down menu. |
| 99 | </para></listitem> |
| 100 | <listitem><para>Select |
| 101 | "Neon - http://download.eclipse.org/releases/neon" |
| 102 | from the "Work with:" pull-down menu. |
| 103 | </para></listitem> |
| 104 | <listitem><para>Expand the box next to |
| 105 | "Linux Tools" and select the following |
| 106 | <literallayout class='monospaced'> |
| 107 | C/C++ Remote (Over TCF/TE) Run/Debug Launcher |
| 108 | TM Terminal |
| 109 | </literallayout> |
| 110 | </para></listitem> |
| 111 | <listitem><para>Expand the box next to "Mobile and |
| 112 | Device Development" and select the following |
| 113 | boxes: |
| 114 | <literallayout class='monospaced'> |
| 115 | C/C++ Remote (Over TCF/TE) Run/Debug Launcher |
| 116 | Remote System Explorer User Actions |
| 117 | TM Terminal |
| 118 | TCF Remote System Explorer add-in |
| 119 | TCF Target Explorer |
| 120 | </literallayout> |
| 121 | </para></listitem> |
| 122 | <listitem><para>Expand the box next to |
| 123 | "Programming Languages" and select the |
| 124 | following box: |
| 125 | <literallayout class='monospaced'> |
| 126 | C/C++ Development Tools SDK |
| 127 | </literallayout> |
| 128 | </para></listitem> |
| 129 | <listitem><para> |
| 130 | Complete the installation by clicking through |
| 131 | appropriate "Next" and "Finish" buttons. |
| 132 | </para></listitem> |
| 133 | </orderedlist> |
| 134 | </para> |
| 135 | </section> |
| 136 | |
| 137 | <section id='neon-installing-the-eclipse-yocto-plug-in'> |
| 138 | <title>Installing or Accessing the Neon Eclipse Yocto Plug-in</title> |
| 139 | |
| 140 | <para> |
| 141 | You can install the Eclipse Yocto Plug-in into the Eclipse |
| 142 | IDE one of two ways: use the Yocto Project's Eclipse |
| 143 | Update site to install the pre-built plug-in or build and |
| 144 | install the plug-in from the latest source code. |
| 145 | </para> |
| 146 | |
| 147 | <section id='neon-new-software'> |
| 148 | <title>Installing the Pre-built Plug-in from the Yocto Project Eclipse Update Site</title> |
| 149 | |
| 150 | <para> |
| 151 | To install the Neon Eclipse Yocto Plug-in from the update |
| 152 | site, follow these steps: |
| 153 | <orderedlist> |
| 154 | <listitem><para>Start up the Eclipse IDE. |
| 155 | </para></listitem> |
| 156 | <listitem><para>In Eclipse, select "Install New |
| 157 | Software" from the "Help" menu. |
| 158 | </para></listitem> |
| 159 | <listitem><para>Click "Add..." in the "Work with:" |
| 160 | area. |
| 161 | </para></listitem> |
| 162 | <listitem><para>Enter |
| 163 | <filename>&ECLIPSE_DL_PLUGIN_URL;/neon</filename> |
| 164 | in the URL field and provide a meaningful name |
| 165 | in the "Name" field. |
| 166 | </para></listitem> |
| 167 | <listitem><para>Click "OK" to have the entry added |
| 168 | to the "Work with:" drop-down list. |
| 169 | </para></listitem> |
| 170 | <listitem><para>Select the entry for the plug-in |
| 171 | from the "Work with:" drop-down list. |
| 172 | </para></listitem> |
| 173 | <listitem><para>Check the boxes next to the following: |
| 174 | <literallayout class='monospaced'> |
| 175 | Yocto Project SDK Plug-in |
| 176 | Yocto Project Documentation plug-in |
| 177 | </literallayout> |
| 178 | </para></listitem> |
| 179 | <listitem><para>Complete the remaining software |
| 180 | installation steps and then restart the Eclipse |
| 181 | IDE to finish the installation of the plug-in. |
| 182 | <note> |
| 183 | You can click "OK" when prompted about |
| 184 | installing software that contains unsigned |
| 185 | content. |
| 186 | </note> |
| 187 | </para></listitem> |
| 188 | </orderedlist> |
| 189 | </para> |
| 190 | </section> |
| 191 | |
| 192 | <section id='neon-zip-file-method'> |
| 193 | <title>Installing the Plug-in Using the Latest Source Code</title> |
| 194 | |
| 195 | <para> |
| 196 | To install the Neon Eclipse Yocto Plug-in from the latest |
| 197 | source code, follow these steps: |
| 198 | <orderedlist> |
| 199 | <listitem><para>Be sure your development system |
| 200 | has JDK 1.8+ |
| 201 | </para></listitem> |
| 202 | <listitem><para>install X11-related packages: |
| 203 | <literallayout class='monospaced'> |
| 204 | $ sudo apt-get install xauth |
| 205 | </literallayout> |
| 206 | </para></listitem> |
| 207 | <listitem><para>In a new terminal shell, create a Git |
| 208 | repository with: |
| 209 | <literallayout class='monospaced'> |
| 210 | $ cd ~ |
| 211 | $ git clone git://git.yoctoproject.org/eclipse-yocto |
| 212 | </literallayout> |
| 213 | </para></listitem> |
| 214 | <listitem><para>Use Git to checkout the correct |
| 215 | tag: |
| 216 | <literallayout class='monospaced'> |
| 217 | $ cd ~/eclipse-yocto |
| 218 | $ git checkout neon/yocto-&DISTRO; |
| 219 | </literallayout> |
| 220 | This creates a local tag named |
| 221 | <filename>neon/yocto-&DISTRO;</filename> based on |
| 222 | the branch <filename>origin/neon-master</filename>. |
| 223 | This puts you in a detached HEAD state, which |
| 224 | is fine since you are only going to be building |
| 225 | and not developing. |
| 226 | </para></listitem> |
| 227 | <listitem><para>Change to the |
| 228 | <filename>scripts</filename> |
| 229 | directory within the Git repository: |
| 230 | <literallayout class='monospaced'> |
| 231 | $ cd scripts |
| 232 | </literallayout> |
| 233 | </para></listitem> |
| 234 | <listitem><para>Set up the local build environment |
| 235 | by running the setup script: |
| 236 | <literallayout class='monospaced'> |
| 237 | $ ./setup.sh |
| 238 | </literallayout> |
| 239 | When the script finishes execution, |
| 240 | it prompts you with instructions on how to run |
| 241 | the <filename>build.sh</filename> script, which |
| 242 | is also in the <filename>scripts</filename> |
| 243 | directory of the Git repository created |
| 244 | earlier. |
| 245 | </para></listitem> |
| 246 | <listitem><para>Run the <filename>build.sh</filename> |
| 247 | script as directed. |
| 248 | Be sure to provide the tag name, documentation |
| 249 | branch, and a release name.</para> |
| 250 | <para> |
| 251 | Following is an example: |
| 252 | <literallayout class='monospaced'> |
| 253 | $ ECLIPSE_HOME=/home/scottrif/eclipse-yocto/scripts/eclipse ./build.sh -l neon/yocto-&DISTRO; master yocto-&DISTRO; 2>&1 | tee build.log |
| 254 | </literallayout> |
| 255 | The previous example command adds the tag you |
| 256 | need for <filename>neon/yocto-&DISTRO;</filename> |
| 257 | to <filename>HEAD</filename>, then tells the |
| 258 | build script to use the local (-l) Git checkout |
| 259 | for the build. |
| 260 | After running the script, the file |
| 261 | <filename>org.yocto.sdk-</filename><replaceable>release</replaceable><filename>-</filename><replaceable>date</replaceable><filename>-archive.zip</filename> |
| 262 | is in the current directory. |
| 263 | </para></listitem> |
| 264 | <listitem><para>If necessary, start the Eclipse IDE |
| 265 | and be sure you are in the Workbench. |
| 266 | </para></listitem> |
| 267 | <listitem><para>Select "Install New Software" from |
| 268 | the "Help" pull-down menu. |
| 269 | </para></listitem> |
| 270 | <listitem><para>Click "Add". |
| 271 | </para></listitem> |
| 272 | <listitem><para>Provide anything you want in the |
| 273 | "Name" field. |
| 274 | </para></listitem> |
| 275 | <listitem><para>Click "Archive" and browse to the |
| 276 | ZIP file you built earlier. |
| 277 | This ZIP file should not be "unzipped", and must |
| 278 | be the <filename>*archive.zip</filename> file |
| 279 | created by running the |
| 280 | <filename>build.sh</filename> script. |
| 281 | </para></listitem> |
| 282 | <listitem><para>Click the "OK" button. |
| 283 | </para></listitem> |
| 284 | <listitem><para>Check the boxes that appear in |
| 285 | the installation window to install the |
| 286 | following: |
| 287 | <literallayout class='monospaced'> |
| 288 | Yocto Project SDK Plug-in |
| 289 | Yocto Project Documentation plug-in |
| 290 | </literallayout> |
| 291 | </para></listitem> |
| 292 | <listitem><para>Finish the installation by clicking |
| 293 | through the appropriate buttons. |
| 294 | You can click "OK" when prompted about |
| 295 | installing software that contains unsigned |
| 296 | content. |
| 297 | </para></listitem> |
| 298 | <listitem><para>Restart the Eclipse IDE if |
| 299 | necessary. |
| 300 | </para></listitem> |
| 301 | </orderedlist> |
| 302 | </para> |
| 303 | |
| 304 | <para> |
| 305 | At this point you should be able to configure the |
| 306 | Eclipse Yocto Plug-in as described in the |
| 307 | "<link linkend='neon-configuring-the-eclipse-yocto-plug-in'>Configuring the Neon Eclipse Yocto Plug-in</link>" |
| 308 | section.</para> |
| 309 | </section> |
| 310 | </section> |
| 311 | |
| 312 | <section id='neon-configuring-the-eclipse-yocto-plug-in'> |
| 313 | <title>Configuring the Neon Eclipse Yocto Plug-in</title> |
| 314 | |
| 315 | <para> |
| 316 | Configuring the Neon Eclipse Yocto Plug-in involves setting the |
| 317 | Cross Compiler options and the Target options. |
| 318 | The configurations you choose become the default settings |
| 319 | for all projects. |
| 320 | You do have opportunities to change them later when |
| 321 | you configure the project (see the following section). |
| 322 | </para> |
| 323 | |
| 324 | <para> |
| 325 | To start, you need to do the following from within the |
| 326 | Eclipse IDE: |
| 327 | <itemizedlist> |
| 328 | <listitem><para>Choose "Preferences" from the |
| 329 | "Window" menu to display the Preferences Dialog. |
| 330 | </para></listitem> |
| 331 | <listitem><para>Click "Yocto Project SDK" to display |
| 332 | the configuration screen. |
| 333 | </para></listitem> |
| 334 | </itemizedlist> |
| 335 | The following sub-sections describe how to configure the |
| 336 | the plug-in. |
| 337 | <note> |
| 338 | Throughout the descriptions, a start-to-finish example for |
| 339 | preparing a QEMU image for use with Eclipse is referenced |
| 340 | as the "wiki" and is linked to the example on the |
| 341 | <ulink url='https://wiki.yoctoproject.org/wiki/TipsAndTricks/RunningEclipseAgainstBuiltImage'> Cookbook guide to Making an Eclipse Debug Capable Image</ulink> |
| 342 | wiki page. |
| 343 | </note> |
| 344 | </para> |
| 345 | |
| 346 | <section id='neon-configuring-the-cross-compiler-options'> |
| 347 | <title>Configuring the Cross-Compiler Options</title> |
| 348 | |
| 349 | <para> |
| 350 | Cross Compiler options enable Eclipse to use your specific |
| 351 | cross compiler toolchain. |
| 352 | To configure these options, you must select |
| 353 | the type of toolchain, point to the toolchain, specify |
| 354 | the sysroot location, and select the target |
| 355 | architecture. |
| 356 | <itemizedlist> |
| 357 | <listitem><para><emphasis>Selecting the Toolchain Type:</emphasis> |
| 358 | Choose between |
| 359 | <filename>Standalone pre-built toolchain</filename> |
| 360 | and |
| 361 | <filename>Build system derived toolchain</filename> |
| 362 | for Cross Compiler Options. |
| 363 | <itemizedlist> |
| 364 | <listitem><para><emphasis> |
| 365 | <filename>Standalone Pre-built Toolchain:</filename></emphasis> |
| 366 | Select this type when you are using |
| 367 | a stand-alone cross-toolchain. |
| 368 | For example, suppose you are an |
| 369 | application developer and do not |
| 370 | need to build a target image. |
| 371 | Instead, you just want to use an |
| 372 | architecture-specific toolchain on |
| 373 | an existing kernel and target root |
| 374 | filesystem. |
| 375 | In other words, you have downloaded |
| 376 | and installed a pre-built toolchain |
| 377 | for an existing image. |
| 378 | </para></listitem> |
| 379 | <listitem><para><emphasis> |
| 380 | <filename>Build System Derived Toolchain:</filename></emphasis> |
| 381 | Select this type if you built the |
| 382 | toolchain as part of the |
| 383 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>. |
| 384 | When you select |
| 385 | <filename>Build system derived toolchain</filename>, |
| 386 | you are using the toolchain built and |
| 387 | bundled inside the Build Directory. |
| 388 | For example, suppose you created a |
| 389 | suitable image using the steps in the |
| 390 | <ulink url='https://wiki.yoctoproject.org/wiki/TipsAndTricks/RunningEclipseAgainstBuiltImage'>wiki</ulink>. |
| 391 | In this situation, you would select the |
| 392 | <filename>Build system derived toolchain</filename>. |
| 393 | </para></listitem> |
| 394 | </itemizedlist> |
| 395 | </para></listitem> |
| 396 | <listitem><para><emphasis>Specify the Toolchain Root Location:</emphasis> |
| 397 | If you are using a stand-alone pre-built |
| 398 | toolchain, you should be pointing to where it is |
| 399 | installed (e.g. |
| 400 | <filename>/opt/poky/&DISTRO;</filename>). |
| 401 | See the |
| 402 | "<link linkend='sdk-installing-the-sdk'>Installing the SDK</link>" |
| 403 | section for information about how the SDK is |
| 404 | installed.</para> |
| 405 | <para>If you are using a build system derived |
| 406 | toolchain, the path you provide for the |
| 407 | <filename>Toolchain Root Location</filename> |
| 408 | field is the |
| 409 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink> |
| 410 | from which you run the |
| 411 | <filename>bitbake</filename> command (e.g |
| 412 | <filename>/home/scottrif/poky/build</filename>).</para> |
| 413 | <para>For more information, see the |
| 414 | "<link linkend='sdk-building-an-sdk-installer'>Building an SDK Installer</link>" |
| 415 | section. |
| 416 | </para></listitem> |
| 417 | <listitem><para><emphasis>Specify Sysroot Location:</emphasis> |
| 418 | This location is where the root filesystem for |
| 419 | the target hardware resides. |
| 420 | </para> |
| 421 | <para>This location depends on where you |
| 422 | separately extracted and installed the |
| 423 | target filesystem when you either built |
| 424 | it or downloaded it. |
| 425 | <note> |
| 426 | If you downloaded the root filesystem |
| 427 | for the target hardware rather than |
| 428 | built it, you must download the |
| 429 | <filename>sato-sdk</filename> image |
| 430 | in order to build any c/c++ projects. |
| 431 | </note> |
| 432 | As an example, suppose you prepared an image |
| 433 | using the steps in the |
| 434 | <ulink url='https://wiki.yoctoproject.org/wiki/TipsAndTricks/RunningEclipseAgainstBuiltImage'>wiki</ulink>. |
| 435 | If so, the <filename>MY_QEMU_ROOTFS</filename> |
| 436 | directory is found in the |
| 437 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink> |
| 438 | and you would browse to and select that directory |
| 439 | (e.g. <filename>/home/scottrif/build/MY_QEMU_ROOTFS</filename>). |
| 440 | </para> |
| 441 | <para>For more information on how to install the |
| 442 | toolchain and on how to extract and install the |
| 443 | sysroot filesystem, see the |
| 444 | "<link linkend='sdk-building-an-sdk-installer'>Building an SDK Installer</link>" |
| 445 | section. |
| 446 | </para></listitem> |
| 447 | <listitem><para><emphasis>Select the Target Architecture:</emphasis> |
| 448 | The target architecture is the type of hardware |
| 449 | you are going to use or emulate. |
| 450 | Use the pull-down |
| 451 | <filename>Target Architecture</filename> menu |
| 452 | to make your selection. |
| 453 | The pull-down menu should have the supported |
| 454 | architectures. |
| 455 | If the architecture you need is not listed in |
| 456 | the menu, you will need to build the image. |
| 457 | See the |
| 458 | "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-building-a-simple-image'>Building a Simple Image</ulink>" |
| 459 | section of the Yocto Project Development Tasks |
| 460 | Manual for more information. |
| 461 | You can also see the |
| 462 | <ulink url='https://wiki.yoctoproject.org/wiki/TipsAndTricks/RunningEclipseAgainstBuiltImage'>wiki</ulink>. |
| 463 | </para></listitem> |
| 464 | </itemizedlist> |
| 465 | </para> |
| 466 | </section> |
| 467 | |
| 468 | <section id='neon-configuring-the-target-options'> |
| 469 | <title>Configuring the Target Options</title> |
| 470 | |
| 471 | <para> |
| 472 | You can choose to emulate hardware using the QEMU |
| 473 | emulator, or you can choose to run your image on actual |
| 474 | hardware. |
| 475 | <itemizedlist> |
| 476 | <listitem><para><emphasis>QEMU:</emphasis> |
| 477 | Select this option if you will be using the |
| 478 | QEMU emulator. |
| 479 | If you are using the emulator, you also need to |
| 480 | locate the kernel and specify any custom |
| 481 | options.</para> |
| 482 | <para>If you selected the |
| 483 | <filename>Build system derived toolchain</filename>, |
| 484 | the target kernel you built will be located in |
| 485 | the |
| 486 | <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink> |
| 487 | in |
| 488 | <filename>tmp/deploy/images/<replaceable>machine</replaceable></filename> |
| 489 | directory. |
| 490 | As an example, suppose you performed the steps in |
| 491 | the |
| 492 | <ulink url='https://wiki.yoctoproject.org/wiki/TipsAndTricks/RunningEclipseAgainstBuiltImage'>wiki</ulink>. |
| 493 | In this case, you specify your Build Directory path |
| 494 | followed by the image (e.g. |
| 495 | <filename>/home/scottrif/poky/build/tmp/deploy/images/qemux86/bzImage-qemux86.bin</filename>). |
| 496 | </para> |
| 497 | <para>If you selected the standalone pre-built |
| 498 | toolchain, the pre-built image you downloaded is |
| 499 | located in the directory you specified when you |
| 500 | downloaded the image.</para> |
| 501 | <para>Most custom options are for advanced QEMU |
| 502 | users to further customize their QEMU instance. |
| 503 | These options are specified between paired |
| 504 | angled brackets. |
| 505 | Some options must be specified outside the |
| 506 | brackets. |
| 507 | In particular, the options |
| 508 | <filename>serial</filename>, |
| 509 | <filename>nographic</filename>, and |
| 510 | <filename>kvm</filename> must all be outside the |
| 511 | brackets. |
| 512 | Use the <filename>man qemu</filename> command |
| 513 | to get help on all the options and their use. |
| 514 | The following is an example: |
| 515 | <literallayout class='monospaced'> |
| 516 | serial ‘<-m 256 -full-screen>’ |
| 517 | </literallayout></para> |
| 518 | <para> |
| 519 | Regardless of the mode, Sysroot is already |
| 520 | defined as part of the Cross-Compiler Options |
| 521 | configuration in the |
| 522 | <filename>Sysroot Location:</filename> field. |
| 523 | </para></listitem> |
| 524 | <listitem><para><emphasis>External HW:</emphasis> |
| 525 | Select this option if you will be using actual |
| 526 | hardware.</para></listitem> |
| 527 | </itemizedlist> |
| 528 | </para> |
| 529 | |
| 530 | <para> |
| 531 | Click the "Apply" and "OK" to save your plug-in |
| 532 | configurations. |
| 533 | </para> |
| 534 | </section> |
| 535 | </section> |
| 536 | </section> |
| 537 | |
| 538 | <section id='neon-creating-the-project'> |
| 539 | <title>Creating the Project</title> |
| 540 | |
| 541 | <para> |
| 542 | You can create two types of projects: Autotools-based, or |
| 543 | Makefile-based. |
| 544 | This section describes how to create Autotools-based projects |
| 545 | from within the Eclipse IDE. |
| 546 | For information on creating Makefile-based projects in a |
| 547 | terminal window, see the |
| 548 | "<link linkend='makefile-based-projects'>Makefile-Based Projects</link>" |
| 549 | section. |
| 550 | <note> |
| 551 | Do not use special characters in project names |
| 552 | (e.g. spaces, underscores, etc.). Doing so can |
| 553 | cause the configuration to fail. |
| 554 | </note> |
| 555 | </para> |
| 556 | |
| 557 | <para> |
| 558 | To create a project based on a Yocto template and then display |
| 559 | the source code, follow these steps: |
| 560 | <orderedlist> |
| 561 | <listitem><para>Select "C Project" from the "File -> New" menu. |
| 562 | </para></listitem> |
| 563 | <listitem><para>Expand <filename>Yocto Project SDK Autotools Project</filename>. |
| 564 | </para></listitem> |
| 565 | <listitem><para>Select <filename>Hello World ANSI C Autotools Projects</filename>. |
| 566 | This is an Autotools-based project based on a Yocto |
| 567 | template. |
| 568 | </para></listitem> |
| 569 | <listitem><para>Put a name in the <filename>Project name:</filename> |
| 570 | field. |
| 571 | Do not use hyphens as part of the name |
| 572 | (e.g. <filename>hello</filename>). |
| 573 | </para></listitem> |
| 574 | <listitem><para>Click "Next". |
| 575 | </para></listitem> |
| 576 | <listitem><para>Add appropriate information in the various |
| 577 | fields. |
| 578 | </para></listitem> |
| 579 | <listitem><para>Click "Finish". |
| 580 | </para></listitem> |
| 581 | <listitem><para>If the "open perspective" prompt appears, |
| 582 | click "Yes" so that you are in the C/C++ perspective. |
| 583 | </para></listitem> |
| 584 | <listitem><para>The left-hand navigation pane shows your |
| 585 | project. |
| 586 | You can display your source by double clicking the |
| 587 | project's source file. |
| 588 | </para></listitem> |
| 589 | </orderedlist> |
| 590 | </para> |
| 591 | </section> |
| 592 | |
| 593 | <section id='neon-configuring-the-cross-toolchains'> |
| 594 | <title>Configuring the Cross-Toolchains</title> |
| 595 | |
| 596 | <para> |
| 597 | The earlier section, |
| 598 | "<link linkend='neon-configuring-the-eclipse-yocto-plug-in'>Configuring the Neon Eclipse Yocto Plug-in</link>", |
| 599 | sets up the default project configurations. |
| 600 | You can override these settings for a given project by following |
| 601 | these steps: |
| 602 | <orderedlist> |
| 603 | <listitem><para>Select "Yocto Project Settings" from |
| 604 | the "Project -> Properties" menu. |
| 605 | This selection brings up the Yocto Project Settings |
| 606 | Dialog and allows you to make changes specific to an |
| 607 | individual project.</para> |
| 608 | <para>By default, the Cross Compiler Options and Target |
| 609 | Options for a project are inherited from settings you |
| 610 | provided using the Preferences Dialog as described |
| 611 | earlier in the |
| 612 | "<link linkend='neon-configuring-the-eclipse-yocto-plug-in'>Configuring the Neon Eclipse Yocto Plug-in</link>" section. |
| 613 | The Yocto Project Settings Dialog allows you to override |
| 614 | those default settings for a given project. |
| 615 | </para></listitem> |
| 616 | <listitem><para>Make or verify your configurations for the |
| 617 | project and click "OK". |
| 618 | </para></listitem> |
| 619 | <listitem><para>Right-click in the navigation pane and |
| 620 | select "Reconfigure Project" from the pop-up menu. |
| 621 | This selection reconfigures the project by running |
| 622 | <filename>autogen.sh</filename> in the workspace for |
| 623 | your project. |
| 624 | The script also runs <filename>libtoolize</filename>, |
| 625 | <filename>aclocal</filename>, |
| 626 | <filename>autoconf</filename>, |
| 627 | <filename>autoheader</filename>, |
| 628 | <filename>automake --a</filename>, and |
| 629 | <filename>./configure</filename>. |
| 630 | Click on the "Console" tab beneath your source code to |
| 631 | see the results of reconfiguring your project. |
| 632 | </para></listitem> |
| 633 | </orderedlist> |
| 634 | </para> |
| 635 | </section> |
| 636 | |
| 637 | <section id='neon-building-the-project'> |
| 638 | <title>Building the Project</title> |
| 639 | |
| 640 | <para> |
| 641 | To build the project select "Build All" from the |
| 642 | "Project" menu. |
| 643 | The console should update and you can note the cross-compiler |
| 644 | you are using. |
| 645 | <note> |
| 646 | When building "Yocto Project SDK Autotools" projects, the |
| 647 | Eclipse IDE might display error messages for |
| 648 | Functions/Symbols/Types that cannot be "resolved", even when |
| 649 | the related include file is listed at the project navigator and |
| 650 | when the project is able to build. |
| 651 | For these cases only, it is recommended to add a new linked |
| 652 | folder to the appropriate sysroot. |
| 653 | Use these steps to add the linked folder: |
| 654 | <orderedlist> |
| 655 | <listitem><para> |
| 656 | Select the project. |
| 657 | </para></listitem> |
| 658 | <listitem><para> |
| 659 | Select "Folder" from the |
| 660 | <filename>File > New</filename> menu. |
| 661 | </para></listitem> |
| 662 | <listitem><para> |
| 663 | In the "New Folder" Dialog, select "Link to alternate |
| 664 | location (linked folder)". |
| 665 | </para></listitem> |
| 666 | <listitem><para> |
| 667 | Click "Browse" to navigate to the include folder inside |
| 668 | the same sysroot location selected in the Yocto Project |
| 669 | configuration preferences. |
| 670 | </para></listitem> |
| 671 | <listitem><para> |
| 672 | Click "OK". |
| 673 | </para></listitem> |
| 674 | <listitem><para> |
| 675 | Click "Finish" to save the linked folder. |
| 676 | </para></listitem> |
| 677 | </orderedlist> |
| 678 | </note> |
| 679 | </para> |
| 680 | </section> |
| 681 | |
| 682 | <section id='neon-starting-qemu-in-user-space-nfs-mode'> |
| 683 | <title>Starting QEMU in User-Space NFS Mode</title> |
| 684 | |
| 685 | <para> |
| 686 | To start the QEMU emulator from within Eclipse, follow these |
| 687 | steps: |
| 688 | <note> |
| 689 | See the |
| 690 | "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-qemu'>Using the Quick EMUlator (QEMU)</ulink>" |
| 691 | chapter in the Yocto Project Development Tasks Manual |
| 692 | for more information on using QEMU. |
| 693 | </note> |
| 694 | <orderedlist> |
| 695 | <listitem><para>Expose and select "External Tools |
| 696 | Configurations ..." from the "Run -> External Tools" menu. |
| 697 | </para></listitem> |
| 698 | <listitem><para> |
| 699 | Locate and select your image in the navigation panel to |
| 700 | the left (e.g. <filename>qemu_i586-poky-linux</filename>). |
| 701 | </para></listitem> |
| 702 | <listitem><para> |
| 703 | Click "Run" to launch QEMU. |
| 704 | <note> |
| 705 | The host on which you are running QEMU must have |
| 706 | the <filename>rpcbind</filename> utility running to be |
| 707 | able to make RPC calls on a server on that machine. |
| 708 | If QEMU does not invoke and you receive error messages |
| 709 | involving <filename>rpcbind</filename>, follow the |
| 710 | suggestions to get the service running. |
| 711 | As an example, on a new Ubuntu 16.04 LTS installation, |
| 712 | you must do the following in order to get QEMU to |
| 713 | launch: |
| 714 | <literallayout class='monospaced'> |
| 715 | $ sudo apt-get install rpcbind |
| 716 | </literallayout> |
| 717 | After installing <filename>rpcbind</filename>, you |
| 718 | need to edit the |
| 719 | <filename>/etc/init.d/rpcbind</filename> file to |
| 720 | include the following line: |
| 721 | <literallayout class='monospaced'> |
| 722 | OPTIONS="-i -w" |
| 723 | </literallayout> |
| 724 | After modifying the file, you need to start the |
| 725 | service: |
| 726 | <literallayout class='monospaced'> |
| 727 | $ sudo service portmap restart |
| 728 | </literallayout> |
| 729 | </note> |
| 730 | </para></listitem> |
| 731 | <listitem><para>If needed, enter your host root password in |
| 732 | the shell window at the prompt. |
| 733 | This sets up a <filename>Tap 0</filename> connection |
| 734 | needed for running in user-space NFS mode. |
| 735 | </para></listitem> |
| 736 | <listitem><para>Wait for QEMU to launch. |
| 737 | </para></listitem> |
| 738 | <listitem><para>Once QEMU launches, you can begin operating |
| 739 | within that environment. |
| 740 | One useful task at this point would be to determine the |
| 741 | IP Address for the user-space NFS by using the |
| 742 | <filename>ifconfig</filename> command. |
| 743 | The IP address of the QEMU machine appears in the |
| 744 | xterm window. |
| 745 | You can use this address to help you see which particular |
| 746 | IP address the instance of QEMU is using. |
| 747 | </para></listitem> |
| 748 | </orderedlist> |
| 749 | </para> |
| 750 | </section> |
| 751 | |
| 752 | <section id='neon-deploying-and-debugging-the-application'> |
| 753 | <title>Deploying and Debugging the Application</title> |
| 754 | |
| 755 | <para> |
| 756 | Once the QEMU emulator is running the image, you can deploy |
| 757 | your application using the Eclipse IDE and then use |
| 758 | the emulator to perform debugging. |
| 759 | Follow these steps to deploy the application. |
| 760 | <note> |
| 761 | Currently, Eclipse does not support SSH port forwarding. |
| 762 | Consequently, if you need to run or debug a remote |
| 763 | application using the host display, you must create a |
| 764 | tunneling connection from outside Eclipse and keep |
| 765 | that connection alive during your work. |
| 766 | For example, in a new terminal, run the following: |
| 767 | <literallayout class='monospaced'> |
| 768 | $ ssh -XY <replaceable>user_name</replaceable>@<replaceable>remote_host_ip</replaceable> |
| 769 | </literallayout> |
| 770 | Using the above form, here is an example: |
| 771 | <literallayout class='monospaced'> |
| 772 | $ ssh -XY root@192.168.7.2 |
| 773 | </literallayout> |
| 774 | After running the command, add the command to be executed |
| 775 | in Eclipse's run configuration before the application |
| 776 | as follows: |
| 777 | <literallayout class='monospaced'> |
| 778 | export DISPLAY=:10.0 |
| 779 | </literallayout> |
| 780 | Be sure to not destroy the connection during your QEMU |
| 781 | session (i.e. do not |
| 782 | exit out of or close that shell). |
| 783 | </note> |
| 784 | <orderedlist> |
| 785 | <listitem><para>Select "Debug Configurations..." from the |
| 786 | "Run" menu.</para></listitem> |
| 787 | <listitem><para>In the left area, expand |
| 788 | <filename>C/C++Remote Application</filename>. |
| 789 | </para></listitem> |
| 790 | <listitem><para>Locate your project and select it to bring |
| 791 | up a new tabbed view in the Debug Configurations Dialog. |
| 792 | </para></listitem> |
| 793 | <listitem><para>Click on the "Debugger" tab to see the |
| 794 | cross-tool debugger you are using. |
| 795 | Be sure to change to the debugger perspective in Eclipse. |
| 796 | </para></listitem> |
| 797 | <listitem><para>Click on the "Main" tab. |
| 798 | </para></listitem> |
| 799 | <listitem><para>Create a new connection to the QEMU instance |
| 800 | by clicking on "new".</para></listitem> |
| 801 | <listitem><para>Select <filename>SSH</filename>, which means |
| 802 | Secure Socket Shell. |
| 803 | Optionally, you can select a TCF connection instead. |
| 804 | </para></listitem> |
| 805 | <listitem><para>Click "Next". |
| 806 | </para></listitem> |
| 807 | <listitem><para>Clear out the "Connection name" field and |
| 808 | enter any name you want for the connection. |
| 809 | </para></listitem> |
| 810 | <listitem><para>Put the IP address for the connection in |
| 811 | the "Host" field. |
| 812 | For QEMU, the default is <filename>192.168.7.2</filename>. |
| 813 | However, if a previous QEMU session did not exit |
| 814 | cleanly, the IP address increments (e.g. |
| 815 | <filename>192.168.7.3</filename>). |
| 816 | <note> |
| 817 | You can find the IP address for the current QEMU |
| 818 | session by looking in the xterm that opens when |
| 819 | you launch QEMU. |
| 820 | </note> |
| 821 | </para></listitem> |
| 822 | <listitem><para>Enter <filename>root</filename>, which |
| 823 | is the default for QEMU, for the "User" field. |
| 824 | Be sure to leave the password field empty. |
| 825 | </para></listitem> |
| 826 | <listitem><para>Click "Finish" to close the |
| 827 | New Connections Dialog. |
| 828 | </para></listitem> |
| 829 | <listitem><para>If necessary, use the drop-down menu now in the |
| 830 | "Connection" field and pick the IP Address you entered. |
| 831 | </para></listitem> |
| 832 | <listitem><para>Assuming you are connecting as the root user, |
| 833 | which is the default for QEMU x86-64 SDK images provided by |
| 834 | the Yocto Project, in the "Remote Absolute File Path for |
| 835 | C/C++ Application" field, browse to |
| 836 | <filename>/home/root/</filename><replaceable>ProjectName</replaceable> |
| 837 | (e.g. <filename>/home/root/hello</filename>). |
| 838 | You could also browse to any other path you have write |
| 839 | access to on the target such as |
| 840 | <filename>/usr/bin</filename>. |
| 841 | This location is where your application will be located on |
| 842 | the QEMU system. |
| 843 | If you fail to browse to and specify an appropriate |
| 844 | location, QEMU will not understand what to remotely |
| 845 | launch. |
| 846 | Eclipse is helpful in that it auto fills your application |
| 847 | name for you assuming you browsed to a directory. |
| 848 | <note><title>Tips</title> |
| 849 | <itemizedlist> |
| 850 | <listitem><para> |
| 851 | If you are prompted to provide a username |
| 852 | and to optionally set a password, be sure |
| 853 | you provide "root" as the username and you |
| 854 | leave the password field blank. |
| 855 | </para></listitem> |
| 856 | <listitem><para> |
| 857 | If browsing to a directory fails or times |
| 858 | out, but you can |
| 859 | <filename>ssh</filename> into your QEMU |
| 860 | or target from the command line and you |
| 861 | have proxies set up, it is likely that |
| 862 | Eclipse is sending the SSH traffic to a |
| 863 | proxy. |
| 864 | In this case, either use TCF , or click on |
| 865 | "Configure proxy settings" in the |
| 866 | connection dialog and add the target IP |
| 867 | address to the "bypass proxy" section. |
| 868 | You might also need to change |
| 869 | "Active Provider" from Native to Manual. |
| 870 | </para></listitem> |
| 871 | </itemizedlist> |
| 872 | </note> |
| 873 | </para></listitem> |
| 874 | <listitem><para> |
| 875 | Be sure you change to the "Debug" perspective in Eclipse. |
| 876 | </para></listitem> |
| 877 | <listitem><para>Click "Debug" |
| 878 | </para></listitem> |
| 879 | <listitem><para>Accept the debug perspective. |
| 880 | </para></listitem> |
| 881 | </orderedlist> |
| 882 | </para> |
| 883 | </section> |
| 884 | |
| 885 | <section id='neon-using-Linuxtools'> |
| 886 | <title>Using Linuxtools</title> |
| 887 | |
| 888 | <para> |
| 889 | As mentioned earlier in the manual, performance tools exist |
| 890 | (Linuxtools) that enhance your development experience. |
| 891 | These tools are aids in developing and debugging applications and |
| 892 | images. |
| 893 | You can run these tools from within the Eclipse IDE through the |
| 894 | "Linuxtools" menu. |
| 895 | </para> |
| 896 | |
| 897 | <para> |
| 898 | For information on how to configure and use these tools, see |
| 899 | <ulink url='http://www.eclipse.org/linuxtools/'>http://www.eclipse.org/linuxtools/</ulink>. |
| 900 | </para> |
| 901 | </section> |
| 902 | </appendix> |
| 903 | <!-- |
| 904 | vim: expandtab tw=80 ts=4 |
| 905 | --> |