Presentation is loading. Please wait.

Presentation is loading. Please wait.

Douglas Boling President Boling Consulting Inc. WEM201.

Similar presentations


Presentation on theme: "Douglas Boling President Boling Consulting Inc. WEM201."— Presentation transcript:

1

2 Douglas Boling President Boling Consulting Inc. WEM201

3 About Douglas Boling Independent consultant specializing in Windows Mobile and Windows Embedded CE On-site instruction Consulting and development Author Programming Embedded Windows CE Fourth Edition Regular speaker at industry conferences

4 Agenda Introduction to Windows Embedded CE Performance issues Development strategies

5 Rule #1: Write Good Code! “Desktop developers are paid to quickly write code.” “Embedded developers are paid to write quick code.”

6 Agenda Introduction to Windows Embedded CE Performance issues Development strategies

7 What is Windows Embedded CE? New kernel Not a “small XP/Vista/7” kernel Componentized The OS can change Unique Hardware Different CPUs Not WinTel

8 “But It Works On The Desktop!” Windows Embedded CE is written to the specification of Win32, not the implementation Often desktop code works in places it shouldn’t Read the docs; if it’s not guaranteed to work it probably won’t Driver and Services model completely different The CE driver/services model is much simpler

9 Memory Issues Check your memory allocations Memory allocations will fail No paging file Tolerate low memory conditions Expect fragmentation Applications can run for weeks or months

10 Security Issues The current versions of Windows Embedded CE don’t use ACLs If security is needed Module load security can be implemented Modules (.DLLs/.EXEs) are checked on first load Can be prevented from loaded by OEM code Vetting implementation dependent, typically embedded certificates

11 Porting to Unicode Windows CE apps are Unicode (UTF16) ANSI only supported in the C runtime libs Unicode characters are 16 bits string length + 1 != buffer size Know what the function wants Port to Unicode on desktop first Allows use of better debug tools

12 Agenda Introduction to Windows Embedded CE Performance issues Development strategies

13 Performance Fundamentals Embedded hardware is slow It’s designed that way intentionally Slower hardware means Smaller Better battery life Cooler (temperature wise) Less expensive

14 Embedded Performance Software performance impacts hardware design Users expect a level of performance With slow software, hardware has to be made faster “It’s okay, just wait a year and the hardware will catch up!”

15 Moore’s Law Will Save Us… …Wrong! What does Moore’s law say? It’s not that CPUs double in speed every 2 years…

16 Moore’s Law Is Different… Moore’s law states that transistor counts will double every 2 years… PCs Transistors are added to improve performance Embedded Transistor count increases much slower, with the extra efficiency going to power and component cost

17 Speed Limiters Devices are “bus limited” Performance of device limited by memory bandwidth Embedded CPUs fast in the core Computation ability fairly good Typically, no floating point Except x86 and some ARM

18 General Performance Tips Copy pointers, not memory Copying memory is quite slow Use DMA where possible Developers need to know the hardware Performance issues on specific busses Cache size vs. locality issues If you have lots of RAM, use it

19 Don’t Be Wasteful Know your “expensive” calls Avoid multiple calls Expensive calls Database Volume load Named Handle creation Opening and closing registry keys Don’t create needless DLLs

20 General Tips Most systems have very slow video systems Some don’t The disk is slow Flash performs differently from disk drives Think “Chunky” not “Chatty” A few big calls vs. lots of little ones

21 Performance Is a Safety Issue! Every second the user is waiting is a second they’re not aware of their environment Working Walking Driving Performance is a required feature Design in performance Test for performance

22 Agenda Introduction to Windows Embedded CE Performance issues Development strategies

23 Develop On Target Hardware Don’t develop code on PCs or Virtual PCs They are far too fast Embedded systems are slow Developers need the instant feedback of knowing their code is too slow Otherwise code is too big and slow for final hardware

24 Leaks… …are deadly on embedded systems Application Verifier can detect Memory leaks GDI Object leaks Handle leaks Sometimes you need to extend App Verifier Write your own “shims”

25 Defensive Programming All entry points to modules should verify parameters Never let an exception leave a module Use __try __except blocks to vet pointers Vet parameters before starting new threads

26 Provide a Logging Service Embedded devices typically run unattended Often in remote or restricted areas Collect data Driver loads/unloads Process starts/terminations Log thread start entry points and thread IDs Necessary for matching exception info with threads

27 Use “Windows Embedded CE Error Reporting” This is “Dr. Watson” Exceptions produce dump files Dump files can be opened in Platform Builder kernel debugger Great for finding intermittent problems

28 Managed Code.NET Compact Framework a great “Small.NET” Supports C# and VB.NET languages only Base Class Library significantly smaller Great client support Very little server support CF runtime tuned for small memory systems This may not match your system profile

29 Managed Code Tips IDisposable Classes that hold system resources must be disposable Dispose, dispose, dispose!!! Avoid unnecessary boxing Templates vs. generic collections Take care with parameter passing

30 Managed Code Tips Garbage Don’t generate it! Take care with… Strings Generic collections Classes where structures will do Realtime routines must be implemented in native code GCs happen at the worst possible times

31 COM – Just Say No The Component Object Model is bad Its overly complex Its hard to use Windows Embeded CE avoided the COM curse for the most part Don’t start now! Use.NET CF for reusable objects

32 MFC – Don’t Do It MFC is great for writing Word Is that what you’re doing? Often MFC used for CString The rest of the time is spent overriding the default functionality of MFC Use.NET CF for Forms based apps

33 Testing Do it… NOW! Test early Test every day Track results If you wait, your customers will too

34 Summary Your current Windows knowledge valuable Same API, just different The difference is attitude YOU are responsible for performance not the HW Respect the hardware Its designed that way for a reason

35 www.microsoft.com/teched Sessions On-Demand & Community http://microsoft.com/technet Resources for IT Professionals http://microsoft.com/msdn Resources for Developers www.microsoft.com/learning Microsoft Certification and Training Resources www.microsoft.com/learning Microsoft Certification & Training Resources Resources

36 Complete an evaluation on CommNet and enter to win!

37 © 2009 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. Required Slide


Download ppt "Douglas Boling President Boling Consulting Inc. WEM201."

Similar presentations


Ads by Google