+ All Categories
Home > Documents > Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy...

Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy...

Date post: 02-May-2015
Category:
Upload: nero-giuliani
View: 216 times
Download: 2 times
Share this document with a friend
35
INTRODUZIONE A MICRO FRAMEWORK Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy [email protected] http://blogs.msdn.com/darioa http://blogs.msdn.com/darioait
Transcript
Page 1: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

INTRODUZIONE A MICRO FRAMEWORK

Smart Personal Objects Technology (SPOT)

Dario AiroldiDeveloper & Platform Evangelism Italy

[email protected]://blogs.msdn.com/darioa

http://blogs.msdn.com/darioait

Page 2: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

MissionFavorire la conoscenza e la diffusione delle tecnologie innovative, creare casi di utilizzo che rendano evidente il valore della piattaforma Microsoft.

Iniziative e attività: La redazione dei contenuti sul sito MSDN Italy. Newsletter e Webcast registrati Seminari e conferenze Incontri presso le aziende

http://www.microsoft.com/italy/msdn/contattaci/default.mspx

TEAM DEVELOPER & PLATFORM

Page 3: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Piccoli dispositivi elettronici controllati da microprocessori sono sempre più diffusi ma: Pochi tool ne supportano lo sviluppo Richiedono forti skill per fare cose semplici Sono realizzati con codice unmanaged

Microframework si propone per il mondo embedded come VB6 per lo sviluppo delle vecchie applicazioni desktop.

LA VISION DI MICRO FRAMEWORK

Page 4: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

POSIZIONAMENTO DI MICRO FRAMEWORK

MF è un .Net Runtime piccolo per processori embedded 32bit, economici e a basso consuno

Ha Memory footprint ridotto (~256K RAM) Non richiede Memory Management Unit

Permette lo sviluppo embedded con Visual Studio 2005

L’ambiente Include un emulatore completo e funzionale

Permette lo sviluppo con linguaggio C# e .Net framework

Esegue codice managed controllato e sicuro

Page 5: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

LE PIATTAFORME EMBEDDED DI MICROSOFT

Set-top boxes

Windows CE Windows XP Embedded

Windows Mobile Smartphone

Pocket PC Phone

WindowsAutomotive

Portable Media Center

VoIP phones

Mobile handhelds

Gateways

Retail Point-of-SaleWindows-based

Terminals

Medical devices Entertainment devices

.NET Micro Framework

Health Monitoring

Wearable Devices

Auxiliary Displays

Remote Controls

Sensor Networks

Page 6: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

LE PIATTAFORME EMBEDDED A CONFRONTO

  .NET Micro Framework Windows CE Windows XPe

Example Devices

Sensor Nodes, Aux displays, Health

Monitoring, Remote Controls, Robotics

GPS Handhelds, PDAs,Automotive, Set Top

BoxesThin Clients, ATMs, Kiosks

Features Connected, Small, Wearable, Graphical UI

Connected, Graphical UI, Server, Browser, RAS,

DirectX

PCclass performance,PC networking

Footprint250-500KB managed

codeFull featured

300KB+ without managed code

12MB with managed code

40MB + Depending on features

Power Very low power Low power Mains power

CPU ARM7, ARM9, No MMUX86, MIPS, SH4, ARM,

with MMUX86

Real-time Not Real-time Hard Real-timeReal-time capable through 3rd party

extensions

Managed vs. Native Code

Managed via .NET Micro Framework,

native code through interop only.

Supports both,managed code

requires .NET Compact Framework

Supports both, managed code

requires .NET Framework

Page 7: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

UN PO’ DI STORIA2001 •Nasce Smart Personal Object Technology (SPOT)

•Nasce TinyCLR per supportare SPOT.

2004 •Escono gli SmartWatches con MSN Direct

2005 •Rilasciata Microsoft TV

2006 •Sumo Robot Kit alla Microsoft Mobile Embedded DevCon (MEDC)

2007 •Windows Vista Side Show

Page 8: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Microframework è: Bootable

Può eseguire boot autonomamente Può essere ospitato su sistemi operativi esistenti

Safe L’accesso alle risorse avviene tramite oggetti

Secure Utilizza assemblies firmati

Extensible A livello software ed Hardware

Portable Il Porting Kit permette di portarlo su HW non supportato

CARATTERISTICHE DI MICRO FRAMEWORK

Page 9: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

RUNTIME FEATURES

Runtime grafico Windows Presentation Foundation (WPF): Graphics primitives BMP and JPG image support Text manipulation Unified Programming model covering All devices

Runtime engine: Thread support Garbage collection Globalized language support

Funzioni di interazione con l’hardware Managed drivers for LCDs Universal Asynchronous Receiver/Transmitter (USART) I2C™ General-purpose I/O (GPIO) Pulse-Width modulation (PWM)

Page 10: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

TOOL DI SVILUPPO Microsoft Visual Studio 2005

Project System/templates PostBuild processing Intellisense support Deployment to device (seriale, usb o

emulatore) Debugging interattivo dall’IDE

(Breakpoints, tracing, variable inspection)

Device Emulator Personalizzabile per simulare la

configurazione delle periferiche

Page 11: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

SCHEMA ARCHITETTURALE

Page 12: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Come bootable runtime supporta: ARM7TDMI @ 27MHz (384K RAM, 1M Flash) ARM7TDMI @ 50MHz (4M RAM, 2M Flash) ARM920T @ 96MHz (4M RAM, 2M Flash) ARM Cortex M3 Motorola 68K (implementazioni custom) …

Come hosted runtime supporta: Dual ARM7TDMI @100Mhz (32M RAM, 1G Flash)

NetOS/ThreadX per CONNECTME , WinCE Intel x86

Windows XP …

Il Porting a nuovi devices: Porting to new HW richiede 80-100 APIs Porting to new Platform richiede 20-40 APIs

PIATTAFORME SUPPORTATE

Page 13: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Web Site: “www.aboutnetmf.com”

Slide 13

ATTENDING PARTNERS

Page 14: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .
Page 15: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Create a new application and the graphical componentsDEMO: TRIPCOMPUTER SAMPLE

Page 16: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

FRAMEWORK .NETSystem.web System.Windows.Forms

System.Drawing

System.XmlSystem.Data

System

Services• Description• Discovery• protocol

UI• HTML Controls• Web Controls

Cache

Configuration

Security

Session State

Design Component Model

Drawing 2D

Imaging

Printing

Text

ADO.Net

Design

SQL Client

SQL Server CE

XML Document

XslT/XPath

Serialization

Reader/Writers

Collections

Security

Text

Globalization

IO

Net

Reflection

Resources

Configuration

Service process

Diagnostics

Threading

Runtime• Interop Services• Remoting• Serialization

Page 17: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

COMPACT FRAMEWORKSystem.web System.Windows.Forms

System.Drawing

System.XmlSystem.Data

System

Services• Description• Discovery• protocol

UI• HTML Controls• Web Controls

Cache

Configuration

Security

Session State

Design Component Model

Drawing 2D

Imaging

Printing

Text

ADO.Net

Design

SQL Client

SQL Server CE

XML Document

XslT/XPath

Serialization

Reader/Writers

Collections

Security

Text

Globalization

IO

Net

Reflection

Resources

Configuration

Service process

Diagnostics

Threading

Runtime• Interop Services• Remoting• Serialization

Page 18: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

MICRO FRAMEWORKSystem.web System.Windows.Forms

System.Drawing

System.XmlSystem.Data

System

Services• Description• Discovery• protocol

UI• HTML Controls• Web Controls

Cache

Configuration

Security

Session State

Design Component Model

Drawing 2D

Imaging

Printing

Text

ADO.Net

Design

SQL Client

SQL Server CE

XML Document

XslT/XPath

Serialization

Reader/Writers

Collections

Security

Text

Globalization

IO

Net

Reflection

Resources

Configuration

Service process

Diagnostics

Threading

Runtime• Interop Services• Remoting• Serialization

Page 19: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Implementa un sottoinsieme delle core libraries

Permette diversi linguaggi di programmazione Rispetta Common Language Specification (CLS) Derivato da Common Language Infrastructure

(CLI) v1.0

Supporta Common Intermediate Language (CIL) Execution.

MICRO FRAMEWORK È UNA IMPLEMENTAZIONE .NET!

Page 20: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Serialization: Implementazione specifica per mf 60% più efficiente in spazio rispetto a .Net Framework

Remote Procedure Call (RPC) Implementazione specifica per mf Permette di invocare metodi su oggetti remoti

Encryption: Supporta RSA algorithm (Asymmetrico) tramite la classe Key_RSA. supporta Extedned Tiny Encryption Algorithm (XTEA, symmetric)

tramite la classe Key_TinyEncryptionAlgorithm. Permette algoritmi custom derivando dalla classe Key.

Delegates: permette programmazione ad eventi invece che per polling.

Exception handling Reflection

NOTE SULLA IMPLEMENTAZIONE DEL RUNTIME

Page 21: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

RUNTIME FEATURES – DETTAGLIO

Funzioni disponibili includono:

•Numeric types, class types, value types, arrays (one-dimensional only), delegates, events, references, and weak references •Synchronization, threads, and timers •Reflection •Serialization•Garbage collection •Exception handling •Time classes, including DateTime and TimeSpan (using INT64 arithmetic) •Time-sliced thread management

Funzioni progettate per

microframework:•Execution constraints that limit call durations and prevent failures. •Strings represented internally as UTF-8 and exposed as Unicode. •A global, shared string table for well-known values (types, methods, and fields) that reduces RAM and ROM and reduces the number of cross-references among assemblies. •method resolution no virtual tables. •A WeakDelegate class to handle dangling references to delegates. •Support for extending the hardware chipset by programming its drivers directly in C#, using the Managed Drivers Framework. Hardware devices compatible with industry communication standards — such as GPIO, serial, SPI, or I2C — can be added to the chipset and used by a managed C# application.

Page 22: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

DEMO THE TRIPCOMPUTER SAMPLEAdd the clock and other trip control features to the

TripComputer

Page 23: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Object model Basato su Windows Presentation foundation (WPF) Supporta routed events e context

properties Supporta layout system (content

sizing, text flow, nested controls) Supporta bitmap fonts Gestisce Images Gestisce Pens, brushes, colors Gestisce Vector primitives Gestisce Alpha blending

RUNTIME GRAFICO

Page 24: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Permette il boot del runtime Permette una astrazione delle risorse Gestisce gli interrupts Supporta asynchronous cooperative

multi-tasking. È realizzato tramite queued Workitems È compatto (Occupa 40K inclusi i base drivers)

HARDWARE ABSTRACTION LAYER

Page 25: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Assembly loader esegue validazione al caricamento degli

assemblies. registra i tipi con il type system (in tabella globale

dei tipi) Microsoft Intermediate Language (MSIL)

interpreter Supporta TUTTE le msil instructions (tranne le

istruzioni unsafe) È ottimizzato per minimizzare la latenza Permette esecuzione “virtuale pura”

LOADER ED INTERPRETER

Page 26: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Execution engine: No native thread scheduler Manages native work queues Invokes native code Permette non traditional interoperability

Garbage collector Non incremental Mark and Sweep. Colleziona 50ms per 1M, variabile a seconda del numero di

oggetti Supporto per storage non volatile. dispone di un meccanismo di persistenza di oggetti

EXECUTION ENGINE AND GARBAGE COLLECTOR

Page 27: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

ROM/Flash footprint Runtime: ~120K Runtime + framework minimale: ~250K Runtime + framework completo: ~500K

RAM requirements ~70K system overhead ~256K per full-featured application

MICRO FRAMEWORK FOOTPRINT

Page 28: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Permette di gestire da codice managed (Managed drivers): General-purpose I/O (GPIO) pins Serial peripheral interface (SPI) bus Serial ports Universal Asynchronous Receiver/Transmitter (USART) I2C™ Pulse-Width modulation (PWM)

GPIO Interrupts sono dispatched alla applicazione managed in forma di eventi.

DEVICE ESTERNI

Page 29: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

QUALI DEVICE SI POSSONO GESTIRE?

External device Protocol to communicate API to control

Bottoni GPIO Microsft.SPOT.Hardware.InterruptPort (o Port family e classi drivate in generale)

Potenziometri/Attuatori GPIO (PWM non e’ disponibile al momento)

Microsft.SPOT.Hardware.InterruptPort (o Port family e classi drivate in generale)

Accelerometri SPI o I2C (tipicamente)

Microsft.SPOT.Hardware.SPI e Microsft.SPOT.Hardware.I2CDevice

Outputs booleani (backlight, vibrator)

GPIO Microsoft.SPOT.hardware.Backlight o Microsoft.SPT.Hardware.OutputPort

Monochrome LCD SPI o I2C o driver nativo (tipicamente)

Microsft.SPOT.Hardware.SPI e Microsft.SPOT.Hardware.I2Cdevice.  LCD (display) API (LCD_BitBlt e LCD_BitBltEx)

OEM-specific (heart rate monitor, air pressure sensor,

touch screen)

SPI o I2C o Seriale(Tipicamente, Dipende dal device)

Microsft.SPOT.Hardware.SPI, Microsft.SPOT.Hardware.I2Cdevice e Microsft.SPOT.Hardware.SerialPort

Battery monitoring Battery API Microsft.SPOT.Hardware.Battery e Battery and Charger HAL API

Flash memoryMicrosoft.SPOT.ExtendedWeakReferences Microsoft.SPOT.Logging (solo per debug)HAL FLASH API

Bluetooth Seriale o SPI(dipende dal controllore, vedi Promi-SD o BlueCore)

Microsoft.SPOT.hardware.SerialPort o Microsoft.SPOT.Hardware.SPI

802.15.4 SPI (Tipicamente, vedi Ember or Chipcon CC2420)

Microsoft.SPOT.Hardware.SPI

EEPROM memory Unsupported Legacy n/a

Calibrated accurate time Dell’apposito codice e’ provvisto nel porting kit ma deve essere abilitato manualmente

Page 30: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

CODICE DI UN MANAGED DRIVER

using System.Threading; using Microsoft.SPOT.Hardware;

…InterruptPort myButton = new InterruptPort(

(Cpu.Pin)12, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow

);

MyButton.OnInterrupt +=new GPIOInterruptEventHandler( this.MyInterruptHandler );

…}

public void MyInterruptHandler(Cpu.Pin id, bool edge, TimeSpan time) { // handle the interrupt event here}

Page 31: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

L’emulatore è una windows application che esegue codice micro framework

Una collezione di classi che permette di comporre epersonalizzare l’emulatore

Un file di configurazione (XML) che permette di configurare ed inizializzare tutti i componenti

EMULATORE

Page 32: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Windows application che esegue codice Micro Framework

Una collezione di classi permette di comporre e personalizzare i componenti da emulare

Un file di configurazione (XML) permette di configurare ed inizializzare tutti i componenti

ARCHITETTURA DELL’EMULATORE

Page 33: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

DEMO THE TRIPCOMPUTER SAMPLECustomize the emulator to simulate buttons and IO on the

TripComputer

Page 34: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Sito microframework: http://msdn.microsoft.com/embedded/netmf.

Sito embedded development: http://msdn2.microsoft.com/embedded.

Sito per download http://www.microsoft.com/downloads.

Webcasts• http://Www.microsoft.com/Webcasts • http://www.microsoft.com/italy/eventi/webcast/

MAGGIORI INFORMAZIONI

Page 35: Smart Personal Objects Technology (SPOT) Dario Airoldi Developer & Platform Evangelism Italy darioa@microsoft.com  .

Recommended