Now whenever you create a connection or a filter pool you have a choice of which profile to put it in.
6.2.4 Debugging With a Remote Connection
With a remote connection established, we’ll use the record_sort project to illustrate how to set up a remote debug configuration. Initially, you have to copy the application executable, record_sort
, to a location on the remote target. My Home seems like a good place. The main reason for doing this is so you can change the permissions to make the file executable. Eclipse will, in fact, download the executable to the target when you click Debug, but if the file doesn’t already exist, oddly enough it won’t be created with execute permission. While you’re at it, copy datafile
to the target as well.
Now go back to the C/C++ perspective and open the Debug Configurations dialog for the record_sort project. You’ll find a new configuration type called C/C++ Remote Application. Create a new configuration of this type.
In the Connection drop-down, select your remote connection. Then click Search Project… next to C/C++ Application and select the Debug binary just as you would for a local debug configuration. Now click Browse next to Remote Absolute File Path for C/C++. This brings up a dialog (Figure 6.11) that lets you specify where the application executable will be downloaded on the remote machine. Expand My Home and select the record_sort
executable that you just downloaded.
Figure 6.11: Select remote file location.
The Main tab of Debug Configurations now resembles Figure 6.12. Add “datafile” in the Arguments tab. Take a look at the Debugger tab and note that the only choice for Debugger is remote gdb/mi. Also note under Gdbserver Settings, that the default port number is 2345.
Figure 6.12: Remote debug configuration.
Click Apply and then Debug. Eclipse invokes make all, which may have nothing to do, downloads the executable to the target, starts gdbserver on the target, and switches to the Debug perspective. You’re now debugging on the remote target without having to manually start gdbserver.
6.3 Native Application Builder (NAB)
The goal of the Native Application Builder (NAB) is to enable you to develop platform-independent graphical applications in an intuitive and graphical manner. Conceptually, this is similar to SWT and JFace, except that NAB is written in C++ and is oriented toward developing C++ applications.
NAB makes use of run-time libraries from WideStudio/MWT, an open source project based in Japan. The MWT stands for Multi-platform Widget Toolkit. WideStudio/MWT is described as an “Integrated Development Environment for desktop applications.” Nevertheless, the intention is that applications developed with WideStudio should be able to run on a wide range of embedded platforms simply by recompiling and relinking with the appropriate library. In addition to C/C++, WideStudio supports Java, Perl, Ruby, Python, and Objective Caml (OCaml).
6.3.1 Getting and Installing NAB
There are actually three elements to NAB:
1. The NAB Eclipse plug-in itself
2. WideStudio
3. JDK, the Java 2 software development kit
These elements need to be installed in the reverse order that they’re listed above. That is, JDK should be installed first. Go to http://www.java.sun.com/javase/downloads/index.jsp and click Download for JDK 6 Update 7 (or whatever is the latest update at the time). On the next page select Linux as your platform (unless you’re running Eclipse under Windows), agree to the Java SE Development Kit 6 License Agreement, and click Continue. You are then presented with a choice of downloading a self-extracting binary or a self-extracting RPM. I chose the binary.
Move the resulting .bin
file to the directory where you want to install it. I chose /usr/local/
. Then execute it. The binary code license is displayed, and you are prompted to agree to its terms. The JDK files are installed in a directory called jdk1.6.0_<version>
in the current directory.
The DSDP-NAB project downloads page has a link to the WideStudio MWT libraries package, which happens to be hosted at http://www.sourceforge.net/.
Download the file, and then follow these instructions to install it:
1. Copy the *.tar.gz
file to the directory where you want to build it.
2. cd
to that directory.
3. cd ws-v3.97-12/src
4. ./configure
5. make runtime
6. export JAVA_HOME=JDK_install_directory
7. make mwt_java
8. su
9. make install
10. Add /usr/local/lib
to the LD_LIBRARY_PATH
environment variable.
11. Add /usr/local/ws/bin
[7] to your PATH
Step 6 is necessary if, like me, you have an older version of the JDK lurking in the default location.
The final step is installing NAB, which doesn’t show up in any of the current software update sites, so you would expect to install it “manually.” This is what the DSDP-NAB download page describes. Unfortunately, it doesn’t work. There are apparently some undocumented dependencies in the NAB plug-in.
A plea for help on the DSDP-NAB newsgroup finally yielded a response that included the link to an NAB update site:
http://download.eclipse.org/dsdp/nab/updates/
Add this to your list of update sites and expand it. You’ll find three entries:
• NAB/MWT for Linux GTK
• NAB/MWT for Win32
• Uncategorized, which expands to:
○ NAB/MWT Plug-in
Select the third item and one of the first two depending on your host platform.
Note: It seems that many, if not most, of the mature Eclipse projects have established update sites, although it’s not always apparent. It may take some serious digging around and asking questions on the relevant newsgroup. As a last resort, see if the following link exists:
http://download.eclipse.org/<project_name>/<sub_project>/updates/
where <project_name>
is the name of the project you’re trying to install and <sub_project>
is an optional sub-project name.
6.3.2 An NAB Project
After adding the NAB components, you’ll find a new perspective called NAB/MWT that initially looks something like Figure 6.13. The NAB/MWT perspective introduces several new views. You may want to expand Eclipse to full screen in order to see more detail.
Figure 6.13: Initial NAB/MWT perspective.
Proceeding from left to right, the views are:
• C/C++ Projects: This is virtually identical to the Project Explorer view in the C/C++ perspective. Underneath it are …
• NAB/MWT Tree: Shows the current project’s application windows and their elements, or instances, in tree form.
• NAB/MWT List: For each instance in the Tree view, this view shows the child instances. Moving to the right …
• NAB/MWT Editor: Enables you to visually lay out screen images, known as application windows. Multiple windows are identified by tabs across the top.
7
Regardless of where you chose to build the package, the MWT runtimes get installed in /usr/local
by default.