free web page counters

Windows Mobile Pocket PC Smartphone Programming

==>Click here for the SiteMap<==. Original contents with decent amount of source codes.

Friday, April 21, 2006

Emulator Troubleshooting/Tip 01: To Cradle or Not to Cradle?

====>SiteMap of this Blog<===

Emulator Troubleshooting/Tip 01: To Cradle or Not to Cradle?

Firstly, a quick introduction to the emulators shipped with Visual Studio 2005 (VS2005, and/or Windows Mobile 5.0 SDK).

What is New in the emulators shipped with VS2005

The 2005 emulator runs applications compiled for the ARM instruction set (same as the physical device) and runs as a user-mode process. The emulators work much faster than the previous generations that deal with X86 instruction sets. Also the emulator loading and shutdown time reduce significantly.

The other big change is that VS2005 now provides a Direct Memory Access (DMA) transport to communicate with the emulator. Surpassing the traditional TCP/IP transport, the DMA transport is faster, does not rely on network connectivity or other external factors, and provides deterministic connection and disconnection.

Connect and Cradle Emulator

The centralized place to interact with the emulators is the Device Emulator Manager. To launch the Device Emulator using the Device Emulator Manager in VS2005:

  • On the Visual Studio Tools menu, click Device Emulator Manager.
  • In the Device Emulator Manager window, right-click the emulator you want to launch.
  • On the shortcut menu, click Connect.

The following screen cut show that Pocket PC 2003 SE Emulator is connected. Now VS2005 is able to deploy your program to the emulator and debug your program as well. The Remote Tools (like remote registry editor, remote spy, remote file explorer, and etc) can also work with the emulator. No, in such case, you do not need to establish an ActiveSync connection to use the remote tools.

Sometimes you may need to ActiveSync with an emulator, for example, you want to use the "Mobile Device" shell namespace in your desktop PC's explorer to access the emulator's file system, or you want to make the emulator use the host PC's network connection. The way to establish an ActiveSync connection changed significantly compared to the the previous development environment (Visual Studio 2003/VS2003, Embedded Visual C++ 4/EVC4, and Pocket PC 2003 SDK or Smartphone 2003 SDK).

  • Right click the already-connected emulator, then click Cradle in the popup menu.
  • Make sure ActiveSync is configured to allow DMA connections via its Connection Setting dialog's "Allow connections to one of the following" option.
  • ActiveSync should then start as the emulator makes a connection to your desktop computer.

The following screen cut shows that the Pocket PC 2003 SE emulator is ActiveSync'ed.

To Cradle or Not to Cradle

If an emulator is successfully cradled, VS2005 and Remote Tools can either treat the emulator as an Emulator, or as a Physical Device. For example, in above screen cuts, Pocket PC 2003 SE Emulator is ActiveSync'ed. Now in VS2005 or in Remote Tool's "Select a Windows CE Device" dialog, you can either choose the Emulator as is, or choose "Pocket PC 2003 Device". Either way, the emulator will be connected.

However, you'll see certain degree of performance penalty if the emulator is cradled, compared to a non-cradled emulator. As mentioned above, VS2005 and Remote Tools do not really need the emulator to be ActiveSync'ed. In case that the emulator is not cradled, DMA transport is used. As the named implies, VS2005 or Remote Tool is directly accessing the emulator process' memory, much faster and reliable. Using ActiveSync as the transport adds an unnecessary extra layer.

The other advantage to realize no-need-to-cradle-clarification is that you can connect a Remote Tool to multiple Emulators simultaneously. ActiveSync actually does not support connecting to multiple devices or emulators.

Wrap Up

"To Cradle or Not to Cradle" only applies to Emulators. For a physical device, you do need to cradle and ActiveSync it for VS2005 and Remote Tools to work. Reason is simple. There is no such thing like "DMA" in such a scenario, because the desktop PC and the pocket PC are living in two worlds.

====>SiteMap of this Blog<===