Whether you are working with Linux, Windows or other RTOS, develop custom OS runtime image for a targeted hardware platform, without help from efficient development tool, is a daunting, tedious and time consuming task.  To help simplify the complexity in developing custom Compact 2013 OS runtime image, Microsoft provides the Platform Builder suite of tools, a set of free plug-in for the Visual Studio 2012 and 2013 IDE, available for download from Microsoft website.

In part-2 of this Compact 2013 getting started series, we will work through the steps, using the Platform Builder plug-in for Visual Studio 2013, to develop an OS design project and generate an OS runtime image for a target device.

For information about the development environment, please refer to part-1 of this series (development environment and tools), via the following URL:

http://www.embedded101.com/Blogs/SamuelPhung/entryid/577/compact-2013-development-environment-tools


Board Support Package

Board support package (BSP) for the target device (hardware platform) is a software package that includes device drivers to support I/O peripherals on the target device, OEM hardware adaptation layer code (OAL), boot loader and other software components needed to build and deploy OS runtime onto the device.

BSP is typically provided by the hardware vendor who design and build the device and is one of the critical components needed to develop OS runtime image for the device.

BSP development for Compact 2013 involves device driver development and is an advanced subject not within the scope for this getting started series to cover.

We will use the 86Duino_80B BSP to develop OS design for the EduCake, which we use as the target device for the exercises in this getting started series.  The 86Duino_80B BSP is available on Codeplex, via the following URL:

http://86duino.codeplex.com/


Create an OS Design Project

Using a development machine with VS2013 and Platform Builder for Compact 2013 installed, let’s work through the following steps to create a new OS design project:


  • From Visual Studio 2013 (VS2013) IDE, select File|New|Project to bring up the New Project wizard.
  • From the left pane, select Platform Builder.  Click to highlight OS Design on the center pane and enter project name, MyOSDesign, as shown in Fig-01.

Fig-01:  New OS Design project.


  • Click OK to launch OS Design Wizard.
  • Click Next to continue and launch the Board Support Packages selection screen.  Select 86Duino_80B, as shown in Fig-02.

Fig-02:  BSP selection


  • Click Next to continue and bring up the Design Templates selection screen.  Select Headless Device, as shown in Fig-03.

Fig-03:  Design Templates selection


  • Click Next to continue and bring up the Headless Device OS components selection screen, as shown in Fig-04.

Fig-04:  OS Components selection


  • Select components as shown in Fig-04 and click Finish to complete the OS Design wizard step.


At this point, VS2013 created the initial workspace for the new OS design project based on the BSP, design template and components selected.  The following directories are created for the project:

  C:\WINCE800\OSDesigns\MyOSDesign


This is the folder for the MyOSDesign solution. VS2013 supports different project types. A solution provides a centralized workspace to keep different project types supporting the same solution in one location.

For example, the MyOSDesign solution may include the MyOSDesign OS design project, Visual C# managed code application project and “Visual C++ native code application project, all within the same VS2013 solution workspace.


The VS2013 IDE should look similar to the screen as shown in Fig-05.

Fig-05:  VS2013 IDE with MyOSDesign project active


Customize OS Design:  BSP Components

Next, to customize the OSDesign, we will work through the steps to select and add BSP components to MyOSDesign from the Catalog Items View window, as shown in Fig-05.


Expand component folders and select components from the 86Duino_80B BSP, as shown in Fig-06.

Fig-06:  BSP components


Select and include the following BSP components to the OS design:

  * R6040 Ethernet driver

  * 1st Serial Port

  * ATAPI PCI/IDE Storage Block Driver

     Driver to support IDE, SATA, Compact Flash, SD and Micro-SD storage.

  * Hive-based registry support

     The Hive-based registry component needed to save registry settings to non-volatile storage between power reset (cold boot).

  * Aggressive flushing

     Enable a background thread to actively flush and save changes to the registry.

  * USB Mass Storage Class driver

     This component set the SYSGEN_USB_STORAGE environment variable to include the USB storage class driver to support external USB storage devices, including USB flash and portable USB hard drive.

 


Customize OS Design:  OS Components

In addition to the BSP components to support the target device’s I/O peripherals, additional OS components are needed to support the device’s application and function, as shown in Fig-07.

Fig-07:  OS components

OS components are under the \Core OS\Windows Embedded Compact folder in the Catalog Items View window. During the steps to create the initial OS design workspace, the OS design wizard included a number of OS components, based on the selected design template, to the OS design.

Select and add the following OS components to the OS design:

  * Display Driver Stub

Compact 2013 OS, similar to the Windows OS for the desktop, is design to support rich user interface environment and is heavily dependent on GWES (Graphics, Windowing and Events Subsystem), even for headless configuration.  The Display Driver Stub component is null display driver.


Build, Compile and Generate OS Runtime Image

With the required BSP and OS components added to the OS design project, it’s time to build and generate the OS runtime image.  From the VS2013 IDE, select BuildàBuild Solution to build the project.

Depending on the PC’s performance, it may take anywhere from 10 to 20+ minutes to complete the build process.  When the build process is completed, the VS2013 IDE’s Output tab display the build result, as shown in Fig-08.

Fig-08:  Build completed


When the build is successful, the build ends with zero error and generate an OS runtime image file, NK.bin, in the following build release directory:

C:\WINCE800\OSDesign\MyOSDesign\MyOSDesign\RelDir\86Duino_80B_x86_Release

NK.bin is the actual OS runtime image to deploy on the device for distribution to the end user.


When the build ends with 1 or more error, it does not generate an OS runtime image.  Review the build.log and build.err files in the C:\WINCE800\ folder to analyze problem.


Summary

While the process to develop custom OS runtime image for any hardware platform is a complex process, as you can see from the OS design development exercise in this series, the Compact 2013 development environment greatly simplified the process and tasks needed to create and customize an OS runtime image for a designated device.

In part-3 of this series, we will work through the steps to download the OS runtime image to a target device (86Duino EduCake) for testing and debug.