Max Knor Developer Evangelist Microsoft Österreich Embedded Development mit.NET oder „Small Is...

Post on 23-Dec-2015

216 views 0 download

Tags:

transcript

.NET MicroFramework

Max KnorDeveloper EvangelistMicrosoft Österreich

Embedded Development mit .NET oder „Small Is Beautiful“

Windows MobileSmartphone

Functionality

Windows Vista

Tablet PC

Windows MobilePocket PC Phone

.NET Micro Framework

Notebook PC

Windows Automotive

Portable Media Centre

VoIP Phones

MobileHandhelds

GatewaysSet-top Boxes

Medical DevicesWindows-based

Terminals

Thin Clients

Entertainment Devices

Retail Point-of-Sale

Office Automation

ATMs / Kiosks

Industrial Automatio

n

Set-top Box

WearableDevices

AuxiliaryDisplays

Remote Controls

Sensor Networks

Windows XP Embedded

Windows CE

Embedded Devices

Embedded Devices are tiny platformsRemote ControlsData loggersDevice ControllersSingle Purpose Device

The processor is there just to drive the device

High volume/ Low costNo need for an operating System

Writing Embedded Code the „old“ way

C or C++ with low abstraction levelDifferent tools and device driversDebugging ?!Emulation / Testing ?!Reusability ?!

.NET Micro Framework

„.NET way of dev“ for Embedded Devices

Same language: C#Managed environmentFamiliar APIsVisual Studio IDEHardware Emulators

What’s the .NET Micro Framework?

.NET on a “TINY Footprint” device<400 KB of RAMNo memory management hardwareNo Operating SystemApplications run from Flash memory (EEPOM)

Subset of the full .NET Framework

.NET Micro Framework Context

.NET Micro Framework

Windows CE Windows XP Embedded

Windows Vista

Device Features

Connected, Small, Wearable, Graphical UI

Connected, 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, 250-500KB, Managed Code

X86, MIPS, SH4, ARM, with MMU, 12 MB Managed Code

X86 X86 Dual Core, 64 Bit, Multi Processor

Power Very Low Power

Low Power Mains Mains

Special in execution

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

Hardware Access

No strange bitmasks or control registers

.NET MF provides abstraction

Object Model with classes, events, …

Reading from a pin

// Which pin to connectCpu.Pin pin = Cpu.Pin.GPIO_Pin3;

// Create a port connected to a pinInputPort port = new InputPort(

pin, //CPU pin false, //no glitch filter

Port.ResistorMode.PullUp //resistor mode is up);

// Read from the pinIf (port.Read())

Debug.Print(“signal high”);

Switch on the light

demo

No Operating System ?!

.NET Micro Framework works without OS

Native execution using bootable runtime system

.NET Micro Framework Architecture

Runtime Features

Serialization~60% smaller than .NET Framework

ReflectionRemote Procedure Call (RPC)

Invoke methods on remote objects (.NET Micro Framework custom implementation )

SecurityXTEA (symmetric), RSA (asymmetric)

Exception handlingDelegates / multicast delegates

Typed Function pointersEnables events dispatching and event driven programming vs. poll driven

NetworkingSupport for wired and wireless EthernetSockets from System.Net namespace

Managed DriversC# implementations of GPIO, PWM, VTU32, I2C, SPI bus and USART

.NET Framework

Services•Description•Discovery•Protocols

UI Controls•HTML•Web

Runtime• Interop•Remoting•Serialization

Design

ConfigurationCache

Session stateSecurity

ImagingDrawing 2D

TextPrinting

DesignADO.NET

SQL ServerCESQL Client

Xslt/XPathXML Document

Reader/writersSerialization

Service process

Configuration

ThreadingDiagnostics

Net

IO

ResourcesReflection

Security

Collections

GlobalizationText

Component model

System.Drawing

System.Windows.FormsSystem.Web

System.Data System.XML

System

.NET Compact Framework

Services•Description•Discovery•Protocols

UI Controls•HTML•Web

Runtime• Interop•Remoting•Serialization

Design

ConfigurationCache

Session stateSecurity

ImagingDrawing 2D

TextPrinting

DesignADO.NET

SQL ServerCESQL Client

Xslt/XPathXML Document

Reader/writersSerialization

Service process

Configuration

ThreadingDiagnostics

Net

IO

ResourcesReflection

Security

Collections

GlobalizationText

Component model

System.Drawing

System.Windows.FormsSystem.Web

System.Data System.XML

System

.NET Micro Framework

Services•Description•Discovery•Protocols

UI Controls•HTML•Web

Runtime• Interop•Remoting•Serialization

Design

ConfigurationCache

Session stateSecurity

ImagingDrawing 2D

TextPrinting

DesignADO.NET

SQL ServerCESQL Client

Xslt/XPathXML Document

Reader/writersSerialization

Service process

Configuration

ThreadingDiagnostics

Net

IO

ResourcesReflection

Security

Collections

GlobalizationText

Component model

System.Drawing

System.Windows.FormsSystem.Web

System.Data System.XML

System

Emulator Architecture

Microsoft.SPOT.Hardware.peMicrosoft.SPOT.Emulator.dll EmulatorNative.dllMicrosoft.SPOT.Native.pe

Microsoft.SPOT.Graphics.pe

MFApplication.pe

MyEmulator.exe UI

MyComponent

EmulatorComponentsSpiDeviceSpiDeviceSpiDeviceGpioPortSpiDeviceSpiDeviceSpiDeviceGpioPort

my.config

ConfigurationEngine

x86

HAL

/ PA

L

Tin

yCLR

(x86

)

Versus Actual Hardware

Microsoft.SPOT.Hardware.pe

Microsoft.SPOT.Native.pe

Microsoft.SPOT.Graphics.pe

MFApplication.pe

HAL

/ PA

L

Tiny

CLR

Device Emulator„SWITCH(!) on the light“

demo

Graphical Display Facilities

Two levels of display provisionSimple bitmap support

Images, shapes, simple text rendering and wrapping

Windows Presentation Foundation

WPF based display elementsNo XAML/Just Object Model

Persistent Storage

No file system for Micro FrameworkStore information in memory using standard .NET objects and value typesMicrosoft.SPOT.ExtendedWeakReference

Maintain data between sessionsPriority levels ID value = “filename”

WPF UIPersistence

demo

Code Challenges

Power RequirementsOnly execute code when necessaryReduce Thread.Sleep: use interrupts/events

Debugging and Performance TuningDebug.Print uses approx. 30ms of CPU time

Aggregate statisticsSubtract 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.