Выбрать главу

■ Component

■ SYSGEN variable

■ Environment Variable

■ Software Development Kit

Suggested Practice

To help you successfully master the exam objectives presented in this chapter, complete the following tasks:

Create a Custom OS Design

By using the OS Design Wizard, create an OS design based on the Device Emulator: ARMV4I BSP and the Custom Device design template. Perform the following tasks after OS design creation:

■ Add the .NET Compact Framework 2.0 Add this catalog item by using the search feature in the Catalog Items View.

■ Localize your run-time image Display the OS Design property pages and local­ize the OS design for the French language.

Generate and Test an SDK

Based on the OS design generated during Lab 1, perform the following tasks:

■ Build and generate the binary image Build and generate the binary image for the OS design generated in the Release build configuration.

■ Create and install the SDK Verify that the build process completes successfully, and then create a new SDK, build it, and install it on an application development computer.

■ Use the SDK Use another instance of Visual Studio and create a Win32 Smart Device application. Use your custom SDK as the reference SDK for the project and build the application.

Chapter 2

Building and Deploying a Run-Time Image

The Microsoft® Windows® Embedded CE 6.0 R2 build process is very complex. This process includes several phases and relies on a variety of tools to initialize the Windows Embedded CE build environment, compile the source code, copy modules and files to a common release directory, and create the run-time image. Batch files and build tools, such as the Sysgen tool (Sysgen.bat) and the Make Binary Image tool (Makeimg.exe), automate this process. You can run these tools directly at the command prompt or start the build process in Microsoft Platform Builder for Windows Embedded CE 6.0 R2. The Platform Builder integrated development environment (IDE) relies on the same processes and tools. In either case, a thorough understanding of the build process and the steps required to deploy the resulting runtime image is essential if you want to create run-time images efficiently, troubleshoot build errors, or deploy Board Support Packages (BSPs) and subprojects as part of a run-time image on a target device.

Exam objectives in this chapter:

■ Building run-time images

■ Analyzing build results and build files

■ Deploying a run-time image on a target device

Before You Begin

■ To complete the lessons in this chapter, you must have:

■ An understanding of operating system (OS) design aspects, including catalog items and the configuration of environment variables and SYSGEN variables, as explained in Chapter 1, "Customizing the Operating System Design."

■ At least some basic knowledge about Windows Embedded CE software development, including source code compilation and linking.

■ A development computer with Microsoft Visual Studio® 2005 Service Pack 1 and Platform Builder for Windows Embedded CE 6.0 R2 installed.

Lesson 1: Building a Run-Time Image

The Windows Embedded CE build process is the final step in the run-time image development cycle. Based on the settings defined in the OS design, Platform Builder compiles all components, including subprojects and the BSP, and then creates a runtime image that you can download to the target device. The build process entails several build phases, automated by means of batch files. You must understand these phases and the build tools if you want to configure build options correctly, create runtime images efficiently, and solve build-related issues.

After this lesson, you will be able to:

■ Understand the build process.

■ Analyze and fix build issues.

■ Deploy a run-time image to target hardware.

Estimated lesson time: 40 minutes.

Build Process Overview

The Windows Embedded CE build process includes four main phases, as illustrated in Figure 2-1. They follow each other sequentially, but you can also carry them out independently if you know the purpose and tools used for each phase. By selectively running the build tools, you can perform individual build steps in a targeted way, which helps to save build time and ultimately increases your efficiency.

Figure 2-1 Build phases and build tools

The build process includes the following key phases:

■ Compile phase Compiler and linker use source code and resource files to generate executable (.exe) files, static (.lib) libraries, dynamic-link library (.dll) files, and binary resource (.res) files according to the selected locales. For example, the build system compiles the source code in the Private and Public folders into .lib files during this phase. This process can take several hours to complete, but fortunately it is seldom required to rebuild these components because binaries are already provided by Microsoft. In any case, you should not modify the source code in the Private and Public folders.

■ Sysgen phase The build system sets or clears SYSGEN variables based on the catalog items and dependency trees included in the OS design, filters the header files and creates import libraries for the Software Development Kits (SDKs) defined in the OS design, creates a set of run-time image configuration files for the OS design, and builds the BSP based on the source files in the Platform directory.

■ Build phase The build system processes the source files of your Board Support Package and applications using the files generated during the Sysgen phase. At this time, hardware-linked drivers and the OEM adaptation layer (OAL) are built. Although the processes during the build phase are carried out automatically during the Sysgen phase, it is important to understand that if you modify only the BSP and subprojects, then you can rebuild the BSP and subprojects without running the Sysgen tool again.

■ Release Copy phase The build system copies all files required to create the runtime image to the OS design's release directory. This includes the .lib, .dll, and .exe files created during the Compile and Sysgen phases, as well as binary image builder (.bib) and registry (.reg) files. The build system might skip this phase if headers and libraries are up-to-date.

■ Make Run-time Image phase The build system copies project-specific files (Project.bib, Project.dat, Project.db, and Project.reg) to the release directory and assembles all files in the release directory into a run-time image. Directives based on environment variables specified in .reg and .bib files control which catalog items the build system includes in the final run-time image. The run-time image is typically a file named Nk.bin, which you can download and run on the target device.

Building Run-Time Images in Visual Studio

During the installation of Windows Embedded CE 6.0 R2 on your development workstation, Platform Builder integrates with Visual Studio 2005 and extends the Build menu so that you can control the build process directly in the Visual Studio IDE. Figure 2-2 shows the Platform Builder commands that are available on the Build menu when you select the OS design node in Solution Explorer.