Windows Embedded Compact 7 Development on Windows 10

y goal was to run my WEC 7 images in the latest and greatest Windows Hypervisor i.e. Hyper-V. Keep in mind Virtual PC works fine in a Windows 7 Hyper-V guest VM and up until now this is how I have done my development & testing

Windows Embedded Compact 7 Development on Windows 10

Although the following scenario works keep in mind that it is not necessarily supported by Microsoft, use the information at own risk. It’s important to note that official Support for Visual Studio 2008 ends April 10th 2018.

Recently I spent time looking into this scenario, a colleague pointed me to a post on the MSDN forums where users had got a WEC 7 image to boot with Hyper-V on Windows 10.

So I thought I would try it Smile and after finally getting it to work I decided to document it so I can reference this article in the future. My goal was to run my WEC 7 images in the latest and greatest Windows Hypervisor i.e. Hyper-V. Keep in mind Virtual PC works fine in a Windows 7 Hyper-V guest VM and up until now this is how I have done my development & testing.

The high level steps I performed were as follows:

  1. Setup Hyper-V Networking.
    1. Create NAT Network & Switch.
    2. Install & Configure DHCP server.
  2. Setup the Developer Tools.
    1. Install Visual Studio 2008 with SP 1
    2. Install Windows Embedded Compact 7
  3. Create Simple OS Design.
    1. Create BSP clone based on Virtual PC BSP
      1. Tweak for use with Hyper-V
    2. Configure Network
    3. Create OS Design project
  4. Add Hyper-v Guest for WEC 7
    1. Create Virtual Machine
    2. Run VM & Download OS Image

So here it goes these are the detailed steps I performed to get my Embedded Compact Developer environment migrated to Windows 10

Requirements

  • Windows 10 Creators Update –1703
  • Visual Studio 2008 Pro SP1
  • Windows Embedded Compact 7 with Jan 2016 Update
  • DHCP for Windows

1. Setup Hyper-V Networking

Network Address Translation allows us define a private IP address range for our VM’s, whereby traffic will be re-routed through our host machines network interface, this together with a DCHP server allows us to allocated individual private IP’s to our VM’s and also allows them access to the public internet. NAT is not strictly necessary here but this is my preferred way of configuring networking for my Virtual Machines.

Initial NAT Network support was added in the Anniversary Update release of Windows 10, although there were some restrictions on its usage see the WinNAT capabilities and limitations blog post – in the Creators Update release the windows team vastly improved NAT support by amongst other things adding support for multiple NAT networks.

1.1 Create NAT Network & Add Switch

From the windows Start Menu, search for PowerShell right click and select “Run as Administrator”

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image528.png)

Once the PowerShell console opens run the following commands.

1. Create a new NAT network with the name “VMNAT” and a large private IP address range 10.10.0.0/17

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image514.png)

2. Create a new Internal Virtual Switch

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image515.png)

3. Remove the default IP address configuration for the new Switch

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image516.png)

4. Get the interface index for the Network Adaptor assigned to the new Switch

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image517.png)

5. Create a new IP Address within the NAT network range created above

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image518.png)

We are now ready to proceed to adding a local DHCP server, we could also skip the “Add Local DHCP” step and assign static IP’s to each VM without configuring a DHCP server.

1.2 Add Local DHCP

For DHCP I am using the simple tool DHCP Server for Windows, I wanted a simple and lightweight way of installing & configuring a local DHCP server and this tool meets those needs.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image519.png)

1. Download and extract the latest release of DHCP for Windows, I extract it somewhere central like the Program Files folder.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image520.png)

2. Right click and run the “dhcpwiz.exe” tool as Administrator to start the setup wizard, click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image521.png)

3. The available network cards will be displayed, select the “vEthernet (Virtual Machines NAT)” network which we created earlier & click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image522.png)

4. Leave the defaults for the Support Protocols Pane & click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image523.png)

5. Leave the default configuration for DHCP, the range should already co-inside with your Network interface IP & click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image524.png)

6. click “Advanced” - Add your favorite public DNS servers, in this case I am using Google’s, and set your default gateway to your NIC IP.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image525.png)

7. click “Write INI file” this will persist the settings you have configured through the wizard & click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image526.png)

8. There are two ways to run the DHCP server, I prefer to install it as a Windows Service. Click Service –> Install and then Service –> Start.
If you have your firewall enabled click Configure under the Firewall Exceptions section.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image527.png)

2. Setup the Developer Tools.

In this guide I install the tooling on the same machine but because I like to keep only the latest version of Visual Studio installed
on my machine my preference is to install the developer tooling in a guest VM(could be Windows 7 or Windows 10 guest).

To install Windows Embedded Compact 7 you must meet the following requirements.

2.1 Install Visual Studio 2008

Based on the requirements we need to install Visual Studio 2008 with SP1, and it needs to be the Professional or higher SKU.

1. Run the Visuals Studio 2008 installer, click Install Visual Studio

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image532.png)

2. For simplicity I have selected the Default installation option

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image533.png)

3. Wait for Installation to complete & click next.
*note* you will be notified about various compatibility issues by the installer.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image534.png)

4. Once installation completes close the installer wizard.

5. Download Visual Studio 2008 SP1 & Install.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image538.png)

You should now be ready to install Windows Embedded Compact 7

2.2 Install Windows Embedded Compact 7

1. Insert the WEC 7 installation media and run the installer, click Begin Install.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image529.png)

2. Accept the terms & Conditions and click next

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image535.png)

3. Enter your product key & click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image536.png)

4. To reduce the installation footprint I select custom install and clicked next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image552.png)

5. Select the following components for installation & click next:

  • Platform Builder
  • Silverlight Tools
  • EN Documentation
  • Shared Source
  • x86 Architecture

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image553.png)

6. Leave default not to create offline layout, click next

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image554.png)

7. Accept the EULA and click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image555.png)

8. Wait for installation to complete & click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image556.png)

9. Click finish to close the installer.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image557.png)

10. This scenario has been tested with January 2016 Update, at a minimum we should be using this version of the
product see Microsoft downloads to download the update. Once downloaded install the update.

3. Create OS Design

Running a WEC 7 image in Hyper-V requires specific changes to be made to the Virtual PC BSP, rather than make these changes on this built-in BSP. I prefer to clone it and customize the cloned BSP – My goal here is to create a minimum viable OS Design to run in Hyper-V. For detailed steps for creating an OS Design see the following blog post series over at Embedded101.com.

3.1 Clone BSP

1. Open Visual Studio 2008 click – Platform Builder –> Clone BSP, in the Clone Dialog enter the following information.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image539.png)

2. The cloned BSP can be seen below in platform folder

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image540.png)

3. We need to make a minor change to the “platform.bib”, see changes below

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image541.png)

3.2 Create new OS design

1. File –> New Project and Select OS Design, enter a name for your new project.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image543.png)

2. The creation Wizard will be displayed, click next

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image544.png)

3. select the newly created Hyper-v BSP, click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image545.png)

4. Select the Industrial Controller Design Template

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image546.png)

5. Select the following Applications & Media & click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image547.png)

6. Leave the Defaults for networking & click next

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image548.png)

7. Click Finish to create your project

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image549.png)

8. Accept the additional T+C’s

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image550.png)

9. Once your project is created it will be displayed in Visual Studio 2008

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image551.png)

10. Next we need to add features via the Catalog We need the following components selected:

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image602.png)

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image603.png)

11. Right click the OS Design project in solution explorer and click properties –> Build Options, disable KITL & kernel Debugging.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image629.png)

12. The final step is to Build our OS Design.

4. Add Hyper-V Guest for Embedded Compact 7

We will be triggering the download of the image to the Virtual Device via EBoot but you could also create a standalone vhd

4.1 Create Virtual Machine

1. From the Windows 10 start menu open “Hyper-V Manager”, click create new Virtual Machine.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image619.png)

2. Select a name for your new WEC7 Virtual Machine

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image620.png)

3. Select Generation 1 and click next.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image611.png)

4. Enter 512MB for startup memory and disable Dynamic memory.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image621.png)

5. Click next without selecting a Network Switch we will do this later.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image622.png)

6. Select the sample vhd file supplied with the WEC7 tools.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image623.png)

7. Click finish to create the virtual machine

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image624.png)

8. We now need to customize the newly created VM.

  • Replace the Existing Network Adaptor with a Legacy Network Adaptor
    • Select the “Virtual Machines NAT” switch we created earlier.
  • Pad out the IDE devices with 3 dummy CDROM drives as by default our OS design expects 4 IDE Devices.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image617.png)

9. Click ok to save our settings.

4.2 Run VM & Download OS Image

We are now ready to run our virtual machines and download our newly compiled OS Image.

1. With Visual Studio 2008 SP1 & our OS design open, which we built in the previous section

2. Right click the VM in Hyper-V Manager and click Connect, with the VM Console open click Start, on boot our VM will
start to send out BOOTMET messages.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image625.png)

3. In Visual Studio, Make sure we have (auto) Ether device selected in toolbar & click Attach Device; the following window will be shown.
It may take a moment for the device to be detected, select the device from the list and click apply.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image626.png)

4. The image will now be downloaded to the device.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image627.png)

5. Progress will be shown in VS2008 & in the VM Console Window.

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image628.png)

6. Once download completes WEC will boot

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image633.png)

There you go so now you can enjoy Windows 10 and still develop for Embedded Compact 7, of course your mileage may vary – There are no guarantees regarding this scenario and although it may work now there is no way to know if it will continue to work on future releases of Hyper-V/Windows.

Let me know your thoughts & issues.

Troubleshooting Tips

tftp timeout

[![image](GHOST_URL/content/images/imageom/content/images/2017/03/image618.png)

https://blogs.msdn.microsoft.com/obloch/2010/08/12/windows-embedded-compact-7-and-virtual-pc-bsp/