|
IntroductionSTWorkbench is an Eclipse-based IDE, shipped with the STLinux distribution, that provides support for developing and debugging STLinux applications. One common fallacy about STWorkbench is that users are forced to convert their applications to its own build system ("Managed Make") to use it. In fact, it can very easily be used to drive an existing make system. This document describes the steps required to import an existing software tree into an STWorkbench project, build it, and debug it. STWorkbench conceptsFor new users of Eclipse/STWorkbench, some aspects of its rather idiosyncratic interface can be a little confusing. Here, we define some of the key concepts needed to navigate an Eclipse-based workbench. On startup, a directory is chosen for the workspace. Projects can either be copied into that directory, or developed in their original location. In either case, they will be displayed in the C/C++ Projects view, which is the main interface to the workspace. Note: Workspaces are handled on a per-user basis and do not need to be archived under source control. Note: The Eclipse/STWorkbench ClearCase plug-ins map one workspace to each ClearCase view. A project consists of a standard source tree, to which STWorkbench adds two additional files in the top level: .project and .cdtproject.Perspectives allow a set of related views to be opened and closed together. For example, there is one perspective for C/C++ development and another for debugging. Once a launch configuration is created to run an application, it can also be used to debug the application. Importing an existing application
To work on an application in STWorkbench, it has to be imported into a project in the
workspace. The easiest way to do this is wrap a project around the existing application
tree. The effect of this is to write two dotfiles ( There are several different project types. For a C/C++ project with an existing make system, the correct project type to use is Standard Make C Project. Steps to wrap a Standard Make C Project around your existing application: 1) Start STWorkbench, specifying a workspace directory in your home area. The location is unimportant - once the dotfiles have been created, a project can be imported into any workspace.2) Select File -> New -> Project. Select Standard Make C Project in the C category and click Next. 3) Give the project a meaningful name. 4) To leave the source tree in it's original location, uncheck Project contents and enter the location of the tree in the Directory field. Click Next. The C/Make Project Settings page is opened.
5) If required, edit the Make Builder tab. It contains the make commands to
be emitted when cleaning
and building the project. The defaults are to
6) In the Binary Parser tab, uncheck Elf Parser, and use ST Elf Parser
instead. This contains some enhancements for ELF files produced by ST toolsets.
7) In the Discovery options tab, change the Compiler invocation command to
8) In the C/C++ Indexer tab, choose an indexer. If the application is indexed then a much wider variety of features are available, for example navigating to function declarations. By default, no indexer is selected.
Note:
This is because the Full C/C++ Indexer currently
handles large applications very badly. Work to correct this is ongoing in the Eclipse
community. As a compromise, if you have 9) Click Finish. The project is created. Note: Any of the settings mentioned above can changed later in Project -> Properties. Building the application
When the project is built, STWorkbench invokes
To invoke more complex Running and debugging the applicationOnce an executable has been built in the project, it can be run and debugged.Note: Any executable that is enclosed in a project can be debugged - it is not necessary to develop and build it within STWorkbench. 1) To run the executable, select Run -> Run.... The Create, manage and run configurations dialog is displayed. The left hand pane gives a list of launch configuration types. 2) Highlight STLinux Target Application and click New . A launch configuration is created, which should be given a meaningful name. 3) In the Main tab, fill in the Project and C/C++ Application fields. 4) In the Debugger tab, fill in the Target name or IP address of a board that is currently running STLinux.
Important: It is a prerequisite of running and debugging applications that
the STLinux target board is booted, reachable on the network, and that the chosen
user (probably root) is able to log into the target via ssh (e.g.
5) Click Run . The executable will be copied to the target an executed. Its
stdout and stderr streams will be visible in an external Note: To run the application again, simply click the Run toolbar button. 6) To debug the application, click the Debug toolbar button. The launch configuration is reused. If prompted to move to the Debug perspective, do so. The controls to debug the application are very similar to those found in other GUIs. Breakpoints can be set by double-clicking the border of the source file, and the Debug view, which displays thread lists and callstacks, also contains the toolbar buttons to step, resume and terminate your application.
The Debug view also contains two entries for "consoles" (indicated by
an icon showing a PC tower and a green triangle). Clicking on either of them
will display it in the Console view. One is the console for your
application, giving you access to stdin, stdout and stderr. The other is the
console for Note: Since no "(gdb)" prompt is displayed, it is not always clear when gdb is accepting input - commands can only be entered when the application is suspended! Hopefully this is enough information to illustrate how STWorkbench can be used to develop and/or debug large existing applications. Much more information is available in the STWorkbench online help, including tutorials on building, developing and debugging STLinux kernel code.
|
|||||||||||||||||||||
|
||||||||||||||||||||||