Using the EMAC OE SDK Projects with 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 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 Makefile-based Eclipse project.