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
- Make sure the system is configured for the correct target machine and that the IP and user/password are set.
- Create a remote terminal connection. This is necessary to use the Remote System Explorer's SSH Terminal feature in the following procedure.
- Launch Eclipse and Import the SDK projects if not already done.
Procedure
This guide will compile and upload one of the SDK example projects to a board using make targets. Also, the Eclipse Remote Terminal will be used to run the program.
-
Open C/C++ perspective
-
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.
-
-
Open Make Target View
-
Click Window → Show View → Other ... To bring up a dialog window with a list of Views to choose from.
-
Choose Make → Make Target
-
-
Expand projects → hello in the Make Target view.
-
Double-click the all
make
Target to compile the project. See Figure 1 below.
The all
make
target tellsmake
to run the compiler to compile all of the source files listed in theCFILES
variable in theMakefile
.make
will check the modification times of these *.c files against that of the currently existing executable (if there is one) to see if they have been modified since the last time the executable was compiled. If they have, make reruns the toolchain commands necessary to produce a new executable. For a more in-depth explanation see the | GNU `make' Manual -
Double click the upload
make
target to upload the program to the target machine. See Figure 2 below.
The upload
make
target tellsmake
to use thewput
command to send the binary to the target machine using the variables stored in theglobal.properties
file. -
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 inglobal.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!".
Example C and Makefile
See example files for more information about the files used in this procedure.
Next Steps
The next step is to create a new Makefile-based Eclipse project.