Search by Tags

Application Debugging Over Ethernet Using Visual Studio

 
Applicable for

Compare with Revision




Subscribe for this article updates

The simplest setup to do application debugging is to connect your host PC to the Toradex module target by both a USB cable (ActiveSync) and Ethernet. However, there are situations where the USB client port is not available and only Ethernet can be used for debugging - as for example with Windows Embedded Compact 2013

This article describes how to setup the host PC and the target device for this purpose.

One Time Preparation

Lookup the IP Address of the Toradex Module

Images released after July 2017

Newer images show the IP address in a message box when the debug client gets started.

If you don't want this information been shown you can deactivate this in the registry by setting the following registry key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Toradex\Debugger]
"DisplayMode"          = "dword:1"    ;Default is 1. 1 = show message box, 0 = show IP on desktop.

Images released before July 2017

On the target device, either

  • double click on the Ethernet icon in the Windows CE system tray, or
  • open a command prompt and type
    ipconfig

In the default configuration, the target device is setup to get its IP address from a DHCP server. So the address can change after a reboot of the target.

Automatically launch debugger client

If you want to automatically launch the debugger client on booting the device, you can add it to the init section in the registry like this:

[HKEY_LOCAL_MACHINE\init]
"Launch98"="VSDebugger.exe"

This registry entry is already there in newer images but it is disabled by a "_" prefix.

Prepare Visual Studio 2008 (VS2008)

  • In VS2008, select the menu
    Tools -> Options ==> Device Tools ==> Devices
  • Select any existing device and press
    Save As...
  • Give the device a reasonable name, e.g.
    Colibri: Ethernet (10.0.1.73)
  • Optionally you can change the Default device to the new device.
  • Select the newly created device and press
    Properties
    to get to the next dialog.
  • Select Transport:
    TCP Connect Transport
    and press
    Configure
  • Select
    Use specific IP address
    and enter the target's IP address
  • Press OK three times to close all open dialogs.

Prepare Visual Studio 2013/2015 (VS2013/2015)

  • In VS2013/2015 debug settings are project-specific.
  • For native (C/C++) applications:
    • In Visual Studio select:
      Project -> Properties
    • Select:
      Configuration Properties -> Debugging
    • Insert the device's IP address and, if needed, any optional command line argument you need to pass to your application to test it
    • Please notice that if you don't set the IP address there Visual Studio 2013/2015 will prompt for an IP address the first time you'll try to run your application. In our experience this quite often leads to a unrenponsive instance of Visual Studio that should be closed from task manager. It's always better to configure the IP in advance for your projects.
  • For managed (C#/Visual Basic) applications:
    • In Visual Studio select:
      Project -> Properties
    • Select:
      Debug
    • Insert the device's IP address and, if needed, any optional command line argument you need to pass to your application to test it
  • If you want to deploy your applications permanently on the device choose a deployment path under \FlashDisk.

Not needed on standard image: Copy debug tools to target device

Note: Our most recent Windows Embedded Compact images (for Tegra, iMX6, iMX7 and Vybrid) have the debug tools already included, you find them under:
Start->Programs->Colibri Tools->Visual Studio Debugger
If you can't find this entry or you are building your own image, you have to copy them manually.

Visual Studio 2008

  • Locate the files. In a standard VS2008 installation, they are here:
  C:\Program Files\Common Files\microsoft shared\CoreCon\1.0\Target\wce400\armv4i
  or 
  C:\Program Files (x86)\Common Files\microsoft shared\CoreCon\1.0\Target\wce400\armv4i
  
  • On a USB flash drive or an SD card, create a folder \AutoCopy
  • Copy the following files into the AutoCopy folder
    • clientshutdown.exe
    • CMAccept.exe
    • ConmanClient2.exe
    • DeviceAgentTransport.dll
    • DeviceDMA.dll
    • eDbgTL.dll
    • TcpConnectionA.dll

Visual Studio 2013/2015

  • Locate the files. In a standard VS2013/2015 installation, they are here:
  %CommonProgramFiles(x86)%\Microsoft Shared\Embedded Tools\CoreCon\12.0\Target\wce800\armv7\
  or
  %CommonProgramFiles(x86)%\Microsoft Shared\Embedded Tools\CoreCon\14.0\Target\wce800\armv7\
  
  • On a USB flash drive or an SD card, create a folder \AutoCopy
  • Copy the following files into the AutoCopy folder
    • clientshutdown3.exe
    • CMAccept3.exe
    • ConmanClient3.exe
    • edbgTL3.dll
    • TcpConnectionA3.dll
    • DeviceAgentTransport3.dll

Using Two Ethernet Adapters

When more than one ethernet adapter is connected to the system, by default only the first (on-module) adapter is available as a debug interface.

The 2nd ethernet adapter can be enabled for debugging by adding a registry key.

The exact value of the multi-string ("AX88772B2","AX8877B1") depends on the module and ethernet adapters you use. The adapters are listed under [HKEY_LOCAL_MACHINE\Comm].

[HKEY_LOCAL_MACHINE\Comm\TCPIP\Linkage]
"Bind"=multi_sz:"AX88772B2","AX8877B1"     ; List all adapter instances

Process for every debug session

Start the debuging client on the target device

On toradex default images

Just click on the following start menu item:

Start->Programs->Colibri Tools->Visual Studio Debugger->Start debugger client

On Custom image or older images

If you don't find the Start debugger client on the target device you have to do this.

  • Insert the storage device you previously prepared into the target device and boot the module. The files will be copied to the target's root folder.

Visual Studio 2008

  • Through the Start menu, open a command prompt and type
    conmanclient2
    to start this service. The command prompt will remain blocked.
  • Through the Start menu, open a 2nd command prompt and type
    cmaccept
    to start this service.

Visual Studio 2013/2015

  • Through the Start menu, open a command prompt and type
    conmanclient3
    to start this service. The command prompt will remain blocked.
  • Through the Start menu, open a 2nd command prompt and type
    cmaccept3
    to start this service.

After you have started CMAccept, you have only 3 minutes to start the debug session on the Visual Studio side!

Start the Debug Session on VS2008

  • In VS2008, select the menu
    Tools -> Connect To Device...
  • Select the newly generated device and press Connect

VS2008 will start to communicate with the target device. Another dialog should appear and announce a successful connection.

Start the Debug Session on VS2013/VS2015

Debug session is started automatically when you choose to deploy or debug/run your application.
If you haven't set an IP for your target device, you'll have to insert it when prompted.
We discovered that inserting the IP on first execution/deployment often leads to a non-responsive Visual Studio 2013 instance.
It's better to configure your device's IP in advance as described in the instructions above.