Executing Remote Applications with Eclipse
|Table 1: Conventions|
|connection_name||Refers to the name of the connection used to connect to the target board.|
|app_name||Refers to the target name of the application being developed.|
||Refers to the name of the device for which the application is being developed.|
Remote development using Eclipse is enhanced with tools such as the Eclipse Run/Debug Configurations and SSH which enable the remote execution of the application on the remote board. The Eclipse Run/Debug Configurations provide a way to transparently run an application on the remote board by automatically uploading the binary, changing execute permissions, executing, and interacting with the application using an SSH Shell.
Before continuing, ensure that Eclipse is open to the C/C++ or Qt C++ perspective.
- Open EMAC Eclipse
- Click Window → Open Perspective → Other...
- Select C/C++ or Qt C++ (if developing a Qt application)
- Click OK
Create a Run Configuration
Launching an application from within Eclipse requires that a Run Configuration be created. This configuration provides Eclipse all the information it needs to be able to run a specific application. The application can be located either on the development machine or on the target machine provided a suitable connection is available. The following procedure assumes that the application being run is located on a remote target machine. This will be the case for all application development for EMAC products.
- Create a new launch configuration
- In the Project Explorer View, right-click the project to be run
- Select Run As → Run Configurations... to bring up the Run Configuration Dialog.
- In the Type List, right-click C/C++ Remote Application and select New... from the context menu. A new configuration will appear with the Name: equal to the name of the currently open project. This name can be changed by editing the Name: field.
- For instructions relating to fields in the main tab, refer to Figure 1 below.
- Choose a connection from the Connection: drop-down menu or click New... to create a new one.
- The default for the Project: field will be the currently-active project. If this is not set to the project that you wish to run, click Browse... to choose the correct one.
- Choose a C/C++ Application: value by manually typing the app_name with path hierarchy into the field, using the Search Project... dialog to search the current project, or manually browsing for the application using the Browse... button.
- Choose a Remote Absolute File Path for C/C++ Application: value. Note that this location must be writable on the target board. EMAC recommends using the
/tmpdirectory for initial application testing, as this location is linked to a ramdisk and avoids unnecessary writes to the flash. Type the desired location in the provided text field, or select Browse... to search the remote filesystem for the target binary. Note that this step requires that the Connection: field is set to a valid connection and the development machine is connected to the target board.
- For instructions relating to the Arguments tab, refer to Figure 2 below.
If app_name takes any command-line arguments, they must be entered on the arguments tab. To avoid having to come back to this screen each time the arguments change, it is possible to use special Eclipse variables to specify the arguments, as described below:
- Click Variables... to open the Select Variable dialog.
- Choose a variable either by searching for it using the search input field at the top of the dialog or scrolling manually through the available variables.
- Click Edit Variables... to create a new variable or edit a user-modifiable variable.
- Many of the default variables have values that change depending on the arguments given in the Select Variable dialog. Some, such as those whose values are expected to be locations in the filesystem, can be configured with an additional dialog. To do so, click Configure....
Running the Remote Application
Using the Eclipse Run Menu to run a remote application can be done from the RSE, C/C++, Qt C++, or Debug perspectives. To run the application using the configuration created in the instructions above, follow the steps below:
- Open Eclipse to the RSE, C/C++, Qt C++, or Debug perspective.
- Click Run → Run Configuration....
- Double-click the launcher configuration created in the instructions above.
The application will be uploaded to the target board and executed. All program output will be displayed in the Console view in Eclipse.
The remote application debugging process is very similar to the remote Run configuration. Continue with the Eclipse Remote Debugging guide.