Eclipse

From eLinux.org
Jump to: navigation, search

Eclipse is a integrated development environment (IDE) which consists of a "plug-in framework" written in Java. See the Eclipse wikipedia entry.

Many embedded Linux vendors ship tools based on Eclipse, including TimeSys, MontaVista, Wind River Systems and LynuxWorks. Android uses Eclipse as it's main application development environment, and the Yocto Project also includes Eclipse support.

Eclipse started as an IDE for writing Java programs, but has been extended to support numerous other languages, and development activities.

Eclipse basics

Plugins/Projects

All real functionality in Eclipse is provided via plugins (themselves written Java). That is, Eclipse itself is really just a plugin framework.

Eclipse is primarily geared to support Java development. On Fedora 12, the default Eclipse installation has support for writing Java programs, but not C. Support for developing in other languages, or in performing other development activities (e.g. launching other tools), is provided by plugins.

The following plugin project may be relevant for embedded Linux developers:

  • JDT = Java Development tools - for Java development (usually included with a default Eclipse installation)
  • CDT = C/C++ Development tools - for C and C++ development
  • linuxtools = additional Linux-specific tools (like valgrind, lttng, oprofile, etc.)
    • This is a superset of CDT
  • PDE = Plugin development environment
  • PyDev = python development IDE
  • Target Management/Remote System Explorer (TM/RSE)
    • Is used to discover and manage targets
    • It can use ssh on the host and sshd on the target, to view and transfer files, and to execute commands on the target.
    • It has the ability to launch shells and "terminals. Shells allow you to run individual commands on a target, and see their output. A terminal provides an interactive shell.

I downloaded RSE as part of the Yocto ADT, and found it easy to view files on a target that was running sshd.

    • Is used by Wind River for their embedded Linux IDE product

Eclipse and Yocto

Yocto has an eclipse

  • Yocto uses CDT remote launch, org.eclipse.cdt.launch.remote and TCF file/shells to transfer binaries and launch applications
    • CDT = (C Development Toolkit)
    • See: http://www.yoctoproject.org/projects/eclipse-ide-plug
    • supports communication with emulator or real device, via Yocto Eclipse TCF
    • emulated devices use NFS rootfs so host and target access same filesystem
    • debugging is via cross-gdb (gdbserver and gdb client on host)

The Yocto plug-in provides the following tools:

  • OProfile: Selecting this tool causes the oprofile-server to be launched on the remote machine. The oprofile-viewer must be installed on the local host machine and the oprofile-server must be installed on the remote target, respectively, in order to use. You can locate both the viewer and server from http://git.yoctoproject.org/cgit/cgit.cgi/oprofileui/. You need to compile and install the oprofile-viewer from the source code on your local host machine. The oprofile-server is installed by default in the image.
  • Lttng-ust: Selecting this tool runs "usttrace" on the remote target, transfers the output data back to the local host machine and uses "lttv-gui" to graphically display the output. The "lttv-gui" must be installed on the local host machine to use this tool. For information on how to use "lttng" to trace an application, see http://lttng.org/files/ust/manual/ust.html
  • PowerTOP: Selecting this tool runs "PowerTOP" on the remote target machine and displays the results in a new view called "powertop".
  • LatencyTOP and Perf: "LatencyTOP" identifies system latency, while "perf" monitors the system's performance counter registers. Selecting either of these tools causes an RSE terminal view to appear from which you can run the tools. Both tools refresh the entire screen to display results while they run.

Eclipse and Android

Eclipse is the main application development environment for Android.

To develop programs for Android, a developer installs a Java development kit (JDK), Eclipse itself, and the Android Platform Tools, which is an SDK with class libraries and target management tools (like fastboot and adb). Finally, the developer installs the Android Development Tools (ADT), which has plugins and add-ons for Eclipse.

  • Android Development Tools
    • Android Development Tools is installed as a plugin to Eclipse (using eclipse software manager)
  • Android SDK and AVD manager
    • window to control Android SDK component installs
      • can install or uninstall SDK parts (including different API class libs, examples, and tools)
    • windows to control AVD (QEMU sessions)
      • AVD = Android Virtual Device
      • AVD manager can:
        • define sessions
        • start sessions
      • A different window/dialog is used for selecting a target for deployment and debug
  • Underneath everything are command line tools
    • sometimes you have to use command line adb to "repair" something (uninstall an app on the target)
  • DDMS = Set of windows to show process information from Android
    • DDMS can also be run as a stand-alone application
      • This shows some system-wide information that the Eclipse version does not

Android development install process overview

  • install JDK
  • install eclipse
    • install JDT (inside eclipse, using the "install software" option)
  • install Android SDK
    • install platforms and platform tools (using Android SDK manager)
  • install ADT (using eclipse "install software" option)
    • configure ADT with path to Android SDK
  • can then create Android projects
    • select platform (library and class) version
    • can debug on target or on qemu
  • can also run DDMS
    • view more target-specific info
  • can run Android SDK and AVD manager
    • to create new AVDs or launch them, or to install/uninstall platforms (libraries and classes)

Android eclipse plugins

  • Source code for the Eclipse plugins for Android is in: <aosp_root>/sdk/eclipse/plugins
    • The following plugins are available:
      • com.android.ide.eclipse.adt
      • com.android.ide.eclipse.hierarchyviewer
      • com.android.ide.eclipse.tests
      • com.android.ide.eclipse.ddms
      • com.android.ide.eclipse.pdt
      • com.android.ide.eclipse.traceview


Usage examples and tutorials (relevant to Embedded Linux)

Cross-compiling and debugging your embedded Linux application within Eclipse

CrossCompileInEclipse describes how to build and debug an embedded Linux application within Eclipse.

BeagleBoard and Eclipse, with JTAG

BeagleBoard Eclipse describes how to install and use Eclipse with BeagleBoard, focused on JTAG debugging.

Using Eclipse with the Linux kernel

Eclipse is commonly used to develop user-space applications and programs, but it is also possible to use the IDE to work on the Linux kernel.

See http://wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source

For cross-compilation tips, see: http://kloggsays.blogspot.com/2011/06/kernel-development-using-eclipse-omap4.html

Tips/Tricks

  • With CDT, the resource scanner can get into cycles with symbolic links of folders. You must set up a resource filter ignoring these links to prevent the memory leaks that result.

Miscellaneous Notes

  • Eclipse is a derivative of VisualAge by IBM (which was originally a smalltalk IDE)
  • Eclipse uses SWT graphics and windowing (not AWT or SWING)
    • AWT is too native, SWING is too non-native
    • SWT is supposed to be "just right" tradeoff between performance and look and feel.
  • can get Vim-like keybindings with vwrapper - http://vrapper.sourceforge.net/home/

Useful Links

ELC Europe 2012 presentation "Eclipse and Embedded Linux Developers: What it Can and Cannot Do For You" PDF