sdk-eclipse-project.xml 64 KB

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