260 likes | 420 Views
Max Knor Developer Evangelist Microsoft Österreich. .NET MicroFramework. Embedded Development mit . NET oder „Small Is Beautiful “. Thin Clients. Windows Mobile Smartphone. Industrial Automation. ATMs / Kiosks. Windows Mobile Pocket PC Phone. Sensor Networks. Windows Automotive.
E N D
Max Knor Developer Evangelist Microsoft Österreich .NET MicroFramework Embedded Development mit .NET oder „Small Is Beautiful“
Thin Clients Windows Mobile Smartphone Industrial Automation ATMs / Kiosks Windows Mobile Pocket PC Phone Sensor Networks Windows Automotive Office Automation Retail Point-of-Sale Tablet PC AuxiliaryDisplays Portable Media Centre Medical Devices VoIP Phones Windows-based Terminals Mobile Handhelds Remote Controls Set-top Boxes Entertainment Devices Notebook PC Gateways Set-top Box WearableDevices .NET Micro Framework Windows XP Embedded Windows CE Windows Vista Functionality
Embedded Devices • Embedded Devices are tiny platforms • Remote Controls • Data loggers • Device Controllers • Single Purpose Device • The processor is there just to drive the device • High volume/ Low cost • No need for an operating System
Writing Embedded Code the „old“ way • C or C++ with low abstraction level • Different tools and device drivers • Debugging ?! • Emulation / Testing ?! • Reusability ?!
.NET Micro Framework • „.NET way of dev“ for Embedded Devices • Same language: C# • Managed environment • Familiar APIs • Visual Studio IDE • Hardware Emulators
What’s the .NET Micro Framework? • .NET on a “TINY Footprint” device • <400 KB of RAM • No memory management hardware • No Operating System • Applications run from Flash memory (EEPOM) • Subset of the full .NET Framework
Special in execution • C# codecompiledto MSIL code • MSIL codecompressedto .PE file (MetaDataProcessor.exe) • MSIL codegetsinterpretedatruntime • (NOT JIT compiled!) • Forcode: normal .NET assembly
Hardware Access • No strange bitmasks or control registers • .NET MF provides abstraction • Object Model with classes, events, …
Reading from a pin // Which pin to connect Cpu.Pin pin = Cpu.Pin.GPIO_Pin3; // Create a port connected to a pin InputPort port = new InputPort( pin, //CPU pin false, //no glitch filter Port.ResistorMode.PullUp //resistor mode is up ); // Read from the pin If (port.Read()) Debug.Print(“signal high”);
Switch on thelight demo
No Operating System ?! • .NET Micro Framework works without OS • Native execution using bootable runtime system
Runtime Features • Serialization • ~60% smaller than .NET Framework • Reflection • Remote Procedure Call (RPC) • Invoke methods on remote objects (.NET Micro Framework custom implementation ) • Security • XTEA (symmetric), RSA (asymmetric) • Exception handling • Delegates / multicast delegates • Typed Function pointers • Enables events dispatching and event driven programming vs. poll driven • Networking • Support for wired and wireless Ethernet • Sockets from System.Net namespace • Managed Drivers • C# implementations of GPIO, PWM, VTU32, I2C, SPI bus and USART
.NET Framework System.Web System.Windows.Forms • UI Controls • HTML • Web • Services • Description • Discovery • Protocols Design Component model System.Drawing Drawing 2D Printing Cache Security Imaging Text Configuration Session state System.Data System.XML XML Document Serialization ADO.NET SQL Client Xslt/XPath Reader/writers Design SQL ServerCE System Collections IO Configuration • Runtime • Interop • Remoting • Serialization Security Net Service process Text Reflection Diagnostics Globalization Resources Threading
.NET Compact Framework System.Web System.Windows.Forms • UI Controls • HTML • Web • Services • Description • Discovery • Protocols Design Component model System.Drawing Drawing 2D Printing Cache Security Imaging Text Configuration Session state System.Data System.XML XML Document Serialization ADO.NET SQL Client Xslt/XPath Reader/writers Design SQL ServerCE System Collections IO Configuration • Runtime • Interop • Remoting • Serialization Security Net Service process Text Reflection Diagnostics Globalization Resources Threading
.NET MicroFramework System.Web System.Windows.Forms • UI Controls • HTML • Web • Services • Description • Discovery • Protocols Design Component model System.Drawing Drawing 2D Printing Cache Security Imaging Text Configuration Session state System.Data System.XML XML Document Serialization ADO.NET SQL Client Xslt/XPath Reader/writers Design SQL ServerCE System Collections IO Configuration • Runtime • Interop • Remoting • Serialization Security Net Service process Text Reflection Diagnostics Globalization Resources Threading
Emulator Architecture Microsoft.SPOT.Emulator.dll EmulatorNative.dll Microsoft.SPOT.Hardware.pe Microsoft.SPOT.Native.pe EmulatorComponents Microsoft.SPOT.Graphics.pe x86 HAL / PAL SpiDevice SpiDevice MFApplication.pe SpiDevice GpioPort SpiDevice SpiDevice SpiDevice GpioPort TinyCLR (x86) ConfigurationEngine MyEmulator.exe UI my.config MyComponent
Versus Actual Hardware Microsoft.SPOT.Hardware.pe Microsoft.SPOT.Native.pe Microsoft.SPOT.Graphics.pe HAL / PAL MFApplication.pe TinyCLR
Graphical Display Facilities • Two levels of display provision • Simple bitmap support • Images, shapes, simple text rendering and wrapping • Windows Presentation Foundation • WPF based display elements • No XAML/Just Object Model
Persistent Storage • No file system for Micro Framework • Store information in memory using standard .NET objects and value types • Microsoft.SPOT.ExtendedWeakReference • Maintain data between sessions • Priority levels • ID value = “filename”
WPF UIPersistence demo
Code Challenges • Power Requirements • Only execute code when necessary • Reduce Thread.Sleep: use interrupts/events • Debugging and Performance Tuning • Debug.Print uses approx. 30ms of CPU time • Aggregate statistics • Subtract Debug.Print time
Summary • .NET Platform for Embedded Devices • No operating system necessary • Customizable Emulator Environment • WPF subset for LCD displays
© 2007 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.