Download presentation
Presentation is loading. Please wait.
Published byGabriel Oliver Modified over 9 years ago
1
EMB427 Writing Real-Time Applications On Windows CE 5.0 Nat Frampton President Real Time Development Corporation nat@realtimeonline.com
3
M anagement T ools C ommunications & M essaging Device Update Agent Software Update Services Live Communications Server Exchange Server Internet Security and Acceleration Server Speech Server Image Update L ocation S ervices M ultimedia MapPoint DirectX Windows Media Visual Studio 2005 D evelopment T ools MFC 8.0, ATL 8.0 Win32 N ative M anaged S erver S ide L ightweight R elational SQL Server 2005 Express EditionEDB D ata P rogramming M odel D evice B uilding T ools D evice B uilding T ools H ardware/ D rivers Windows XP DDK Windows Embedded Studio Platform Builder OEM/IHV Supplied BSP (ARM, SH4, MIPS) OEM Hardware and Standard Drivers Standard PC Hardware and Drivers SQL Server 2005SQL Server 2005 Mobile Edition ASP.NET Mobile ControlsASP.NET.NET Compact Framework.NET Framework Microsoft Operations Manager Systems Management Server
4
Overview Interrupt architecture Deadlock thread strategy Debugging strategies Priority runner strategy Lessons learned
5
Kernel Interrupt Architecture HW All Higher Enabled All Except ID All OAL Thread ISR SetEvent ID ISR ISR 1 ISRN ISRLatency IST IST Latency
6
Interrupt Initialization // 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 ); InterruptInitialize( gSysIntNum, // From Map gIntEvent, // Global Event NULL, // Not Used (DWORD)NULL // Not Used ) ) // Get the thread going ResumeThread( gThreadInt ); // 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 ); InterruptInitialize( gSysIntNum, // From Map gIntEvent, // Global Event NULL, // Not Used (DWORD)NULL // Not Used ) ) // Get the thread going ResumeThread( gThreadInt ); Kernel HW All Higher Enabled All Except ID All OAL IST ISR SetEvent ID ISR ISR 1 ISR N IST
7
DWORDWINAPIThreadInt( LPVOID lpvParam ) { // The magic thread waits for the event. while( gRun ) { // Wait until we have been signaled interrupt WaitForSingleObject( gIntEvent, INFINITE ); // Increment the counter gInterruptCount ++; // Run your logic here // Reset the interrupt InterruptDone( gSysIntNum ); } return 0; } DWORDWINAPIThreadInt( LPVOID lpvParam ) { // The magic thread waits for the event. while( gRun ) { // Wait until we have been signaled interrupt WaitForSingleObject( gIntEvent, INFINITE ); // Increment the counter gInterruptCount ++; // Run your logic here // Reset the interrupt InterruptDone( gSysIntNum ); } return 0; } Kernel HW All Higher Enabled All Except ID All OAL IST ISR SetEvent ID ISR ISR 1 ISR N IST Interrupt Service Thread
8
Deadlock Thread Strategy High and Medium Priority Threads Cooperating through a Critical Section High Priority Thread waits for a time period reading the CPU Counter High Priority Thread Medium Priority Thread Critical Section Gets Critical Section Waits in a Loop Logs Ownership Releases Critical Section Gets Critical Section Logs Ownership Releases Critical Section
9
Debugging Strategies StrategyComments Application IDE Nice Integration and view of application data but not system Data Kernel Debugger Great system access; Requires OEM Integration into OS Printf Slow and limited to the ability to print output Firmware Debugger Great Hardware access but difficult application level information Hardware Debugger Last Resort when system is locked; Often necessary
10
Priority Runner Strategy Create a thread that runs priorities Push Button Start - LED Status Stops Blinking when it isn’t scheduled! Push Button LED Waits for Start Event Check if Reached Stop Priority Turns LED ON Waits 100 ms Turn LED OFF Increments and Sets Priority Sleeps 1 second Loop Sets Finished Event IST
11
Hardware
12
Lessons Learned IST – ISR Interrupt Model Coordination is through a OS Event Embedded Visual C++ provides complete hardware access CE 5.0 provides RTOS Environment Priorities/Quantums/Inversion Integrated Kernel Tracker and Debugger CE 5.0 supports many debug strategies
13
While at MEDC 2005… Fill out an evaluation for this session Randomly selected instant WIN prizes! Randomly selected instant WIN prizes! Use real technology in a lab Instructor led Reef E/F & Breakers L Self-paced Reef B/C Self-paced Reef B/C Visit the Microsoft Product Pavilion in the Exhibit Hall Shorelines B in the Exhibit Hall Shorelines B
14
After The Conference… Develop Build InstallBuildJoin Install Enter Enter Join Full-featured trial versions of Windows CE and/or Windows XP Embedded Cool stuff & tell us about it: msdn.microsoft.com/embedded/community msdn.microsoft.com/embedded/community Windows Embedded Partner Program: www.mswep.com www.mswep.com Windows Mobile 5.0 Eval Kit including Visual Studio 2005 Beta 2 Mobile2Market Contest and win up to $25000: mobile2marketcontest.com mobile2marketcontest.com Microsoft Solutions Partner Program: partner.microsoft.com partner.microsoft.com
15
Tools & Resources msdn.microsoft.com/ embedded microsoft.public. windowsxp.embedded windowsce.platbuilder windowsce.platbuilder windowsce.embedded.vc windowsce.embedded.vc blogs.msdn.com/ mikehall Windows CE 5.0 Eval Kit Windows XP Embedded Eval Kit msdn.microsoft.com/ mobility microsoft.public. pocketpc.developer smartphone.developer dotnet.framework.compactframework blogs.msdn.com/ windowsmobile vsdteam netcfteam Windows Mobile 5.0 Eval Kit Websites Newsgroups Blogs Tools Build Develop
16
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.