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

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.

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.

Locate the Target Files and Copy Them to the Target Device (not needed if you use standard image)

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

Repeat for Each Debug Session

Start the Debug Session on the Toradex Module

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

If you can't find this menu item you have to do this:

  • Insert the storage device 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.