Download presentation
Presentation is loading. Please wait.
Published byHilda Todd Modified over 9 years ago
1
EMB422 Advanced Embedded Visual C++ Application Development Control - View Nat Frampton President Real Time Development 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
Goal Develop Control Application View Application LeverageeVC++MFCWin32Observe Real Time Practices
5
Overview Native vs..NET Compact Framework SDK Creation Application Architecture Win32 Application Development MFC Application Development
6
Windows CE 5.0 Tools Operating System Development Windows CE 5.0 Platform Builder Application Development Windows CE 5.0 Platform Builder eMbedded Visual C++ Visual Studio.NET Smart Device Extensions
7
Windows CE 5.0 Application Development eMbedded Visual C++ 4.0 SP4 Native Code Win32, MFC, ATL Visual Studio.NET 2003 Managed Code C#, Visual Basic.NET
8
Framework Sizes Win32MFC.NETFramework Windows XP Embedded --- 1.25 MB 34 MB Windows CE.NET --- 280 KB 1.5 MB Windows CE 5.0 OLECE400.DLL ~ 200 KB Windows XP Embedded ASP.NET ~ 1.5 MB
9
Framework - Strengths APIStrengths Microsoft Win32 (C / C++) Smallest and fastest.exe files and DLLs Smallest and fastest.exe files and DLLs Lowest memory overhead Lowest memory overhead Required for device drivers, control panel applets, shell extensions Required for device drivers, control panel applets, shell extensions No runtime required; Windows CE 5.0 is the runtime No runtime required; Windows CE 5.0 is the runtime MFC(C++) Object-oriented. Inheritance, Encapsulation, Polymorphism, also called.function overloading Container classes support arrays, lists, object maps and simplify data handling Type safety Complete MFC source code ships with Embedded Visual Tools Good tool support & wizards.NET Framework (C# and Microsoft Visual Basic®.NET) Well-designed programming interface Object-oriented. Inheritance, Encapsulation, Polymorphism, also called function overloading Container classes support arrays, lists, hashtables, dictionaries, and stacks Type safety Namespaces Automatic garbage collection eliminates memory leaks Portable machine instruction set, MSIL / CIL, provides binary portable of executable (.exe &.dll) files Web service clients are quick and easy to write Great support for handling XML Great tool support — Forms Designer
10
Framework - Weaknesses APIWeaknesses Microsoft Win32 (C / C++) Object cleanup is the responsibility of the application/driver programmer, making this API prone to memory leaks Low-level API — can be hard to learn Procedure-oriented API, not object-oriented MFC (C++) Object cleanup only semi-automatic, therefore less prone to memory leaks than Win32, but still somewhat vulnerable since MFC is thin wrapper on top of Win32 Size of runtime ~ 500 KB (MFC & OLECE).NET Framework (C# and Microsoft Visual Basic®.NET) Size of runtime ~ 1.5 MB Overhead of calls between managed and unmanaged code is high COM Interoperability somewhat clumsy. Requires writing Win32 wrappers that call the COM interface functions Source code is not available Requires display based platform
11
.NET Compact Framework Lightweight version of.NET Framework Designed for resource-constrained devices Compatible with VS.NET, C#, VB.NET Runs applications securely on-device High performance JIT compiler Guarantees robustness and security Highly interactive, offline, and networked experiences Makes it easy to consume web services Tunable size and performance
12
.NET Compact Framework System System.DataSystem.Xml System.Web Globalization Text Security Collections Resources Reflection Net IO Threading Diagnostics ServiceProcess Configuration Design ADO.NET SqlServerCe SqlClient Xslt/XPath XmlDocument Runtime InteropServices Remoting Serialization Serialization ConfigurationSessionState CachingSecurity Services Description Discovery Protocols UI HtmlControls WebControls System.Drawing Imaging Drawing2D Text Printing System.WinForms DesignComponentModel Reader/Writers
13
SDK Creation Encapsulation Mechanism ContainsCompiler Component Documentation OEM Help, Docs and Libraries Understand the target user Application Only? Device Driver? Real Time Applications?
14
Application Architecture
15
Finished Event Synchronization Strategy DemoMemory Copy Event 1 2 4 5 3
16
Control Thread IST Control Architecture Push Button LED Checks for Button up Inc Button Flashes the LED Interrupt Done IST Checks for Finished Flag Increments the Bin Count Calcs the Bin Stats Check for Copy Request Event Copies Data to Shared Memory Sets the Copy Finished Event Sleeps 5 ms Loop Finished Event DemoMemory Copy Event
17
Hardware
18
DemoControl.exe A Win32 App
19
Kernel Interrupt Architecture HW All Higher Enabled All Except ID All OAL Thread ISR SetEvent ID ISR ISR 1 ISR N ISRLatency IST IST Latency
20
Windows CE 5.0 Priority Map PriorityComponent 0-19 Open – Real Time Above Drivers 20 Permedia Vertical Retrace 21-89 Open – Real Time Above Drivers 99 Power management Resume Thread 100-108 USB OHCI UHCI, Serial 109-129 Irsir1, NDIS, Touch 130KITL 131VMini 132CxPort 133-144 Open – Device Drivers 145 PS2 Keyboard 146-147 Open – Device Drivers 148IRComm 149 150TAPI 151-152 153-247 Open – Real Time Below Drivers 248 Power Management 249 WaveDev, TVIA5000,Mouse,PnP,Power 250WaveAPI 251 Power Manager Battery Thread 252-257Open
21
Interrupt Initialization // Create the Event gIntEvent= CreateEvent(NULL,// NULL FALSE,// Manual reset FALSE,// Init as not signaled NULL// No Named Events ); // Create a thread that waits for signaling gThreadInt= CreateThread(NULL,// NULL 0, // No Stack Size 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,// NULL FALSE,// Manual reset FALSE,// Init as not signaled NULL// No Named Events ); // Create a thread that waits for signaling gThreadInt= CreateThread(NULL,// NULL 0, // No Stack Size 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 );
22
Interrupt Service Thread DWORDWINAPIThreadInt( LPVOID lpvParam ) { // The magic thread waits for the event. while( gRun ) { // Wait until we have been signaled that there is an interrupt WaitForSingleObject( gIntEvent, INFINITE ); // Increment the counter gInterruptCount ++; // Run your logic here // Reset the interrupt so we can get another one InterruptDone( gSysIntNum ); } return 0; } DWORDWINAPIThreadInt( LPVOID lpvParam ) { // The magic thread waits for the event. while( gRun ) { // Wait until we have been signaled that there is an interrupt WaitForSingleObject( gIntEvent, INFINITE ); // Increment the counter gInterruptCount ++; // Run your logic here // Reset the interrupt so we can get another one InterruptDone( gSysIntNum ); } return 0; }
23
DemoView.exe a MFC App
24
Review Native and.NET CFW applications both have their place Complex Applications can be rapidly Development in Embedded Visual C++ Windows CE provides a rich real-time environment for a variety of application architectures Embedded Visual C++ is now your most powerful tool!
25
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
26
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
27
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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.