sdk-eclipse-project.xml 64 KB

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