sdk-appendix-mars.xml 46 KB

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