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