MIKE HALL SOFTWARE ARCHITECT MICROSOFT CORPORATION MIKEHALL@MICROSOFT.COM BLOGS.MSDN.COM/MIKEHALL
Windows CE Backgrounder Windows Embedded CE Architecture Real-Time Architecture Tools and Application Development Q&A
CONFIGURE AND O/S IMAGE, AND BUILD WE WILL COME BACK TO THE BUILD PROCESS LATER IN THE SESSION.
Alder Windows CE 1.0 11/1996 Cedar Windows CE 3.0 4/2000 Macallan Windows CE 5.0 8/2004 Tomatin NMD FP CE 6.0 R2 SP1 2.11 Birch Windows CE 2.0 11/1997 SP2 2.12 Jameson 4.1 Talisker Windows CE.NET 4.0 1/2002 McKendric 4.2 Yamazaki Windows CE 6 H2/2006
Windows Embedded CE 6.0 is NOT Windows Mobile 6.0 (based on CE 5.0) Windows Embedded CE 6.0 is 32-bit, real-time, multitasking OS Highly componentized (~ 700 components in CE 6.0) Delivered as a granular set of components Use CE 6.0 Platform Builder tools to configure image Scalable Footprint scales with functionality selected Wide variety of CPU support Runs on x86, ARM, MIPS and SH4
Kernel Large Memory Area Used for Memory Mapped Files Process Limited to 64M Address Space Reserved Process` Active Process Application Space
2 GB Kernel Space Kernel Large Memory Area Single 2 GB VM for all Processes Slot 32 Slot 31 : : Slot 7 Slot 6 Slot 5 Slot 4 Slot 3 Slot 2 Slot 1 ROM DLLs Slot 0 Execution 31 Slots for Processes Execution Slot
2 GB Kernel Space Kernel Filesystem GWES Drivers 2 GB per Process Process Code User VM 32 K Process
2 GB of Virtual Memory per process 32K processes 64K Global Handle Table Unified Kernel Critical OS components moved into kernel space Improved system performance Increased security and robustness High degree of application compatibility
User Space 2 Gigabytes Each process has its own mapping 0x80000000 0x40000000 Shared System Heap 255 MB RAM Backed Mapfiles 256 MB Shared User DLLs 512 MB Used for OS / App communication RAM Backed Mapfiles All DLLs code and data Process space 1 GB per process Executable code and data VM Allocation 0x00000000 Page 10
Shell Services Manager Services UM Driver Manager User Mode Drivers Applications Applications User Mode OS DLLs (Coredll, Winsock, CommCtrl, ) Kernel.DLL NK.EXE Bootloader KCoredll.DLL FileSys.DLL GWES.DLL Hardware Device.DLL Kernel Drivers Kernel Mode Page 11
Two driver types supported Kernel Mode for performance User Mode for robustness Minimal effort to port existing CE 5.0 drivers 1-3 Days effort per driver The overall structure of drivers remains the same Main changes are in how the drivers access client memory No SetKMode or SetProcPermissions CEAppCompat tool to check existing driver/applications
Respond time test using the following configuration Samsung SMDK2410 development board 200 mhz ARM with 16x16 cache Windows CE 5.0 with full UI Running a WMV video Windows CE Real-Time Test Results ISR starts IST starts Minimum 1.2 µs 31.7 µs Average 3.3 µs 67.2 µs Maximum 13.3 µs 103.0 µs Time in microseconds (µs)
ILTiming & OS Bench ILTiming Software-based real-time measurement tool Measures both ISR and IST latencies ISR latency From IRQ to ISR IST latency From the end of the ISR to the start of the IST Enabled for all sample platforms Varying system loads OSBench Scheduler performance-timing tests Enables you to determine how long it takes to perform a basic kernel tasks such as Acquire or release a critical section Wait or signal an event Create a semaphore or mutex Yield a thread Call system APIs
Windows CE 6.0 has 256 levels of priority Level 0 is the highest and 255 is the lowest The old CE model (< CE 3.0) of 8 levels now map to the lowest 8 of the new model The default thread priority is 252 SetThreadPriority = 251 Levels 0 through 248 can be reserved by OEM Levels Description 0 through 96 Real-time above drivers 97 through 152 Default used by CE device drivers 153 through 247 Real-time below drivers 248 through 255 Non-real-time priorities
IST Latency IST Thread ISR 1 ISR N ISR Latency ISR ID OAL ISR All Higher Enabled Set Event All Except ID All Kernel HW
IST IST ISR 1 ISR N ISR I D OAL // Create the Event gintevent = CreateEvent( NULL, // Security FALSE, // Manual reset FALSE, // Init as not signaled NULL // No Named Events ); // Create a thread that waits for signaling gthreadint = CreateThread( NULL, // Security 0, // Default ThreadInt,// Interrupt Thread NULL, // No Parameters CREATE_SUSPENDED,// Suspended &dwthreadid // Thread Id); // Initilialize the Interrupt gsysinterruptnum = KernelIoControl( IOCTL_HAL_TRANSLATE_IRQ, &girqnum, sizeof(dword), &gsysintnum, sizeof(dword), NULL ); ISR All Higher Enabled Set Event All Except ID All Kernel HW InterruptInitialize( gsysintnum, // From Map gintevent, // Global Event NULL, // Not Used (DWORD)NULL // Not Used ) ) // Get the thread going ResumeThread( gthreadint );
IST IST ISR 1 ISR N ISR I D OAL DWORD WINAPI ThreadInt( LPVOID lpvparam ) { // The magic thread waits for the event. while( grun ) { // Wait until we have been signaled interrupt WaitForSingleObject( gintevent, INFINITE ); ISR All Higher Enabled Set Event All Except ID All Kernel HW // Increment the counter ginterruptcount ++; // Run your logic here } // Reset the interrupt InterruptDone( gsysintnum ); } return 0;
Shows interaction between processes, threads, and interrupts Track interrupts TLB misses Priority inversion Thread state such as running, blocked, sleeping, and migrating
Remote Tools: Call Profiler, Performance Monitor, Registry Editor, CeDebugX Zoomin, Remote Kernel Tracker App Dev VS 2005/2008 O/S Dev VS 2005 + PB Configure Build Download Debug (source) Test (CETK) Applications
DEPLOY AND DEBUG KERNEL SOURCE
Used in a range of interesting devices PND, Industrial Pig Slicers, IA, Robots, Portable Ultrasound, more Small footprint, real time, embedded operating system Multiple processor architectures supported Choice of development languages/frameworks Great Tools! Labs and Sessions at ESC Silicon Valley More information available at: http://msdn.microsoft.com/embedded
2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.