Difference between revisions of "Using the EMAC OE SDK Projects with Eclipse"

From wiki.emacinc.com
Jump to: navigation, search
Line 5: Line 5:
 
SIE
 
SIE
 
Empty. Relevant old wiki page: New EMAC OE SDK Project Using Eclipse http://wiki.emacinc.com/doku.php?id=linux:eclipse:newproject-->
 
Empty. Relevant old wiki page: New EMAC OE SDK Project Using Eclipse http://wiki.emacinc.com/doku.php?id=linux:eclipse:newproject-->
 
+
The EMAC OE SDK is distributed with a set of example projects intended to demonstrate how to use the EMAC OE toolchain and libraries. This guide demonstrates the process of compiling one of the example projects and running it on the target machine using the Eclipse IDE. A basic familiarity with Eclipse is assumed for this guide. For a quick intro see the [[First_Time_Starting_EMAC_Eclipse|First Time Starting Eclipse]].  
The EMAC OE SDK is distributed with a set of example projects intended to demonstrate how to use the EMAC OE toolchain and libraries. This guide demonstrates the process of compiling one of the example projects and running it on the target machine using the Eclipse IDE. A basic familiarity with Eclipse is assumed for this guide. For a quick intro see the [[First_Time_Starting_EMAC_Eclipse|First Time Starting Eclipse]]. This guide uses the ''hello'' EMAC OE SDK example project. It consists of a C file and a ''Makefile''.  
 
  
 
==== Tools Required ====
 
==== Tools Required ====
 
* GNU ''make''
 
* GNU ''make''
 
* EMAC OE SDK
 
* EMAC OE SDK
* ''wput''
+
* wput
 
 
<br />{{Fmbox | type =  | text ='''NOTE''' The required tools are preinstalled on the LDC.}}
 
  
 
== EMAC SDK Example: Compile and Run the hello Project ==
 
== EMAC SDK Example: Compile and Run the hello Project ==
Line 19: Line 16:
 
# Modify ''global.properties'' according to the [[Eclipse_Remote_System_Explorer|SDK Remote Upload Setup]] to provide ''make'' with the correct user, password, and IP address for the ''upload'' target.
 
# Modify ''global.properties'' according to the [[Eclipse_Remote_System_Explorer|SDK Remote Upload Setup]] to provide ''make'' with the correct user, password, and IP address for the ''upload'' target.
 
# Create a [[Using_the_Eclipse_Terminal_View|remote terminal connection]]. This is necessary to use the Remote System Explorer's SSH Terminal feature in the following procedure.
 
# Create a [[Using_the_Eclipse_Terminal_View|remote terminal connection]]. This is necessary to use the Remote System Explorer's SSH Terminal feature in the following procedure.
=== Building the Project ===
+
=== Create a new Makefile-based project ===
This procedure provides an overview of how to compile and run C applications for EMAC products in Eclipse. It assumes familiarity with the C programming language and is not intended as a general guide on learning to program.
+
<cl>
# Click ''Window → Open Perspective → Other...'' To bring up a dialog window with a list of Perspectives to choose from.
+
1. Click ''Window → Open Perspective → Other...'' To bring up a dialog window with a list of Perspectives to choose from.
# Choose ''C/C++'' and click ''Ok''.<ref name="Note 1">See Note 1</ref>
+
* Choose ''C/C++'' and click ''Ok''.
 +
* Select ''File→New→Makefile Project with Existing Code''
 +
* In the window that appears, click the ''Browse...'' button.
 +
 
 +
[[File:Import existing code.png|400px|thumb|left]]
 +
 
 +
<br clear=all>
 +
 
 +
* Navigate to the location of the project.  By default this is under the home directory in <code>~/EMAC-OE-arm-linux-gnueabi-SDK_4.0/projects/hello</code>
 +
* Click the ''OK'' button.
 +
 
 +
[[File:Import project hello.png|400px|thumb|left]]
 +
 
 +
<br clear=all>
 +
 
 +
* Click the ''Finish'' button.
  
==== Building With the Eclipse Managed Build System ====
+
[[File:Proj expl after hello import.png|400px|thumb|left]]
To build using Eclipse's managed build system a project needs to be created from the Makefile-based project. To do this perform the following steps:
 
# Select ''File→New→Makefile Project with Existing Code''
 
# In the window that appears (as shown below) click the ''Browse...'' button.<br /><br />
 
  
[[File:Import existing code.png|Import Existing Code]]<br />
+
<br clear=all>
<br />
 
  
==== Choosing the Project ====
+
The arrowhead to the left of ''hello'' indicates that the ''hello'' project is open.  Click on the arrowhead to see the files in the project.  Double click on the <code>hello.c</code> file to open it.
# Navigate to the location of the project.  By default this is under your home directory in <code>~/EMAC-OE-arm-linux-gnueabi-SDK_4.0/projects/hello</code>
 
# The files listed in the directory will be grayed out, but this is to be expected. Eclipse is just looking for the root directory of the project you are importing. Click the ''OK'' button.
 
#Your ''Import'' window should now look similar to this:<br /><br />
 
[[File:Import project hello.png|Import "Hello" Project]]<br /><br />
 
Click the ''Finish'' button.You should now see the following in your ''Project Explorer'':<br /><br />
 
[[File:Proj expl after hello import.png|Project Explorer after importing "Hello" project.]]<br /><br />
 
The arrowhead to the left of ''hello'' indicates that the ''hello'' project is open.  Click on the arrowhead to see the files in the project.  Double click on the <code>hello.c</code> file to open it. '''''Note''': This step is not necessary for building the project.''  Notice the arrowhead which appeared next to <code>hello.c</code>.  This indicates that the file is now open.<br /><br />
 
  
To build the project, first ensure the project is highlighted in the ''Project Explorer'' treeview in the left pane, then select ''Project->Build Project''. The project will now build and your window should appear similar to the screenshot below:<br /><br />
+
* To build the project, first ensure the project is highlighted in the ''Project Explorer'' treeview in the left pane, then select ''Project->Build Project''. The project will now build and your window should appear similar to the screenshot below:
  
[[File:Eclipse hello project built.png|Eclipse window after building the "Hello" example project.]]<br /><br />
+
[[File:Eclipse hello project built.png|600px|thumb|left]]
  
 +
<br clear=all>
  
If there are any build errors they will be shown in the ''Console'' and/or ''Problems'' tabs on the bottom.<br /><br />
+
Any build errors will be shown in the ''Console'' and/or ''Problems'' tabs on the bottom.
 +
</cl>
  
== EMAC SDK with Qt Example: Compile and Run the <code>textedit</code> Project ==
+
=== Uploading the Project to the Target Machine ===
=== Importing the Project ===
 
  
This procedure provides an overview of how to compile and run Qt C++ applications for EMAC products in Eclipse. It assumes familiarity with the C++ programming language and is not intended as a general guide on learning to program, learning C++, or learning Qt.
+
<cl>
 +
1. Click on the ''Make Target'' view tab in the right hand pane. If it is not open, Click ''Window→Show View→Other...'' and select ''Make→Make Taget''
 +
* Right click on the ''Make Target'' view tab and choose ''New...''
  
#Click ''Window → Open Perspective → Other...'' To bring up a dialog window with a list of Perspectives to choose from.
+
* Type ''upload'' as the Target name and click ''OK''
#Choose ''Qt C++'' and click ''Ok''.
 
  
==== Building With the Eclipse Managed Build System ====
+
[[File:Create_make_target.png|400px|thumb|left]]
  
To build using Eclipse's managed build system the project needs to be imported using its ''.pro'' project file.  To do this perform the following steps:
+
<br clear=all>
  
{{Fmbox | type =  | text ='''NOTE''': The first project which must be imported and built is the ''shared'' project.  The rest of the examples in the ''projects/qt_demos'' directory depend on the ''shared'' project.  Once it has been built it is safe to close the project and/or remove the project from Eclipse (just be sure to not remove it from disk).}}<br />
+
* To upload the executable to the target machine right click on the ''upload'' target in the ''Make Targets'' window and select ''Build Target''
  
# In the ''Project Explorer'' treeview control on the left side of the screen make sure that nothing is selected (click in a blank area, if necessary), put the mouse cursor in a blank area and right click.  From the context menu which appears, select, ''Import...''  <br /><br />[[File:Eclipse import project context selected.png|Importing a project into Eclipse]]<br /><br />
+
The binary executable should be uploaded to the target machine.  If there is an error, check to make sure the <code>wput</code> command installed, and that it can be called from within the Eclipse IDE
# In the window that appears (as shown below) make sure ''Qt Project'' is selected from the ''Qt'' entry in the treeview. <br /><br />[[File:Eclipse_import_project_step1.png|Selecting Qt Project as the project type]] <br /><br />
+
# Click ''Next >'', then click the ''Browse...'' button and navigate to the <code>projects/qt_demos/textedit</code> directory underneath the install location of your EMAC OE Qt SDK. <br /><br />[[File:Eclipse_import_project_step2.png|Choosing the Qt project to import]] <br /><br />
+
* Now [[Remote_System_Explorer_Shell_and_Terminal_Setup|Connect]] to the target machine.
# Highlight the ''.pro'' file, as shown above, and click ''OK''.  
+
* Run the program as shown below using the remote terminal created in the Remote Terminal Setup Guide.
#Click ''Finish''. <br /><br />
 
  
=== Building the Project ===
+
[[File:Chmod_run_phello1.png|400px|thumb|left]]
  
You should now see the following in your ''Project Explorer'':<br />
+
<br clear=all>
<br />[[File:Eclipse_textedit_project_selected.png|Project Explorer after importing <code>textedit</code> project.]]<br />
+
</cl>
<br />The arrowhead to the left of ''textedit'' indicates that the ''textedit'' project is open.  Click on the arrowhead to see the files in the project.  Double click on the <code>textedit.cpp</code> file to open it. ''('''Note''': This step is not necessary for building the project.)''  Notice the arrowhead which appears next to <code>textedit.cpp</code>.  This can be used to see a list of classes and functions available within this source file.<br />
+
The following is a brief description of each command seen in the SSH Terminal window above:
<br />To build the project, ensure the project is highlighted in the ''Project Explorer'' treeview in the left pane, then select ''Project→Run qmake''. Now, select ''Project→Build Project''.  The project will now build, and your window should appear similar to the screenshot below:<br />
+
* <code>cd /tmp</code>: Change the current working directory to <code>/tmp/</code>.
<br />[[File:Eclipse_qt_build_textedit_finished.png|Eclipse window after building the <code>textedit</code> example project.]]<br />
+
* <code>ls -l</code>: List the current working directory's contents with file permissions shown. Notice that root does not have execute permissions for the file <code>hello</code>.
<br />If there are any build errors they will be shown in the ''Console'' and/or ''Problems'' tabs on the bottom.<br />
+
* <code>chmod u+x hello</code>: Give executable permissions to the owner of the <code>hello</code> file. Note that this assumes that the same user is used to log in through the SSH Terminal as was specified in 'global.properties'' according to Step 1 of the Setup for this guide--in this example, the user is <code>root</code>.
<br />
+
* <code>ls -l</code>: List the current working directory's contents with file permissions shown to be sure that root now has execute permission. The new <code>x</code> indicates that <code>root</code> does now have execute permissions.
 +
* <code>./hello</code>: Execute the binary. The output shown is a simple message printed to the screen, "Hello EMAC OE!".
  
=== Building With Make Targets ===
+
== EMAC SDK with Qt Example: Compile and Run the <code>textedit</code> Project ==
 +
=== Importing the Project ===
  
# Select the ''Make Targets'' View.  
+
This procedure provides an overview of how to compile and run Qt C++ applications in Eclipse.  
# Expand ''EMAC-OE-arm-linux-gnueabi-SDK_4.0 → projects → hello''.<ref name="Note 2">See Note 2</ref>
+
<cl>
# Cross-compile the program:<br >Click on the project you're building in the left pane to '''ensure it is highlighted in blue'''. The result is shown in Figure 1 below. Now click on ''Project→Build Project''.<br /><br />[[File:Eclipse_make_hello.png|Build Project]]<br /><br /> The project to be built '''must''' be hilighted in the left pane, as shown above, before you click ''Project→Build Project'' to compile the hello example project (this is true any time you build a project). ''Build Project'' will perform an incremental build of the currently selected project.  Choosing ''Project→Clean...'' before choosing ''Project→Build Project'' will perform a full rebuild of the project.  The method used to determine what to build during an incremental build can be found here: [http://www.gnu.org/software/make/manual/make.html GNU 'make' Manual].
+
1. Click ''Window → Open Perspective → Other...'' To bring up a dialog window with a list of Perspectives to choose from.
 +
* Choose ''Qt C++'' and click ''Ok''.
 +
* Select ''File→Import...''
 +
* Expand Qt and select Qt Project
  
<br />{{Fmbox | type =  | text ='''Note 1''': If you have the Qt SDK then you will need to choose ''Qt C++'' instead to work with Qt projects.  For this first example though, the ''C/C++'' perspective is the correct one to use with the example program demonstrated here.}}
+
[[File:Eclipse_import_project_step1.png|500px|thumb|left]]
  
{{Fmbox | type = | text ='''Note 2''': If you are unable to expand ''EMAC-OE-arm-linux-gnueabi-SDK_4.0'', right-click on it and choose ''Open Project''.  This should then cause an arrowhead to appear to the left of ''EMAC-OE-arm-linux-gnueabi-SDK_4.0''.  Click the arrowhead to expand it.  This feature allows you to only keep the project you're currently working on open so that metadata for all your projects is not allocated in RAM.<br /><br /> '''To close a project''' you're not actively working on, right click on the project and click ''Close Project''.  More conveniently, to close all projects other than the one you are currently working on, right-click on your current project and click, ''Close Unrelated Projects''.}}
+
<br clear=all>
  
=== Uploading the Project to the Target Machine ===
+
* Click ''Next >'', then click ''Browse...''
 +
* Navigate to the <code>projects/qt_demos/textedit</code> directory underneath the install location of the EMAC OE SDK.
 +
* Highlight ''textedit.pro'' then click ''OK''.
 +
* Click ''Finish''.
  
In order to use the make target for uploading the code to the target machine (your board from EMAC) you could run the following command in a shell:<ref name="Note 3">In Linux, a ''shell'' is similar to a ''Command Prompt'' on other operating systems</ref>
+
[[File:Eclipse_import_project_step2.png|500px|thumb|left]]
<syntaxhighlight lang=bash>
 
make upload</syntaxhighlight>
 
  
In fact, this is what Eclipse will execute for you in order to perform this step.  In order to tell Eclipse how to do this we first need to create a ''make target'' for the <code>upload</code> make target.  To do so perform the following steps:
+
<br clear=all>
# Right click on the project name in the left pane (''hello'' in this example), and choose ''Make Targets→Build...'' (or just press <Shift>-<F9> while the project is highlighted in blue).  This will bring up the window shown below:<br /><br />[[File:Make_targets.png|Make targets]]<br /><br />
+
</cl>
#Check to see if there is an ''upload'' target in the list shown.  If so, skip the next step.
+
===Building the Project===
#If there is no <code>upload</code> target, click the ''Add...'' button located in the upper right corner of the window shown in Figure 2.  The window shown below will appear.<br /><br /> [[File:Create_make_target.png|Create make target]]<br /><br /> Fill in the word <code>upload</code> for ''Target name'', and Eclipse will automatically set <code>upload</code> to the name of the make target.  Ensure the information in your ''Create Make Target'' corresponds to that shown above, and click ''Ok''.
 
#To upload the executable to the target machine click on the ''upload'' target in the ''Make Targets'' window as shown below.<br /><br /> [[File:Make_target_upload.png|<code>upload</code> selected in ''Make Targets'']]<br /><br /> Once you have selected the <code>upload</code> target, click build.  The binary executable should be uploaded to the target machine.  If there is an error, check to ensure you have the <code>wput</code> command installed, and that it can be called from within the Eclipse IDE (to ensure the <code>PATH</code> used by Eclipse contains the directory where <code>wput</code> is located).  See [[Using_the_Eclipse_Terminal_View|local]] to see how to get a shell within the Eclipse environment which can be used to check for the <code>wput</code> command by typing <code>wput -h</code>.  If <code>wput</code> can be found within the <code>PATH</code> being used by Eclipse, you will see [[help]] information on how to use the command.  Otherwise, <code>wput</code> is either not installed or not in the <code>PATH</code>.<ref name="Note 4">See your Linux distribution's documentation to learn how to install the <code>wput</code> command (this is Ubuntu Linux if you're using the LDC).<br /> Information about the <code>PATH</code> environment variable can be found by typing <code>man bash</code> at a shell prompt, then typing <code>/COMMAND EXECUTION</code> (in all caps) to search for the relevant section of the Bash manpage.</ref>  Assuming <code>wput</code> is installed and can be found in the <code>PATH</code>, the Makefile will use variables stored in the <code>global.properties</code> file to call <code>wput</code> to upload the binary executable to the target machine.  The <code>global.properties</code> file is included in the Makefile using the <code>include</code> keyword.  This include statement is automatically placed into the Makefile by the Eclipse build system. The <code>global.properties</code> file also contains variables which <code>make</code> passes to the compiler to ensure that the executable produced is compatible with the target CPU architecture.
 
#Now [[Remote_System_Explorer_Shell_and_Terminal_Setup|Connect]] to the target machine.
 
#Run the program as shown below using the remote terminal created in the Remote Terminal Setup Guide.<br /><br /> [[File:Chmod_run_phello1.png|Running the Remote Application]]<br /><br /> The following is a brief description of each command seen in the SSH Terminal window above:
 
##<code>cd /tmp</code>: Change the current working directory to <code>/tmp/</code>.
 
##<code>ls -l</code>: List the current working directory's contents with file permissions shown. Notice that root does not have execute permissions for the file <code>hello</code>.
 
##<code>chmod u+x hello</code>: Give executable permissions to the owner of the <code>hello</code> file. Note that this assumes that the same user is used to log in through the SSH Terminal as was specified in ''global.properties'' according to Step 1 of the Setup for this guide--in this example, the user is <code>root</code>.
 
##<code>ls -l</code>: List the current working directory's contents with file permissions shown to be sure that root now has execute permission. The new <code>x</code> indicates that <code>root</code> does now have execute permissions.
 
##<code>./hello</code>: Execute the binary. The output shown is a simple message printed to the screen, "Hello EMAC OE!".
 
  
<br />{{Fmbox | type =  | text =To learn more about what each of the above commands can do, while in a shell type ''man'' followed by the name of the command of interest.<br /> For example, you can type: <syntaxhighlight lang=bash>man ls</syntaxhighlight> to discover that <code>ls</code> is in fact a far more sophisticated tool than the <code>dir</code> command you may already know.  Use <code>q</code> to ''quit'' the manual page viewer and return to the shell.<br /><br /> While viewing a manpage (''manpage'' is a typical abbreviation for ''manual page''), try pressing the <code>h</code> key.  This will show you a great deal of information about how to use the manual page viewer to its fullest potential.  To return to the manual page press the <code>q</code> key to ''quit'' viewing the manpage viewer's [[help]] page.<br /><br /> When in doubt while using Linux shell tools keep one thing in mind: methods for accomplishing things in various shell programs tend to be very consistent.  Not many tools break away from convention, so when you learn one command you're usually learning things you can do with many other Linux shell commands as well.}}<br />
+
The ''Project Explorer'' should now show the ''textedit'' project.
  
If you want to make modifications to the Example C File and recompile it, follow the same procedure as above to test it again. With a few iterations of this the process will become familiar and easy.
+
:: [[File:Eclipse_textedit_project_selected.png|600px|thumb|left]]
  
=== Example C File ===
+
<br clear=all>
This C file can be used by programmers as an example to ensure their build system for EMAC products is functioning correctly. It is included in the EMAC OE SDK [[Using_EMAC_OE_SDK_Example_Projects#Example C File|Example Project Guide]].
 
  
=== Example Makefile ===
+
The arrowhead to the left of ''textedit'' indicates that the ''textedit'' project is open.
 +
<cl>
 +
1. Click on the arrowhead to see the files in the project.
 +
* Double click on the <code>textedit.cpp</code> file to open it.  The arrow next to textedit.cpp can be expanded to see a list of classes and functions available within this source file.
  
The EMAC OE SDK [[Using_EMAC_OE_SDK_Example_Projects#Example Makefile|Example Project Guide]] shows the default <code>Makefile</code> file used for the <code>hello</code> example project. This is a necessary component of the EMAC OE SDK which directs GNU 'Make' in resolving source code dependencies before calling the cross-compiler to create a binary for the target platform. It also provides a convenient <code>upload</code> target which utilizes the development system's <code>wput</code> command to send the compiled binary to the target systemIf you intend to write your own <code>Makefile</code> from scratch, EMAC recommends paying close attention to the include paths to learn more about the SDK cross compilation tools.
+
* To build the project, ensure the project is highlighted in the ''Project Explorer'' treeview in the left pane.
 +
* Select ''Project→Run qmake''
 +
* Now, select ''Project→Build Project''.  The project will now build, and your window should appear similar to the screenshot below:
  
== Next Steps ==
+
[[File:Eclipse_qt_build_textedit_finished.png|x400px|thumb|left]]
  
 +
<br clear=all>
  
The next step is to create a new Makefile-based Eclipse project from scratch. This process is similar to the example above but requires a few extra steps. See the [[Creating_New_Projects_with_EMAC_Eclipse|New Project Guide]] for [[help]] on this.
+
If there are any build errors they will be shown in the ''Console'' and/or ''Problems'' tabs on the bottom.
 +
</cl>
  
<!--== See Also ==
+
== Next Steps ==
* [[Eclipse Introduction|Introduction]]
 
* [[Installing Eclipse|Installation]]
 
* [[Configuring Eclipse|Configuration]]
 
* [[First Time Starting Eclipse]]
 
* [[Using the Eclipse Terminal View]]
 
* [[Importing the EMAC OE SDK Projects with Eclipse|Importing EMAC OE SDK Projects]]
 
* [[Using the EMAC OE SDK Projects with Eclipse|Using the EMAC OE SDK Projects]]
 
* [[Creating New Projects with Eclipse|Creating New Projects]]
 
* [[Eclipse_Remote_System_Explorer|Remote System Explorer]]
 
** [[Remote System Explorer Setup for Eclipse|RSE Setup]]
 
** [[Remote System Explorer SFTP Setup for Eclipse|RSE SFTP Setup]]
 
** [[Remote System Explorer Shell and Terminal Setup|Remote Shell and Terminal Setup]]
 
* [[Executing Remote Applications with Eclipse|Executing Remote Applications]]
 
* [[Debugging Remote Applications with Eclipse|Debugging Remote Applications]]-->
 
  
----
+
The next step is to create a new  [[Creating_New_Projects_with_Eclipse|New Project Guide | Makefile-based Eclipse project.]]
<references />
 
  
 
[[Category:Eclipse]]
 
[[Category:Eclipse]]

Revision as of 19:33, 23 December 2013

TODO: {{#todo:Completed; (10.29.13-22:40->MD+)(11.06.13-15:20->JG+)|Klint Youngmeyer|oe 4,oe 5,ky,Complete, md}}

The EMAC OE SDK is distributed with a set of example projects intended to demonstrate how to use the EMAC OE toolchain and libraries. This guide demonstrates the process of compiling one of the example projects and running it on the target machine using the Eclipse IDE. A basic familiarity with Eclipse is assumed for this guide. For a quick intro see the First Time Starting Eclipse.

Tools Required

  • GNU make
  • EMAC OE SDK
  • wput

EMAC SDK Example: Compile and Run the hello Project

Setup

  1. Modify global.properties according to the SDK Remote Upload Setup to provide make with the correct user, password, and IP address for the upload target.
  2. Create a remote terminal connection. This is necessary to use the Remote System Explorer's SSH Terminal feature in the following procedure.

Create a new Makefile-based project

  1. Click Window → Open Perspective → Other... To bring up a dialog window with a list of Perspectives to choose from.

  2. Choose C/C++ and click Ok.

  3. Select File→New→Makefile Project with Existing Code

  4. In the window that appears, click the Browse... button.


  5. Navigate to the location of the project. By default this is under the home directory in ~/EMAC-OE-arm-linux-gnueabi-SDK_4.0/projects/hello

  6. Click the OK button.


  7. Click the Finish button.


    The arrowhead to the left of hello indicates that the hello project is open. Click on the arrowhead to see the files in the project. Double click on the hello.c file to open it.

  8. To build the project, first ensure the project is highlighted in the Project Explorer treeview in the left pane, then select Project->Build Project. The project will now build and your window should appear similar to the screenshot below:

    Eclipse hello project built.png


    Any build errors will be shown in the Console and/or Problems tabs on the bottom.

Uploading the Project to the Target Machine

  1. Click on the Make Target view tab in the right hand pane. If it is not open, Click Window→Show View→Other... and select Make→Make Taget

  2. Right click on the Make Target view tab and choose New...

  3. Type upload as the Target name and click OK


  4. To upload the executable to the target machine right click on the upload target in the Make Targets window and select Build Target

    The binary executable should be uploaded to the target machine. If there is an error, check to make sure the wput command installed, and that it can be called from within the Eclipse IDE

  5. Now Connect to the target machine.

  6. Run the program as shown below using the remote terminal created in the Remote Terminal Setup Guide.

    Chmod run phello1.png


The following is a brief description of each command seen in the SSH Terminal window above:

  • cd /tmp: Change the current working directory to /tmp/.
  • ls -l: List the current working directory's contents with file permissions shown. Notice that root does not have execute permissions for the file hello.
  • chmod u+x hello: Give executable permissions to the owner of the hello file. Note that this assumes that the same user is used to log in through the SSH Terminal as was specified in 'global.properties according to Step 1 of the Setup for this guide--in this example, the user is root.
  • ls -l: List the current working directory's contents with file permissions shown to be sure that root now has execute permission. The new x indicates that root does now have execute permissions.
  • ./hello: Execute the binary. The output shown is a simple message printed to the screen, "Hello EMAC OE!".

EMAC SDK with Qt Example: Compile and Run the textedit Project

Importing the Project

This procedure provides an overview of how to compile and run Qt C++ applications in Eclipse.

  1. Click Window → Open Perspective → Other... To bring up a dialog window with a list of Perspectives to choose from.

  2. Choose Qt C++ and click Ok.

  3. Select File→Import...

  4. Expand Qt and select Qt Project

    Eclipse import project step1.png


  5. Click Next >, then click Browse...

  6. Navigate to the projects/qt_demos/textedit directory underneath the install location of the EMAC OE SDK.

  7. Highlight textedit.pro then click OK.

  8. Click Finish.

    Eclipse import project step2.png


Building the Project

The Project Explorer should now show the textedit project.

Eclipse textedit project selected.png


The arrowhead to the left of textedit indicates that the textedit project is open.

  1. Click on the arrowhead to see the files in the project.

  2. Double click on the textedit.cpp file to open it. The arrow next to textedit.cpp can be expanded to see a list of classes and functions available within this source file.

  3. To build the project, ensure the project is highlighted in the Project Explorer treeview in the left pane.

  4. Select Project→Run qmake

  5. Now, select Project→Build Project. The project will now build, and your window should appear similar to the screenshot below:

    Eclipse qt build textedit finished.png


    If there are any build errors they will be shown in the Console and/or Problems tabs on the bottom.

Next Steps

The next step is to create a new New Project Guide | Makefile-based Eclipse project.