Targeting Windows CE processors for native Visual Studio 2005 projects

While I do not often delve into native programming on this weblog, I was asked about this topic recently and thought I would share what I learned.  That question was: "How do I target a specific processor type when building a native Windows CE 5.0 application?"

I'd like to start by taking at look at what is available in a default installation of Visual Studio 2005 (Standard Edition and above).  The scenario below shows the steps necessary to create a native Win32 Smart Device project.

  1. On the File menu, select New and then Project

  2. In the New Project window, expand the Visual C++ node and select Smart Device
    This will display the list of installed Smart Device templates in the right hand pane of the New Project window

  3. Under Templates, select Win32 Smart Device Project

  4. Enter your desired project name in the Name box and click OK
    This will start the Win32 Smart Device Project Wizard.

  5. In the Win32 Smart Device Project Wizard window, click the Next button
    Alternately, you can click on Platforms in the left hand side of the window.

    By default, Visual Studio 2005 provides SDKs for Pocket PC 2003 and Smartphone 2003 (ARMV4 instruction set).

  6. Select your desired SDKs and click Next
    Alternately, you can click on Application Settings in the left hand side of the window.

  7. Set your desired application settings options and click Finish

Additional SDKs (Windows Mobile 5.0 Pocket PC, Windows Mobile 5.0 Smartphone) will add platforms to the Installed SDKs list in the Win32 Smart Device Project Wizard.  Each installed SDK enables Visual Studio 2005 to target CPUs supported by that platform.  For the Windows Mobile 5.0 SDKs, support for the ARMV4I instruction set is enabled.

For developers wishing to write applications for Windows CE 5.0 supported CPUs, the Windows CE 5.0 Standard SDK will need to be installed.  The Windows CE 5.0 SDK provides support for targeting the following instruction sets:

  • ARMV4I
  • MIPSII
  • MIPSII_FP
  • MIPSIV
  • MIPSIV_FP
  • SH4
  • x86

Once the Windows CE 5.0 Standard SDK has been installed, the Win32 Smart Device Project Wizard contains a new entry called STANDARDSDK_500.  Selecting this entry enables targeting the processors listed above.

Once your project has been created you can build your application for the desired CPU instruction set by setting the project's properties.

  1. In the Solution Explorer, right click on your project and select Properties
  2. In the <project name> Property Pages window, select the desired CPU instruction set using the Platform drop-down list and click OK

The above steps are handy when your application targets one specific CPU.  If you are targeting multiple CPUs, you can use Visual Studio 2005's Batch Build feature.

  1. On the Build menu, select Batch Build
  2. In the Batch Build window, check the box in the Build column for the desired Platform(s) and Configuration(s)
  3. Click the Build or Rebuild button to compile and link your application
    Build compiles and link's your application
    Rebuild performs a clean (remove previously built binaries) build of your application
  4. Click Close

You can also remove all previously built binaries for a given Project + Platform + Configuration (ex: the Debug build of MyApplication for the SH4 CPU) combination by following the above steps and using the Clean button.

Enjoy!
-- DK

Disclaimer(s):
This posting is provided "AS IS" with no warranties, and confers no rights.