How to do it...

We can now configure the Eclipse SDK plugin using the standalone toolchain as described before, or we could decide to use the Build system derived toolchain instead:

Yocto Project SDK standalone configuration for Wandboard

Follow the next steps to build and run an example hello world application:

  1. Create a new hello world GTK autotools project. Accept all the defaults in the Project creation wizard. Browse to File | New | C/C++ Project | C Managed Build | Yocto Project SDK Autotools Project | Hello World GTK C Autotools Project:
New C Project window
When choosing a name for your project, avoid using special characters like dashes or spaces, as they could cause problems with the build tools.

Build the project by going to Project | Build Project.

The Yocto Project 2.4 release has updated the GTK+ libraries to 3.0. If you encounter the following error while building:
configure: error: Package requirements (glib-2.0 gtk+-2.0) were not met
You will need to modify the configure.ac script in your project to use GTK+3.0 as follows:
- PKG_CHECK_MODULES(helloworld, glib-2.0 gtk+-2.0)
+ PKG_CHECK_MODULES(helloworld, glib-2.0 gtk+-3.0)
Then, reconfigure the project by right-clicking on the project name and choosing the Invoke Autotools | Invoke Autoconf menu option, followed by Reconfigure Project and Build Project.
Eclipse displaying symbol resolution errors
  1. Even though the project builds successfully, you may see errors both marked in the source and in the Problems tab. This is because Eclipse's code analysis feature cannot resolve all the project's symbols. To resolve it, add the needed include header files to your project's properties by going to Project | Properties | C/C++ General | Paths and Symbols | Includes:
Paths and Symbols configuration window with the new filesystem paths added
If the index is not automatically rebuilt, you can trigger it with Project | C/C++ Index | Rebuild.
  1. We will now create a new connection to the target. Click on the New Connection menu on the top bar and choose Generic Connection:
New Connection window
  1. In the next window, press the Browse button to the right of the Connection Name field. This will autodetect the TCF target running on the device and list it along with its IP address as in the next screenshot:
Autodetected TCF agent on the 192.168.1.15 Wandboard device
  1. Under Run | Run Configurations, you should have C/C++ Remote Application with a target called <project_name>_gdb_arm-poky-linux-gnueabi. If you don't, create one:
C/C++ Remote Application run configuration window
  1. At the bottom of the window, click on Select other to select one of the multiple launchers available:
    • Remote Launching via TCF/TE Launcher
    • Legacy Remote Create Process Launcher

The first will use the TCF connection previously configured, but the second one, which will use an SSH connection to the target can also be used.

  1. To configure an SSH connection, click on the New button to the right of the Connection drop-down menu.
If you have problems logging into the device and you have built a target image using the debug-tweaks feature for password-less logins, try setting a root password and using it as the tool may not be able to log in with an empty password.
  1. Locate the C/C++ application to launch by clicking on the Search Project button.
  2. Next, modify the Remote Absolute File Path for C/C++ Application to an existing remote path on the target device, for example /gtk_hello_world.
  3. In the Commands to execute before application field, enter the following:

export DISPLAY=:0

At the time of writing, the TCF launcher did not allow us to add a command to execute before launching the application, failing instead with the following error:
Failed to create script with the Commands before launch in '/home/alex/workspace/.metadata/.plugins/org.eclipse.tcf.te.tcf.launch.cdt/prerun_commands_scripts/00-03-59-716_gtk_hello_world.sh'. Possibly caused by: Failed to read the Commands before launch script template 'null'.
The TCF launcher patch that fixes it has not yet made it to the Oxygen update channel:
http://git.eclipse.org/c/gerrit/tcf/org.eclipse.tcf.git/commit/?h=1.4_neon_bugfix&id=c54f26b7e07319b7ad309aab8c02b72be6d1afff
As a workaround, the DISPLAY variable can be added to the Environment tab instead.
  1. Run the application and, if you are using SSH, log in as root with an empty password. You should see the GTK application on your SATO desktop and the following output in the Console tab:
Console output showing the remote application being executed
If you have problems connecting to the target, verify that it is running tcf-agent by typing in the following on the target's console:
# ps w | grep tcf
735 root    11428S    /usr/sbin/tcf-agent -d -L- -l0

If you have login problems, you can use Eclipse's Remote System Explorer (RSE) perspective to clear passwords and debug the connection to the target. Once the connection can be established and you are able to browse the target's filesystem through RSE, you can come back to the run configuration.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset