Difference between revisions of "Eclipse"

From eLinux.org
Jump to: navigation, search
(Eclipse and Android: move and fixup android install process section)
(Miscellaneous Notes)
 
(11 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
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,
 
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 include Eclipse support.
+
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 started as an IDE for writing Java programs, but has been extended to support numerous other languages, and development activities.
 
 
  
 
== Eclipse basics ==
 
== Eclipse basics ==
Line 14: Line 12:
 
is really just a plugin framework.
 
is really just a plugin framework.
  
Eclipse is primarily geared to support Java development.  On Fedora 12, the default eclipse install
+
Eclipse is primarily geared to support Java development.  On Fedora 12, the default Eclipse installation
has support for writing java programs, but not C.
+
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.
* JDT = Java Development tools - for Java development
+
 
 +
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)
 
* [http://www.eclipse.org/cdt/ CDT] = C/C++ Development tools - for C and C++ development
 
* [http://www.eclipse.org/cdt/ CDT] = C/C++ Development tools - for C and C++ development
 
* linuxtools = additional Linux-specific tools (like valgrind, lttng, oprofile, etc.)
 
* linuxtools = additional Linux-specific tools (like valgrind, lttng, oprofile, etc.)
** this is a superset of CDT
+
** This is a superset of CDT
* lttng - for performing tracing and analysis
 
** I haven't gotten this to work yet
 
 
* PDE = Plugin development environment
 
* PDE = Plugin development environment
 
** plugins to eclipse are written in java and use SWT
 
** plugins to eclipse are written in java and use SWT
 
** tutorial for "hello world" plugin is at: http://www.vogella.de/articles/EclipsePlugIn/article.html
 
** tutorial for "hello world" plugin is at: http://www.vogella.de/articles/EclipsePlugIn/article.html
 
* [http://marketplace.eclipse.org/content/pydev-python-ide-eclipse PyDev] = python development IDE
 
* [http://marketplace.eclipse.org/content/pydev-python-ide-eclipse PyDev] = python development IDE
* Target Management/Remote System Explorer (TM/RSE)
+
* [http://www.eclipse.org/tm/ Target Management]/Remote System Explorer (TM/RSE)
 
** Is used to discover and manage targets
 
** Is used to discover and manage targets
** see http://www.eclipse.org/tm/
+
** 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
 
** 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)
 +
 +
* required plugins: (see http://www.yoctoproject.org/docs/adt-manual/adt-manual.html section 4.1.2)
 +
** CDT 7.0
 +
** RSE 3.2 (Remote System Explorer)
 +
** Autotools
 +
** Yocto Plug-in
 +
 +
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 and Android ===
Line 70: Line 94:
 
* can run Android SDK and AVD manager
 
* can run Android SDK and AVD manager
 
** to create new AVDs or launch them, or to install/uninstall platforms (libraries and classes)
 
** 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) ==
 
== 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 ===
 
[[BeagleBoardEclipse|BeagleBoard Eclipse]] describes how to install and use Eclipse with BeagleBoard, focused on JTAG debugging.
 
[[BeagleBoardEclipse|BeagleBoard Eclipse]] describes how to install and use Eclipse with BeagleBoard, focused on JTAG debugging.
  
* Using eclipse with the Linux kernel: See http://wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source
+
=== Using Eclipse with the Linux kernel ===
** for corss-compilation tips, see: http://kloggsays.blogspot.com/2011/06/kernel-development-using-eclipse-omap4.html
+
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 ==
 
== Tips/Tricks ==
Line 87: Line 133:
 
* can get Vim-like keybindings with vwrapper - http://vrapper.sourceforge.net/home/
 
* 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" [[Media:EclipseForEmbeddedLinuxDevelopers-AnnaDushistova2012.pdf|PDF]]
=== Android debug/target control architecture ===
 
* DDMS
 
  * can view information from target (either qemu or device)
 
  * logcat
 
  * can read process thread info
 
  * can read process heap info
 
* Debug view
 
  * assume that underneath there is some handoff from adb to jdb (java debugger)
 
    * I assume this is done with port forwarding, but I'm not sure
 
      * adb support forwarding ports from host to target, including jdwp (java debug wire protocol) ports
 
      * I assume that once established, jdwp is direct from jdp to process on target, with no intervention by adb after initial handshake
 
      * Android applications (at least those from deployed from eclipse) all have jdwp threads, ready for debugger to attach to
 
 
 
 
 
* how is this related to target management/Remote System Explorer?
 
  * seems similar in architecture, but completely separate in implementation
 
 
 
==== Android eclipse plugins ====
 
* Source code for plugins 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
 
 
 
==== How the ADT plugins use adb ====
 
In sdk/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java:
 
 
 
the following import is found:
 
* import com.android.ddmlib.AndroidDebugBridge
 
and statements:
 
* AndroidDebugBridge bridge = AndroidDebugBridge.getBridge();
 
* bridge.restart()
 
* bridge.setSelectedClient()
 
 
 
In sdk/ddms/libs/ddmlib/src/com/android/ddmlib/AndroidDebugBridge.java:
 
checkAdbVersion creates a command consisting of mAdbOsLocation and "version", and uses Runtime.getRuntime().exec(command)
 
Then the code parses stdOut from the resulting process for the version information.
 
 
 
However, in: sdk/ddms/lib/ddmlib/src/com/android/ddmlib/AdbHelper.java:
 
there are lots of classes that talk directly to an adb server (using the adb command protocol), to accomplish things like
 
port forwarding, remote shell executing, etc.)
 
 
 
There are the following methods
 
* AdbHelper::executeRemoteCommand()
 
* AdbHelper::runEventLogService()
 
* AdbHelper::runLogService()
 
* AdbHelper::createForward()
 
* AdbHelper::removeForward()
 
* AdbHelper::reboot()
 
* AdbHelper::write()
 
* AdbHelper::read()
 
* AdbHelper::formAdbRequest()
 
* AdbHelper::readAdbResponse()
 
* AdbHelper::setDevice()
 
* AdbHelper::createPassTrhoughConnection()
 
 
 
 
 
In sdk/ddms/lib/ddmlib/src/com/android/ddmlib/Device.Java, there's a method executeShellCommand, which is used several places
 
in the ddmlib.
 
 
 
== 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)
 
 
 
* required plugins: (see http://www.yoctoproject.org/docs/adt-manual/adt-manual.html section 4.1.2)
 
  * CDT 7.0
 
  * RSE 3.2 (Remote System Explorer)
 
  * Autotools
 
  * Yocto Plug-in
 
 
 
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.
 
 
 
 
 
== Remote System Explorer ==
 
I downloaded RSE as part of the Yocto ADT, and found it easy to view files on a target that was running sshd.
 
Also, it was easy to configure and launch shells and "terminals".  Shells allow you run individual commands,
 
and see their output.  A terminal provides an interactive shell.
 
 
 
  
 
[[Category:Development Tools]]
 
[[Category:Development Tools]]

Latest revision as of 15:42, 22 February 2013

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