sdk-appendix-neon.xml 48 KB

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