sdk-appendix-neon.xml 47 KB

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