Doing embedded design with an Eclipse-based IDE -

Doing embedded design with an Eclipse-based IDE


(Editor's Note: In this Product How-To design article, John Carbone of Express Logic explains why his company shifted from a proprietary Integrated Development Environment to an open source one based on Eclipse, and takes you step-by-step through how to use the company' s new Ecipse-based BenchX Integrated Development Environment to do embedded systems design.)

The open-source Eclipse movement has become a major factor in the software industry largely because it offers developers a free comprehensive Integrated Development Environment (IDE) and the ability to take advantage of a large number of free or inexpensive add-in productivity tools.

Thanks to the broad provisions of the Eclipse framework, it is possible to create an optimized-for-embedded Eclipse IDE at a price point in line with the open-source philosophy.

By combining Eclipse, the GNU C/C++ toolchain, and a host-target debug probe in a complete, integrated, and commercially supported package, Express Logic has delivered BenchX, an enhanced, embedded-optimized, Eclipse-based IDE, which can be licensed for only $1,000 per developer seat.

As shown in Figure 1 below, this IDE combines an embedded optimized Eclipse IDE, GNU C/C++ compiler and toolchain, and a host-target debug probe in a complete, integrated, and commercially supported package.

Figure 1. Combining Eclipse with GNU and a host debug probe

To simplify the multiple perspectives found in Eclipse/CDT, a single “Embedded Perspective” provides all the necessary view windows relevant to embedded system development. This greatly reduces the complexity of using Eclipse for embedded systems.

The BenchX Perspective
The BenchX perspective provides access to all the views and tools necessary to create, edit, assemble, compile, link, locate, execute, and debug an embedded application. Figure 2 below shows the BenchX Embedded Perspective.

Figure 2. Eclipse for the Bemch X perspective

In this example, the Eclipse build process has been simplified to reflect the requirements of embedded development and the preferences of embedded developers. Many build buttons, menus, dialogs and other options that are not used in embedded development have been eliminated, deactivated (“grayed-out”), or relegated to lower-level menus to keep them from complicating the more typical use modes of an embedded IDE.

Also, the Eclipse debugger interface has been modified to make it more suitable for embedded development, where a remote target connection will normally be made when debugging a program under development. Figure 3 below shows the debugger in action.

Figure 3. The Eclipse debugger in action

Express Logic also modified the Eclipse debugger GUI to remove menus, buttons, and options not used in embedded development. The resulting user experience is similar to that of a proprietary IDE designed from the ground up for embedded use.

In addition to modifying the debugger GUI, the BenchX tools include a capability critical for embedded development ” RTOS kernel awareness. With no real counterpart in the enterprise world, it's not surprising that Eclipse does not have the ability to assist the developer in viewing RTOS kernel objects of interest.

Embedded development, in contrast to enterprise work, requires the developer to frequently monitor the status of RTOS kernel objects such as threads, semaphores, and queues, to see how the application is using them and whether that use is as intended.

Even with the many changes made to make it more suitable for embedded development, because it still adheres strictly to the Eclipse interface standards, this IDE may be enhanced through the addition of Eclipse plug-in tools components such as compilers, text editors, and static analysis tools.

Users can take full advantage of the over one-thousand Eclipse plug-ins available to improve development productivity (Go to Eclipse Plugin Central for a complete list of available plug-ins). As a result, BenchX provides a simple yet fully modular foundation that is open for upgrade and expansion thanks to its Eclipse heritage.

Building and Debugging an Embedded App
With an understanding of its Eclipse origins and the embedded extensions that have been added, let's look at how a developer would use an embedded-enhanced Eclipse-based IDE such as BenchX to put together a simple application program.

Users initially will use the Workspace Launcher dialog. An Eclipse “workspace” is simply a subdirectory that contains the files related to a number of projects. The “hello_world.c” file is selected and its contents are displayed in the “hello_world.c” source code window, which is where all editing of the source code takes place.

At this point, the Simple_Hello_World workspace is open and ready for a program to be built. In the BenchX Perspective, this is accomplished simply by selecting the “Build Project” button as shown in Figure 4 below.

Figure 4. Starting a project

Selecting the “Build Project” button causes the assembly and C files that are part of the “hello_world_demo” project to be built. Default compiler and linker settings will be used, unless the developer selects custom settings prior to the build.

This one-click project build is common in embedded development and is repeated after each iteration involving a coding change to the program. Thus, it's important to make it as simple as possible with a single click.

At this point, the standard hello world demonstration is built and an executable file is created, ready to be run and debugged.

Running and Debugging Executable Images
To execute a program, it must be connected to a target. The target connection specifies where the executable image is to be downloaded, executed and debugged.

There are principally two types of target connections: simulator and hardware probe. A “simulator” connection is used for the execution and debug of an image on a host-based software simulator. A “hardware probe” connection facilitates execution and debug of an executable image on a board that is connected through the specified JTAG probe.

BenchX incorporates a hardware debug probe and enables selection of this option. Ultimately, embedded applications must be downloaded to and run on a target, although a simulator often is used for initial debugging activities. Once the debug probe is added to Eclipse, both execution environment options are available for the developer.

Figure 5 below shows the selection of “QEMU Platform Simulator” (a platform simulator that is part of the GNU toolchain) and corresponding options. Alternatively, a user might select the “Macraigor usbWiggler” (a hardware debug probe included with BenchX) and its corresponding options. For most connections, there are a set of standard Debug Options in the lower portion of the dialog, including:

– Platform Initialization Script
– Connect Only
– Load Program Symbols Only
– Verify Downloaded Image
– Stop in “main”

Figure 5.Selecting the platform simulator Breakpoints

The “Platform Initialization Script” option selects the file that is used by the probe to prepare a given target for program download and execution. The “Connect Only” option is used for initial board bring-up, prior to actually trying to run any application code.

“Load Program Symbols Only” is useful for debugging flash-based programs with hardware breakpoints. “Verify Downloaded Image” reads back the image downloaded to make sure the download was successful.

Finally, the “Stop in main” option results in an automatic breakpoint to be inserted in the “main” C function of the program. This allows the developer to setup other breakpoints prior to executing.

With BenchX, a breakpoint automatically is placed in “main” if the “Stop in main” option is selected under the “Debugger” tab. Additional breakpoints can be set and cleared by double-clicking on the left margin of the source window.

When the program hits the breakpoint it is halted and all the pertinent register and data views are updated. Figure 6 below shows the setting of a breakpoint at “thread_0_counter++” in the demo program.

Figure 6. Setting a breakpoint

Viewing Program Elements
Once a program hits a breakpoint, capabilities exist for viewing into the target program, including views of source, disassembly, local/global variables, registers, memory, and RTOS kernel objects.

Viewing variables is accomplished by select the “Variables” tab in the view window located in the upper-right of the BenchX perspective. When “Variables” is selected, the local variables and their contents are displayed by default. Note that variables whose value has changed are shown in red, as shown in Figure 7 below.

Figure 7. Chosing and changing variables

Register Viewing. The target processor registers are also available for viewing, with changes in the register values during program execution also are displayed in red.

ThreadX Awareness
While Eclipse includes no support for an RTOS, embedded developers typically use an RTOS and require kernel awareness support. This means that users can easily view RTOS kernel objects within their embedded applications in the debugger window, and obtain detailed information about each of the kernel resources used in the target application.

Users are provided with access to a rich number of RTOS kernel objects including threads, semaphores, mutexes, queues, timers, block and byte memory pools, and event flag groups. The IDE can also be used to develop embedded systems using no RTOS at all.

With BenchX, all information related to the execution of an application using ThreadX is readily available. ThreadX objects are selected via visible tabs in the “right-hand-middle” view window, or via the “Fast View” button in the lower left hand corner of the perspective, as shown in Figure 8 below.

Figure 8. Using “Fast view” to select objects

Thread Viewing. The “Threads” view provides an overview of all threads in the ThreadX application. The overview includes each thread's scheduled count, priority, preemption-threshold, time-slice, and current state. Figure 9 below shows an example “Threads” view.

Figure 9. An overview of all threads

BenchX supports development of applications based on the ARM, ColdFire, PowerPC, and MIPS architectures. For each supported platform and architecture, BenchX includes the full GNU C/C++ cross-compilation toolchain, simulator and libraries, which are hosted to run native on Windows without Cygwin (a Windows hosted, Unix emulation environment commonly needed to run GNU). The BenchX source-level debugger is integrated with the Macraigor JTAG usbWiggler for all supported architectures.

Eclipse provides an excellent basis for an IDE that is well suited to embedded developers. When integrated with a hardware debug probe, as has been done in BenchX, Eclipse can offer a powerful, expandable development platform for embedded systems.

John A. Carbone, vice president of marketing for Express Logic, has 35 years experience in real-time computer systems and software, ranging from embedded system developer and FAE to vice president of sales and marketing. Prior to joining Express Logic, Mr. Carbone was vice president of marketing for Green Hills Software. Mr. Carbone has a BS degree in mathematics from Boston College.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.