NET MicroFramework - Microsoft Center

Max Knor
Developer Evangelist
Microsoft Österreich
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
Auxiliary
Displays
Portable Media Centre
VoIP Phones
Windows-based
Terminals
Medical Devices
Mobile
Handhelds
Remote Controls
Set-top Boxes
Gateways
Entertainment Devices
Set-top Box
Notebook PC
Wearable
Devices
.NET Micro
Framework
Windows CE
Functionality
Windows XP
Embedded
Windows Vista
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
C or C++ with low abstraction level
Different tools and device drivers
Debugging ?!
Emulation / Testing ?!
Reusability ?!
„.NET way of dev“ for Embedded Devices
Same language: C#
Managed environment
Familiar APIs
Visual Studio IDE
Hardware Emulators
.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
.NET Micro
Framework
Windows CE
Windows XP
Embedded
Windows Vista
Device
Features
Connected,
Connected,
Small, Wearable, Graphical UI,
Graphical UI
Server,
Browser, RAS
DirectX
PC Class
Performance,
PC Class
Networking
PC Class
Performance,
PC Class
Networking
Footprint
ARM 7, ARM 9,
No MMU, 250500KB,
Managed Code
X86, MIPS,
X86
SH4, ARM, with
MMU, 12 MB
Managed Code
X86 Dual Core,
64 Bit, Multi
Processor
Power
Very Low Power
Low Power
Mains
Mains
C# code compiled to MSIL code
MSIL code compressed to .PE file
(MetaDataProcessor.exe)
MSIL code gets interpreted at runtime
(NOT JIT compiled!)
For code: normal .NET assembly
No strange bitmasks or control registers
.NET MF provides abstraction
Object Model with classes, events, …
// 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”);
.NET Micro Framework works without OS
Native execution using bootable runtime
system
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
System.Web
Services
• Description
• Discovery
• Protocols
UI Controls
• HTML
• Web
Cache
Configuration
System.Windows.Forms
Design
Component
model
Security
Session state
System.Drawing
Drawing 2D
Imaging
Printing
Text
System.Data
ADO.NET
Design
SQL Client
SQL ServerCE
System.XML
XML Document
Xslt/XPath
Serialization
Reader/writers
System
Collections
Security
Text
Globalization
IO
Net
Reflection
Resources
Configuration
Service process
Diagnostics
Threading
Runtime
• Interop
• Remoting
• Serialization
System.Web
Services
• Description
• Discovery
• Protocols
UI Controls
• HTML
• Web
Cache
Configuration
System.Windows.Forms
Design
Component
model
Security
Session state
System.Drawing
Drawing 2D
Imaging
Printing
Text
System.Data
ADO.NET
Design
SQL Client
SQL ServerCE
System.XML
XML Document
Xslt/XPath
Serialization
Reader/writers
System
Collections
Security
Text
Globalization
IO
Net
Reflection
Resources
Configuration
Service process
Diagnostics
Threading
Runtime
• Interop
• Remoting
• Serialization
System.Web
Services
• Description
• Discovery
• Protocols
UI Controls
• HTML
• Web
Cache
Configuration
System.Windows.Forms
Design
Component
model
Security
Session state
System.Drawing
Drawing 2D
Imaging
Printing
Text
System.Data
ADO.NET
Design
SQL Client
SQL ServerCE
System.XML
XML Document
Xslt/XPath
Serialization
Reader/writers
System
Collections
Security
Text
Globalization
IO
Net
Reflection
Resources
Configuration
Service process
Diagnostics
Threading
Runtime
• Interop
• Remoting
• Serialization
Microsoft.SPOT.Emulator.dll
EmulatorNative.dll
Microsoft.SPOT.Hardware.pe
Microsoft.SPOT.Native.pe
EmulatorComponents
Microsoft.SPOT.Graphics.pe
Configuration
Engine
MyEmulator.exe
MyComponent
UI
my.config
MFApplication.pe
TinyCLR (x86)
x86 HAL / PAL
SpiDevice
SpiDevice
SpiDevice
GpioPort
SpiDevice
SpiDevice
SpiDevice
GpioPort
Microsoft.SPOT.Hardware.pe
Microsoft.SPOT.Native.pe
MFApplication.pe
TinyCLR
HAL / PAL
Microsoft.SPOT.Graphics.pe
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
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”
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
.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.