Difference between revisions of "Using the EMAC OE SDK Projects with Eclipse"
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]] | ||
==== Tools Required ==== | ==== Tools Required ==== | ||
* GNU ''make'' | * GNU ''make'' | ||
* EMAC OE SDK | * EMAC OE SDK | ||
− | * | + | * wput |
− | |||
− | |||
== 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. | ||
− | === | + | === Create a new Makefile-based project === |
− | + | <cl> | |
− | + | 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''. | |
+ | * 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. | ||
− | + | [[File:Proj expl after hello import.png|400px|thumb|left]] | |
− | |||
− | |||
− | |||
− | + | <br clear=all> | |
− | |||
− | + | 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. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | 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. | ||
− | 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: | + | * 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| | + | [[File:Eclipse hello project built.png|600px|thumb|left]] |
+ | <br clear=all> | ||
− | + | Any build errors will be shown in the ''Console'' and/or ''Problems'' tabs on the bottom. | |
+ | </cl> | ||
− | == | + | === Uploading the Project to the Target Machine === |
− | |||
− | + | <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...'' | ||
− | + | * Type ''upload'' as the Target name and click ''OK'' | |
− | |||
− | + | [[File:Create_make_target.png|400px|thumb|left]] | |
− | + | <br clear=all> | |
− | + | * 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 <code>wput</code> command installed, and that it can be called from within the Eclipse IDE | |
− | + | ||
− | + | * 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. | |
− | |||
− | + | [[File:Chmod_run_phello1.png|400px|thumb|left]] | |
− | + | <br clear=all> | |
− | < | + | </cl> |
− | < | + | 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!". | ||
− | === | + | == EMAC SDK with Qt Example: Compile and Run the <code>textedit</code> Project == |
+ | === Importing the Project === | ||
− | + | This procedure provides an overview of how to compile and run Qt C++ applications in Eclipse. | |
− | + | <cl> | |
− | + | 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 | ||
− | + | [[File:Eclipse_import_project_step1.png|500px|thumb|left]] | |
− | + | <br clear=all> | |
− | + | * 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''. | ||
− | + | [[File:Eclipse_import_project_step2.png|500px|thumb|left]] | |
− | |||
− | |||
− | + | <br clear=all> | |
− | + | </cl> | |
− | + | ===Building the Project=== | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | The ''Project Explorer'' should now show the ''textedit'' project. | |
− | + | :: [[File:Eclipse_textedit_project_selected.png|600px|thumb|left]] | |
− | = | + | <br clear=all> |
− | |||
− | + | 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. | ||
− | + | * 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: | ||
− | + | [[File:Eclipse_qt_build_textedit_finished.png|x400px|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. | |
+ | </cl> | ||
− | + | == Next Steps == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | - | + | The next step is to create a new [[Creating_New_Projects_with_Eclipse|New Project Guide | Makefile-based Eclipse project.]] |
− | |||
[[Category:Eclipse]] | [[Category:Eclipse]] |
Revision as of 18:33, 23 December 2013
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.
Contents
Tools Required
- GNU make
- EMAC OE SDK
- wput
EMAC SDK Example: Compile and Run the hello Project
Setup
- 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.
- 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
-
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.
-
Select File→New→Makefile Project with Existing Code
-
In the window that appears, click the Browse... button.
-
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
-
Click the OK button.
-
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. -
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:
Any build errors will be shown in the Console and/or Problems tabs on the bottom.
Uploading the Project to the Target Machine
-
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...
-
Type upload as the Target name and click OK
-
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 -
Now Connect to the target machine.
-
Run the program as shown below using the remote terminal created in the Remote Terminal Setup Guide.
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 filehello
.chmod u+x hello
: Give executable permissions to the owner of thehello
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 isroot
.ls -l
: List the current working directory's contents with file permissions shown to be sure that root now has execute permission. The newx
indicates thatroot
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.
-
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
-
Click Next >, then click Browse...
-
Navigate to the
projects/qt_demos/textedit
directory underneath the install location of the EMAC OE SDK. -
Highlight textedit.pro then click OK.
-
Click Finish.
Building the Project
The Project Explorer should now show the textedit project.
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
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. -
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:
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.