Making Windows CE net Work With Custom Platforms

  • Slides: 42
Download presentation
Making Windows CE. net Work With Custom Platforms James Y. Wilson

Making Windows CE. net Work With Custom Platforms James Y. Wilson

Brief Biography v v v Lead software engineer for integration of CE on various

Brief Biography v v v Lead software engineer for integration of CE on various custom platforms Various publications on Windows CE system development Coauthor of “Building Powerful Platforms With Windows CE” published by Addison-Wesley in Q 4 1999 Microsoft Embedded MVP Developer of Windows 3. x/9 x/NT device drivers

Agenda v v v Introduction to CE OS Architecture Steps to adaptation for custom

Agenda v v v Introduction to CE OS Architecture Steps to adaptation for custom platforms Tool-chain Real-time capabilities and limitations Licensing options

Windows CE (In a Nut Shell) v v 32 bit, preemptive, multithreaded “Real-Time” Used

Windows CE (In a Nut Shell) v v 32 bit, preemptive, multithreaded “Real-Time” Used for implementation of Pocket. PC devices (PDAs, Phone Edition, Smart. Phone devices) Platform configurations for: v. Industrial controllers v. Gateways v. PDAs v. Set top boxes v. Web pads v. Internet appliances v. Mobile/IP Phones

Available Apps and Services v End user apps n n n Viewers (Excel, Word,

Available Apps and Services v End user apps n n n Viewers (Excel, Word, Power. Point, Image, and PDF) Inbox Pocket Internet Explorer (PIE) Internet Explorer (based on IE 6. 0) Remote Desktop Terminal Emulation Vo. IP Windows Messenger Word. Pad Media. Player Installers More! v Service components n n n C/C++ libraries and runtime (exception handling, RTTI) COM/DCOM Active Template Library. NET CF SNMP LDAP Microsoft Message Queuing MFC OBEX SOAP, XML (HTTP, XQL, XSLT, SAX) SQL Server CE Shells (console, graphical, skinnable, speech)

Windows CE Versions v Windows CE 1. 0 n v Windows CE 2. 0

Windows CE Versions v Windows CE 1. 0 n v Windows CE 2. 0 n n v Released 2000 Windows CE. net 4. 0 n v 2. 11 Introduced in 1998 Windows CE 3. 0 n v Released 1997 2. 01 (service pack for 2. 0) Windows CE 2. 1 Upgrade from Windows CE 2. 0 n v Released fall 1996 Released 2002 Windows CE. net 4. 2 n Released 2003

Target Hardware v Minimum hardware requirements n n n v Memory Management Unit for

Target Hardware v Minimum hardware requirements n n n v Memory Management Unit for paged virtual memory Timer Certified 32 bit processor (ARM cores, MIPS, PPC, SH, x 86) Reference Platforms n n n Priced from $200 for x 86 platform Provides “Board Support Package” Many single board computers and reference designs

OS Architecture OEM Microsoft ISV, OEM Applications Embedded Shell Remote Connectivity Windows CE Shell

OS Architecture OEM Microsoft ISV, OEM Applications Embedded Shell Remote Connectivity Windows CE Shell Services WIN 32 APIs COREDLL, WINSOCK, OLE, COMMCTRL, COMMDLG, WININET, TAPI Kernel OAL Bootloader GWES Drivers Device Manager File Manager Device drivers File drivers OEM Hardware Ir. DA TCP/IP

Modular OS v v OS divided into. exe/. dll modules (NK. exe contains kernel)

Modular OS v v OS divided into. exe/. dll modules (NK. exe contains kernel) Modules further divided using. lib files Modules run in Flash (uncompressed) or RAM (compressed in Flash, uncompressed in RAM) ROM image sizes: n n 400 K minimum: executive and file system 1200 K: networking (IPv 6, RTP, SMB/CIFS, RAS/PPP, WLAN, BT), no graphics 4 MB: +graphics, basic shell 6 MB: +hand writing recognition, etc.

Virtual Address Space FFFF C 200 0000 03 FF FFFF COREDLL. DLL Other ROM

Virtual Address Space FFFF C 200 0000 03 FF FFFF COREDLL. DLL Other ROM DLLs NK “Slot” Kernel Space XIP DLL space 8000 0000 Large Memory Area (memory mapped files) 4200 0000 4000 0000 3 E 00 0000 0800 0600 0400 0200 0000 0000 0200 0000 Slot 32 Slot 31 . . . Slot 3 Slot 2 Slot 1 Slot 0 Process 32 Process 31 Process 3 Process 2 DLLs Act. Process non-ROM DLLs Free virtual space Stack (reserved space) Heap (reserved space) Resources Read write data Read only data Code 0001 0000 reserved

Steps for Adaptation to a Custom Platform 1. 2. 3. 4. 5. 6. Boot

Steps for Adaptation to a Custom Platform 1. 2. 3. 4. 5. 6. Boot loader development OEM Adaptation Layer (OAL) Device driver development Selection/development of application suite Test and validation Platform SDK generation

Bootloader v v v v Technically not required for production build Performs minimal processor

Bootloader v v v v Technically not required for production build Performs minimal processor and memory initialization Configures debug ports Downloads OS image into RAM if debug (from TFTP server, serial, or parallel ports) Vector to ROM if production or disconnected, otherwise RAM Optionally provide OS update utility Many examples provided in Platform Builder (dialup bootloader with security)

OEM Adaptation Layer v Contains platform specific code n n n v v Performs

OEM Adaptation Layer v Contains platform specific code n n n v v Performs platform initialization ISR (support for nested interrupts) Implements power management Provides specified services called by Kernel Statically linked at build time to kernel (NK. exe)

OEM Adaptation Layer (2/2) v v Source examples provided for various reference platforms Available

OEM Adaptation Layer (2/2) v v Source examples provided for various reference platforms Available from 3 rd parties in Board Support Package (BSP)

Device Classes v v Defined: Devices which share common attributes grouped to form a

Device Classes v v Defined: Devices which share common attributes grouped to form a category or “class” Enables congregation of common driver code (class/miniport model) New device classes defined by Microsoft Because primary calling module, GWES, not provided in source form

Device Classes (continued)

Device Classes (continued)

Device Driver Models v v Defined: Common mechanism for constructing interfaces between identified driver

Device Driver Models v v Defined: Common mechanism for constructing interfaces between identified driver layers Not an API, but a mechanism supported by a defined API CE supports certain Windows 9 x/NT driver models, other driver models unique to CE ISV’s and IHV’s may define new driver models

Device Driver Models (continued) v Windows CE supported driver models n n n Stream-interface

Device Driver Models (continued) v Windows CE supported driver models n n n Stream-interface NDIS 4. 0 Printer Miniport (partial) n n n Native Windows NT ACM USB

Device Driver Architecture Device Manager Stream-interface Driver Stream-interface MDD Native Driver DDSI PDD Card

Device Driver Architecture Device Manager Stream-interface Driver Stream-interface MDD Native Driver DDSI PDD Card Services Stream-interface NDIS Wrapper Stream-interface USB Interface NDIS Miniport USBD USB Driver Card Services NDIS Wrapper HCD

Device Driver Architecture (Continued) GWE Subsystem DDI MDD Monolithic Device Driver Native Driver Defined

Device Driver Architecture (Continued) GWE Subsystem DDI MDD Monolithic Device Driver Native Driver Defined by Microsoft DDSI PDD

Device Driver Architecture (Continued) v v Consists of DLL’s and object module libraries Drivers

Device Driver Architecture (Continued) v v Consists of DLL’s and object module libraries Drivers run in user mode n n n Allows access to application level resources (MFC, COM, ATL, etc. ) Prevents kernel crashes due to driver exceptions Supports software assisted driver debugging

Device Manager v Primarily dedicated to Streaminterface Drivers n n v Loading and unloading

Device Manager v Primarily dedicated to Streaminterface Drivers n n v Loading and unloading Translation of application level calls Power management notifications Enumeration of PC Card devices Exists in a separate process space n n Implications for buffer pointers Single driver instance shared by all calling applications

Stream-interface Driver Model v v v Used most commonly Basis of certain driver models

Stream-interface Driver Model v v v Used most commonly Basis of certain driver models (ex. : USB and NDIS) Supports installable devices Standard Win 32 file I/O interface Exposed only through the Device Manager Often used in combination with the Native Driver Model

Stream-interface Driver Model (Continued) v Required entry points (XXX = Device File Name) in

Stream-interface Driver Model (Continued) v Required entry points (XXX = Device File Name) in approximate order of initialization: n n n n XXX_Init XXX_Io. Control XXX_Open XXX_Read XXX_Write XXX_Seek XXX_Power. Up n n n XXX_Deinit XXX_Close XXX_Power. Down

Native Driver Model v v v Supports onboard devices only Provides class/miniport layering Model

Native Driver Model v v v Supports onboard devices only Provides class/miniport layering Model Device Driver (MDD) layer n n n v Provided by Microsoft Communicates with GWES and kernel Handles interrupts Platform Dependent Driver (PDD) layer n n Contains code to access the hardware Focus of changes for integration of CE with a custom platform

Other Device Driver Models v v v v Services. exe, intended for non-device related

Other Device Driver Models v v v v Services. exe, intended for non-device related modules USB Driver Model NDIS 4. 0 miniport Printer miniport Audio Compression Manager Many drivers implemented using a hybrid driver model (ex. : RS-232 serial driver) Implementation of custom driver models possible n Driver Control Program (DCP) must be defined (ex. : USBD. dll)

Processing Interrupts v v v Different for installable devices (ex. : PC Card and

Processing Interrupts v v v Different for installable devices (ex. : PC Card and USB) For onboard devices, first processed by an ISR in the OAL Lower priority interrupts disabled while in ISR, with nesting of higher priority interrupts Interrupt Service Thread (IST) is signaled IST generally running at high priority, do not block on resources in lower priority threads

Processing Interrupts

Processing Interrupts

Accessing Physical Resources v v Must request user mode address mapped to physical memory

Accessing Physical Resources v v Must request user mode address mapped to physical memory May use functions available in CEDDK. LIB Other driver models provide similar functions Example source. . .

Accessing Physical Resources #define UNCACHED_OFFSET 0 x 80000000 #define UNCACHEDMEMORY(address) (address | UNCACHED_OFFSET) #define

Accessing Physical Resources #define UNCACHED_OFFSET 0 x 80000000 #define UNCACHEDMEMORY(address) (address | UNCACHED_OFFSET) #define MY_DEVICE_FRAME_BUFFER 0 x. B 0000 #define MY_DEVICE_FRAME_BUFFER_LENGTH 0 x 20000 PVOID p. Mapped. Memory = Mm. Map. Io. Space((PHYSICAL_ADDRESS) UNCACHEDOFFSET(MY_DEVICE_FRAME_BUFFER), (ULONG)MY_DEVICE_FRAME_BUFFER_LENGTH, FALSE); ASSERT(p. Mapped. Memory != NULL); . . . Mm. Unmap. Io. Space(p. Mapped. Memory, (ULONG)MY_DEVICE_FRAME_BUFFER_LENGTH);

Platform Builder v Platform Configuration n v Used to select modules in OS image

Platform Builder v Platform Configuration n v Used to select modules in OS image Configures link and locate Wizard provided to begin with reference platform Module Development n n Supports device driver and application development Built separately from OS image

Platform Builder (2/3) v Debugging n n n Configurable connections to platform (TCP/IP, Active.

Platform Builder (2/3) v Debugging n n n Configurable connections to platform (TCP/IP, Active. Sync, Serial, or custom) Single step and conditional break points Support for hardware-assisted debugging (useful for OAL) Process, thread, module, and memory windows Tracking of kernel state Call profiling

Platform Builder (3/3) v v Builds ROMable OS image Provides emulation to load and

Platform Builder (3/3) v v Builds ROMable OS image Provides emulation to load and test OS image Supports creation of custom “Platform SDK” Demo: Emulator, Break point, process viewer, Kernel Tracker, call profiling

Platform Builder Demo

Platform Builder Demo

Other Tools v e. Mbedded Visual C++ 3. 0 n v e. Mbedded Visual

Other Tools v e. Mbedded Visual C++ 3. 0 n v e. Mbedded Visual C++ 4. 0 n v v v Used for Pocket PC 2003 (CE 4. 0 devices) and later Visual Studio. net n v Used for Pocket PC 2002 (CE 3. 0 devices) and earlier Used for managed code development (. net Compact Framework) Both e. VC products to be merged with Visual Studio Free download status of e. VC in question Windows CE Test Kit (CETK, see downloads) for scriptable application and system testing

Real Time Capabilities v v v v v 256 priority levels Scheduler granularity of

Real Time Capabilities v v v v v 256 priority levels Scheduler granularity of 1 millisecond Thread Quantum defined independent of timer tick (set to 0 for run to completion) Decouples thread quantum (time slice) from timer tick Nested interrupts ROM compression optional (avoids page faults) Multiple XIP regions Full kernel mode supported Priority Boosting

Real-Time Capabilities* (2/2) SH 4 198 MHz Windows CE 3. 0 ISR Min [us]

Real-Time Capabilities* (2/2) SH 4 198 MHz Windows CE 3. 0 ISR Min [us] 0. 9 Pentium 100 MHz Windows CE 3. 0 1. 9 ISR Max 9. 1 5. 7 ISR Average 2. 9 2. 8 IST Min 14. 8 12. 9 9. 6 IST Max 54. 3 163. 3 55. 6 IST Average 38. 2 28. 7 26. 4 Jitter Max 40 150 46 *Source: http: //msdn. microsoft. com/library/default. asp? url=/library/enus/dnce 30/html/realtimecapabilities. asp Pentium 100 MHz Windows CE 3. 0+QFE 1. 9

Licensing Options v v v Platform Builder cost $995/seat Windows CE Royalty begins at

Licensing Options v v v Platform Builder cost $995/seat Windows CE Royalty begins at $3 Shared Source Licensing n n n v Allows non commercial derivatives Allows debugging commercial products Redistribution program available CE devices See “Web Sites” for additional reference

Downloads v Platform Builder Evaluation Kit v e. Mbedded Visual C++ 3. 0 e.

Downloads v Platform Builder Evaluation Kit v e. Mbedded Visual C++ 3. 0 e. Mbedded Visual C++ 4. 0 http: //www. microsoft. com/windows/Embedded/ce. NET/evalua tion/trial/evalkit. asp http: //msdn. microsoft. com/vstudio/device/embedded/downlo ad. aspx v All other downloads (including CETK) http: //www. microsoft. com/windows/embedded/ce. net/downlo ads/default. asp

Documents v CE Real Time research docs n Real-Time Evaluation by Dedicated Systems: n

Documents v CE Real Time research docs n Real-Time Evaluation by Dedicated Systems: n Real-Time and Windows Embedded: n Windows Embedded Real-Time: n Performance Test Methodologies for Windows CE. NET http: //www. microsoft. com/windows/embedded/ce. net/evaluation/performance/dedi catedsys. asp http: //www. microsoft. com/windows/Embedded/community/experto/july 2002/nfram pton. asp http: //www. microsoft. com/windows/Embedded/community/experto/july 2002/jaokee fe. asp http: //msdn. microsoft. com/library/default. asp? url=/library/enus/dncenet/html/perfmethod. asp? frame=true n Designing and Optimizing Microsoft Windows CE. NET for Real-Time Performance http: //msdn. microsoft. com/library/default. asp? url=/library/enus/dncenet/html/rtnetdesigning. asp

Web Sites v Product Overview n v Shared Source License Information n v http:

Web Sites v Product Overview n v Shared Source License Information n v http: //www. microsoft. com/windows/Embedded/ce. NET/howtobuy/sku. as p Development Community Web Sites n n n v http: //www. microsoft. com/windows/embedded/ce. net/evaluation/shareds ource/default. asp Runtime Licensing Model for CE. NET 4. 2 n v http: //www. microsoft. com/windows/embedded/ce. net/evaluation/overvie w/default. asp Windows. For. Devices. com: http: //www. windowsfordevices. com/ Pocket PC Developer Network: http: //www. pocketpcdn. com The Code Project: http: //www. codeproject. com/ce/ Evangelist Web Sites n n Pocket PC Passion: http: //www. pocketpcpassion. com/ CE Windows. NET: http: //www. cewindows. net

Conclusion v v v Modular operating system Various driver models with nested interrupts Custom

Conclusion v v v Modular operating system Various driver models with nested interrupts Custom Kernel Image through PB Flexible Real-Time performance characteristics Low cost licensing CE’s total integration advantage