As part of any software development project, we spend a lot more time and effort to correct and improve existing code than developing new code.  A development environment with efficient debug tool can help minimize the time and effort needed to resolve bugs and improve the code.

In part-8 of this getting started series, we will talk about the debugging tools available as part of the Compact 7 development environment and work through couple of examples, showing how to use Compact 7 remote tools to debug a KITL enabled OS image launched on a target device.

Note:

The Compact 7 getting started series consist of 9 different articles, to provide information about OS design, application development and related development tools.  When application, hands-on examples written in step-by-step format with graphic illustrations are provided.

For more information about this series, visit:

    http://embedded101.com/Compact7/  

Prerequisites:

To work through the exercises in this guide, we need to have the following:

·         Development PC with Visual Studio 2008 with SP1 and Windows Embedded Compact 7.

·         Successfully compiled a Compact 7 OS image and deploy the image to a target device.

Target Device:  eBox-3300MX

The exercise in this guide is created using an eBox-3300MX (eBox) as the target device.  Refer to the following URL for more information about the eBox:

http://www.embeddedpc.net/eBox3300MX/

Alternative Target Device:  Virtual PC

Using a Virtual PC as target device, we can work through the same exercise in this guide.  To do so, an OS runtime image generated from the OS design created using the Virtual PC board support package (BSP) is needed.

To work through the sample exercises using Virtual PC as the target device, refer to part-3a of this series, Develop OS Design for Virtual PC, for more information about developing an OS design and downloading OS runtime image to a Virtual PC target device.

 

Compact 7 Debugging Environment

Within a Compact 7 project, there are different debugging environment for different development stages, where each of these stages may require different connectivity and tools for debugging, such as:

·         Application development.

·         Bootloader development.

·         Device driver development.

·         OS design development.

Debugging Application

In part-4 of this series, Managed code application for Compact 7, we talked about CoreCon and work through an example, showing the steps to develop a managed code application, download the application to the target device and debug the application as the code execute on the target device.  Refer to this application note for information about debugging application.

Debugging Bootloader and Device Driver

Bootloader and device driver development are advanced subject and is not within the scope for this getting started series to cover.

Debugging OS Design

To debug Compact 7 OS runtime on a target device, you can use Target control and the following remote tools, provided as part of the Compact 7 software:

·         Remote File Viewer

·         Remote Process Viewer

·         Remote Profiler

·         Remote Registry Editor

·         Remote Resource Consumer

·         Remote Resource Leak Detector

·         Remote System Information

·         Remote Zoom

·         Remote Timeline Viewer

·         Remote Kernel Tracker

·         Remote Performance Monitor

·         Remote Power Monitor

 

KITL Enabled OS Image to Support Remote Tools

KITL, short for Kernel Independent Transport Layer, is used to establish connectivity between the VS2008 development workstation and the target device to support remote tools.

In order to use and establish KITL connectivity, network driver for the target device must include KITL support. A quality Compact 7 board support package (BSP) should include KITL support. For more information about KITL, refer to the following URL:

    http://msdn.microsoft.com/en-us/library/ee479323.aspx

Using the existing OS design project from part-3 of this series, Develop a Compact 7 OS Design, we will go through the following steps to configure the OS design and build a KITL enabled OS image to support the remote tools:

Note:

If you don’t have access to an eBox, you can use the OS design project from part-3a of this series, using Virtual PC as the target device.

http://www.embedded101.com/Blogs/SamuelPhung/tabid/72/entryid/245/Compact-7-Getting-Started-Part-3a-Develop-OS-Design-for-Virtual-PC.aspx

1.      Launch the OS design project, MyCompact7 (eBox as target device) or MyVPC (Virtual PC as target device), using Visual Studio 2008.

2.      From VS2008 menu, select ViewàSolution Explorer to bring focus to the Solution Explorer window.

3.      From the Solution explorer window, right mouse click on the OS design project node, MyCompact7 (eBox as target device) or MyVPC (Virtual PC as target device), and click on Properties, as shown in Figure-1, to bring up the MyCompact7 Property Pages screen.

Fig-1a

Figure – 1

4.      From the left pane on the MyCompact7 Property Pages screen, expand the Configuration Properties node and select Build Options.

5.      From the right pane, double click Enable KITL to enable this build option, as shown in Figure-2.

Fig-2a

Figure - 2

6.      From MyCompact7 Property Pages screen, click Apply follow by OK to save and close the screen.

7.      From VS2008 IDE, click on Catalog Items View tab to bring focus to the Catalog Items View window.

8.      From the Catalog Items View window, expand the \Third Party\Embedded101\ folder, uncheck the AutoLaunch_v300_Compact7 component and associated sub-components, as shown in Figure-3.

Fig-3

Figure – 3

Note:

The AutoLaunch and AutoLaunch-CoreCon components were added to the OS design in the earlier application notes, to support application development.  The AutoLaunch-CoreCon component is in conflict with the KITL connectivity, needed to support the remote tools.

9.      From VS2008 menu, select BuildàBuild Solution to build and generate an OS image.

10.   Download the OS image to the target device.

Note:

For information about downloading OS image to the target device, refer to the following post:

http://www.embedded101.com/Blogs/SamuelPhung/tabid/72/entryid/205/Connectivity-to-Download-Compact-7-OS-Runtime-Image-to-Target-Device.aspx

 

Using Compact 7 Remote Tools

Using the KITL enabled OS image (downloaded to the target device) from the previous section, work through the following steps to use the Remote Registry Editor to view and edit the target device’s registry settings:

1.      From VS2008 menu, select ToolsàRemote ToolsàRegistry Editor to bring up the Remote Tools Shell, with a Connecting to device screen, attempting to establish connection to the target device, as shown in Figure-4:

Fig-4a

Figure - 4

2.      After connection is established, the Remote Tools Shell is shown with the Registry Editor, as shown in Figure-5.

Fig-5a

Figure - 5

3.      From the above Remote Tools Shell, we can view and edit the target device’s registry settings remotely from the development workstation.

Using the same steps as above, we can launch the other remote tools. 

Some of the remote tools involve additional steps and requires other resources to function as intended, refer to the following URL for more detail information about these remote tools:

http://msdn.microsoft.com/en-us/library/gg155831.aspx

 

Target Control Shell – Remote Command Console

While the Target Control shell is not categorized as one of the remote tools, this is a very useful tool to help debug OS image running on a target device.  Functioning like a remote command console, we perform debugging functions from the command prompt.

Using the KITL enabled OS image from the previous section (downloaded to the target device), work through the following Target Control exercise:

1.      If still active, terminate the remote tools shell.

2.      From the VS2008 menu, select TargetàTarget Control to bring up the Windows CE Command Prompt window (Target Control shell), as shown in Figure-6.

Fig-6

Figure - 6

3.      From the Target Control shell, enter the following command:

Windows CE>gi proc

4.      After pressing enter to execute the above command, the Target Control shell displays all of the processes currently running on the target device, as shown in Figure-7.

Fig-7a

Figure - 7

5.      From the Target Control shell, we can launch application on the target device remotely.  From the Target Control shell, enter the following command to launch the control panel:

Windows CE>s control.exe

6.      After pressing enter to execute the above command, the control panel will launch on the target device.

7.      From the Target Control shell, enter the “gi proc” command to display all processes currently running on the target device, as shown in Figure-8.

Fig-8a

Figure - 8

8.      From the Target Control shell, the control panel application, control.exe, is shown as process 10, “P10:  control.exe”.

9.      From the Target Control shell, enter the following command to terminate the control panel application.

Windows CE>kp 10

10.   After the pressing enter to execute the above command, the control panel terminates on the target device.  The Target Control shell display a message to indicate the attempt to terminate the “P10: control.exe” process is succeed, as shown in Figure-9.

Fig-9a

Figure - 9

The Target Control shell is a very useful tool, with many functions.  Refer to the following URL for more information:

http://msdn.microsoft.com/en-us/library/ee479807

 

Summary 

Efficient debugging tools can help streamline the process to identify software issues, help minimize development schedule, which directly contribute to cost saving for the overall project.  In addition to the efficient coding environment to support managed and native code development, the Windows Embedded Compact debugging tools are valuable cost-saving resources for the development team.