Microsoft Windows Embedded CE 6.0 Exam Preparation Kit Foreword Introduction Chapter 1 Customizing the Operating System Design Lesson 1: Creating and Customizing the Operating System Design Operating System Design Overview Creating an OS Design The OS Design Template OS Design Customization with Catalog Components Build Configuration Management OS Design Property Pages Locale Options Build Options Environment Options Advanced OS Design Configurations Associating an OS Design with Multiple Platforms OS Design Paths and Files Source Control Software Considerations Lesson Summary Lesson 2: Configuring Windows Embedded CE Subprojects Windows Embedded Subprojects Overview Types of Subprojects Creating and Adding Subprojects to an OS Design Creating Windows Embedded CE Applications and DLLs Creating Static Libraries Creating a Subproject to Add Files or Environment Variables to a Run-Time Image Configuring a Subproject Lesson Summary Lesson 3: Cloning Components Public Tree Modification and Component Cloning Cloning Public Code Lesson Summary Lesson 4: Managing Catalog Items Catalog Files Overview Creating and Modifying Catalog Entries Catalog Entry Properties Adding a New Catalog Item to an OS Design Using a Catalog Item for BSP Development Exporting a Catalog Item from the Catalog Catalog Component Dependencies Lesson Summary Lesson 5: Generating a Software Development Kit Software Development Kit Overview SDK Generation Configuring and Generating an SDK Adding New Files to an SDK Installing an SDK Lesson Summary Lab 1: Creating, Configuring, and Building an OS Design ►Create an OS Design ►Inspect the OS Catalog ►Add Support for the Internet Explorer 6.0 Sample Browser Catalog Item ►Add Support for Managed Code Development to Your OS Design Chapter Review Key Terms Suggested Practice Create a Custom OS Design Generate and Test an SDK Chapter 2 Building and Deploying a Run-Time Image Lesson 1: Building a Run-Time Image Build Process Overview Building Run-Time Images in Visual Studio Building Run-Time Images from the Command Line Windows Embedded CE Run-Time Image Content Binary Image Builder Files Registry Files Database Files File System Files Lesson Summary Lesson 2: Editing Build Configuration Files Dirs Files Sources Files Makefile Files Lesson Summary Lesson 3: Analyzing Build Results Understanding Build Reports Troubleshooting Build Issues Errors during the Sysgen Phase Errors during the Build Phase Errors during the Release Copy Phase Errors during the Make Run-Time Image Phase Lesson Summary Lesson 4: Deploying a Run-Time Image on a Target Platform Choosing a Deployment Method Download Layer Transport Layer Debugger Options Attaching to a Device Lesson Summary Lab 2: Building and Deploying a Run-Time Image Build a Run-Time Image for an OS Design Configure Connectivity Options Change the Emulator Configuration Test a Run-Time Image on the Device Emulator Chapter Review Key Terms Suggested Practice Start the Build Process from the Command Line Deploy Run-Time Images Clone a Public Catalog Component Manually Chapter 3 Performing System Programming Lesson 1: Monitoring and Optimizing System Performance Real-Time Performance Demand Paging System Timer Power Management System Memory Non-Real-Time APIs Real-Time Performance Measurement Tools Interrupt Latency Timing (ILTiming) Operating System Benchmark (OSBench) Remote Performance Monitor Hardware Validation Lesson Summary Lesson 2: Implementing System Applications System Application Overview Start an Application at Startup HKEY_LOCAL_MACHINE\INIT Registry Key The Startup Folder Delayed Startup Windows Embedded CE Shell Command Processor Shell Windows Embedded CE Standard Shell Thin Client Shell Taskman Windows Embedded CE Control Panel Control Panel Components Implementing Control Panel Applets Building Control Panel Applets Enabling Kiosk Mode Lesson Summary Lesson 3: Implementing Threads and Thread Synchronization Processes and Threads Thread Scheduling on Windows Embedded CE Process Management API Thread Management API Creating, Exiting, and Terminating Threads Managing Thread Priority Suspending and Resuming Threads Thread Management Sample Code Thread Synchronization Critical Sections Mutexes Semaphores Events Interlocked Functions Troubleshooting Thread Synchronization Issues Lesson Summary Lesson 4: Implementing Exception Handling Exception Handling Overview Exception Handling and Kernel Debugging Hardware and Software Exceptions Exception Handler Syntax Termination Handler Syntax Dynamic Memory Allocation Lesson Summary Lesson 5: Implementing Power Management Power Manager Overview Power Manager Components and Architecture Power Manager Source Code Driver Power States System Power States Activity Timers Power Management API Notification Interface Device Driver Interface Application Interface Power State Configuration Overriding the Power State Configuration for an Individual Device Overriding the Power State Configuration for Device Classes Processor Idle State Lesson Summary Lab 3: Kiosk Mode, Threads, and Power Management ► Create a Thread ► Enable Power Management Notification Messages ► Enable Kiosk Mode Chapter Review Key Terms Suggested Practices Use the ILTiming and OSBench Tools Implement a Custom Shell Experiment with Multithreaded Applications and Critical Sections Chapter 4 Debugging and Testing the System Lesson 1: Detecting Software-Related Errors Debugging and Target Device Control Kernel Debugger Debug Message Service Macros for Debug Messages Debug Zones Zones Registration Zone Definitions Enabling and Disabling Debug Zones Overriding Debug Zones at Startup Best Practices Target Control Commands Debugger Extension Commands (CEDebugX) Advanced Debugger Tools Application Verifier Tool CeLog Event Tracking and Processing Remote Kernel Tracker CeLogFlush Tool Readlog Tool Lesson Summary Lesson 2: Configuring the Run-Time Image to Enable Debugging Enabling the Kernel Debugger OS Design Settings Selecting a Debugger KITL Debugging a Target Device Enabling and Managing Breakpoints Breakpoint Restrictions Lesson Summary Lesson 3: Testing a System by using the CETK Windows Embedded CE Test Kit Overview CETK Architecture Using the CETK Using the CETK Workstation Server Application Create a Test Suite Customizing Default Tests Running Clientside.exe Manually Running CETK Tests in Standalone Mode Creating a Custom CETK Test Solution Creating a Custom Tux Module Defining a Custom Test in the CETK Test Application Debugging a Custom Test Analyzing CETK Test Results Lesson Summary Lesson 4: Testing the Boot Loader CE Boot Loader Architecture Debugging Techniques for Boot Loaders Lesson Summary Lab 4: System Debugging and Testing based on KITL, Debug Zones, and CETK Tools ► Enable KITL and Use Debug Zones ► Perform Mouse Driver Tests by Using the CETK Chapter Review Key Terms Suggested Practices Detect Memory Leaks Custom CETK Test Chapter 5 Customizing a Board Support Package Lesson 1: Adapting and Configuring a Board Support Package Board Support Package Overview Adapting a Board Support Package Cloning a Reference BSP BSP Folder Structure Platform-Specific Source Code Implementing a Boot Loader from Existing Libraries Memory Mappings Driver Globals StartUp Entry Point and Main Function Serial Debug Output Platform Initialization Downloading via Ethernet Flash Memory Support User Interaction Additional Features Adapting an OAL OEM Address Table StartUp Entry Point Kernel Independent Transport Layer Profile Timer Support Integrating New Device Drivers Device Driver Code Locations Modifying Configuration Files Lesson Summary Lesson 2: Configuring Memory Mapping of a BSP System Memory Mapping Kernel Address Space Process Address Space Memory Management Unit Statically Mapped Virtual Addresses Dynamically Mapped Virtual Addresses Memory Mapping and the BSP Mapping Noncontiguous Physical Memory Enabling Resource Sharing between Drivers and the OAL Dynamically Accessing Physical Memory Statically Reserving Physical Memory Communication between Drivers and the OAL Lesson Summary Lesson 3: Adding Power Management Support to an OAL Power State Transitions Reducing Power Consumption in Idle Mode Powering Off and Suspending the System Entering the Suspend State Waking Up from Suspend State Supporting the Critical Off State Lesson Summary Lab 5: Adapting a Board Support Package ► Clone a BSP ► Create a Run-Time Image ► Customize the BSP Chapter Review Key Terms Suggested Practices Access the Hardware Registers of a Peripheral Device Reorganize Platform Memory Mappings Chapter 6 Developing Device Drivers Lesson 1: Understanding Device Driver Basics Native and Stream Drivers Monolithic vs. Layered Driver Architecture Monolithic Drivers Layered Drivers Lesson Summary Lesson 2: Implementing a Stream Interface Driver Device Manager Driver Naming Conventions Stream Interface API Device Driver Context Building a Device Driver Implementing Stream Functions Exporting Stream Functions Sources File Opening and Closing a Stream Driver by Using the File API Dynamically Loading a Driver Lesson Summary Lesson 3: Configuring and Loading a Driver Device Driver Load Procedure Registry Settings to Load Device Drivers Registry Keys Related to Loaded Device Drivers Kernel-Mode and User-Mode Drivers User-Mode Drivers and the Reflector Service User-Mode Drivers Registry Settings Binary Image Builder Configuration Lesson Summary Lesson 4: Implementing an Interrupt Mechanism in a Device Driver Interrupt Handling Architecture Interrupt Service Routines Interrupt Service Threads Interrupt Identifiers (IRQ and SYSINTR) Static Interrupt Mappings Dynamic Interrupt Mappings Shared Interrupt Mappings Communication between an ISR and an IST Installable ISRs Registering an IISR External Dependencies and Installable ISRs Lesson Summary Lesson 5: Implementing Power Management for a Device Driver Power Manager Device Drivers Interface XXX_PowerUp and XXX_PowerDown IOControl IClass Power Management Interfaces Lesson Summary Lesson 6: Marshaling Data across Boundaries Understanding Memory Access Allocating Physical Memory Application Caller Buffers Using Pointer Parameters Using Embedded Pointers Handling Buffers Synchronous Access Asynchronous Access Exception Handling Lesson Summary Lesson 7: Enhancing Driver Portability Accessing Registry Settings in a Driver Interrupt-Related Registry Settings Memory-Related Registry Settings PCI-Related Registry Settings Developing Bus-Agnostic Drivers Lesson Summary Lab 6: Developing Device Drivers ► Add a Stream Interface Driver to a Run-Time Image ► Access the Driver from an Application ► Adding Power Management Support Chapter Review Key Terms Suggested Practice Enhance Power Management Features More IOCTLs Installable ISR Glossary About the Authors
Microsoft Windows Embedded CE 6.0 Exam Preparation Kit Foreword It seems like yesterday that we released Windows CE 1.0 to the market, although 12 successful years have passed and many things have changed. New technologies have emerged, while others have vanished; and we continue to push forward with our partners to take full advantage of new hardware and software innovations. Windows Embedded CE continues to evolve, yet remains a small-footprint, real-time, embedded operating system that runs on multiple processor architectures and an amazing array of devices, including robots, portable ultrasound imaging systems, industrial controllers, remote sensor and alarm systems, point-of-sale front-ends, media streamers, game consoles, thin clients, and even devices most of us would never associate with a Microsoft operating system. Perhaps one day Windows Embedded CE will run on devices on the moon. It would not come as a surprise. Windows Embedded CE can be everywhere that computer devices help to make life easier and fun.
Right from the start, we have focused on the needs of professional embedded developers by creating a comprehensive suite of development tools and by supporting Windows programming interfaces and frameworks. We have integrated the Windows Embedded CE development tools with Visual Studio 2005 to provide developers with the freedom to customize the operating system and build the applications for the operating system. Today, Windows Embedded CE 6.0 supports x86, ARM, MIPS and SH4 processors out of the box, and includes approximately 700 selectable operating system components. CE provides the tools needed to configure, build, download, debug, and test operating system images and applications, ships with source code for the kernel, device drivers, and other features, and gives application developers the flexibility to create Win32, MFC, or ATL native code applications or managed applications based on the .NET Compact Framework. As part of the Microsoft Shared Source Initiative, we ship more than 2.5 million lines of CE source code, which gives developers the ability to view, modify, rebuild, and release the modified source. And recently we launched a "Spark your Imagination" program to give hobbyist developers access to hardware and CE software development tools at low costs.
You can find plenty of information about the CE operating system, development tools, and concepts in this preparation kit for Microsoft Certified Technology Specialist (MCTS) Exam 70-571 "Microsoft Windows Embedded CE 6.0, Developing" released in May 2008. We are very excited about Exam 70-571. It signifies another important milestone in the Windows Embedded CE success story. Now, for the first time, embedded developers have the ability to assess and demonstrate their skills regarding the development of embedded solutions based on Windows Embedded technologies, and they can gain recognition for their knowledge and proficiency. Anybody with a passion for CE 6.0 should consider taking the exam. We hope that this book accelerates your preparation just as Windows Embedded CE 6.0 accelerates your development processes. Best wishes from all of us here at the Microsoft development team!
Mike Hall Windows Embedded Architect Microsoft Corporation