sdk-working-projects.xml 79 KB

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