expert .net micro framework

448 784 0
expert  .net  micro  framework

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

this print for content only—size & color not accurate 7" x 9-1/4" / CASEBOUND / MALLOY (0.875 INCH BULK 448 pages 50# Thor) The eXPeRT’s VOIce ® In .neT Jens Kühner Expert .NET Micro Framework Embedded programming of microcontrollers with C# and Microsoft Visual Studio BOOks fOR PROfessIOnals By PROfessIOnals ® Expert .NET Micro Framework Dear Reader, The Microsoft .NET Micro Framework is a small and efficient .NET run- time environment used to run managed code on embedded devices that are too small and resource constrained for Windows CE and the .NET Compact Framework. As a .NET programmer of desktop and smart device applications, I have been enthusiastic for some time about programming embedded microcontrollers with everyday development tools and programming languages such as Microsoft Visual Studio and C#. Since I first saw the .NET Micro Framework presented at Microsoft’s Mobile and Embedded Developers Conference (MEDC), I have been an active beta tester and a regular contributor to the technology’s forums. My passion for this technology has motivated me to write this book for you, in which I provide all the resources you will need to program the .NET Micro Framework. I start by introducing you to the .NET Micro Framework and tools, presenting the available devices and touring the whole base class library. After that, I teach you how to use and write managed drivers to access the hardware components, how to use and provide web services on devices with the new Device Profile for Web Services (DPWS), and how to write applications with rich graphical user interfaces. We also explore the extensible emulator and emulator components. You’ll find many practical and reusable samples and tips throughout this book, so you’ll be able to create your own projects. Whether you are a .NET developer or a traditional embedded developer with a background in assembly language, C, or C++, I am confident that you will be impressed by the benefits that managed code and the .NET Micro Framework bring to embedded development. In this book, I provide you with a guide that enables you to get everything you possibly can from the .NET Micro Framework, so you can write powerful, effective, embedded applications of your own. Jens Kühner .NET Micro Framework Kühner cyan MaGenTa yellOW Black PanTOne 123 c ISBN-13: 978-1-59059-973-0 ISBN-10: 1-59059-973-X 9 781590 599730 9 0 0 0 0 Shelve in Programming/.NET User level: Advanced www.apress.com SOURCE CODE ONLINE Expert RELATED TITLES Companion eBook See last page for details on $10 eBook version Companion eBook Available www.it-ebooks.info www.it-ebooks.info Expert .NET Micro Framework ■■■ Jens Kühner Kuhner_973-XFRONT.fm Page i Thursday, March 27, 2008 4:06 PM www.it-ebooks.info Expert .NET Micro Framework Copyright © 2008 by Jens Kühner All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13: 978-1-59059-973-0 ISBN-10: 1-59059-973-X ISBN-13 (electronic): 978-1-4302-0608-8 ISBN-10 (electronic): 1-4302-0608-X Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Dominic Shakeshaft Technical Reviewer: Fabio Claudio Ferracchiati Editorial Board: Clay Andres, Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Matthew Moodie, Joseph Ottinger, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Richard Dal Porto Copy Editor: Heather Lang Associate Production Director: Kari Brooks-Copony Production Editor: Liz Berry Compositor: Susan Glinert Stevens Proofreader: Lisa Hamilton Indexer: Becky Hornyak Artist: April Milne Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http:// www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales—eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. You may need to answer questions pertaining to this book in order to successfully download the code. Kuhner_973-XFRONT.fm Page ii Thursday, March 27, 2008 4:06 PM www.it-ebooks.info To my wonderful son Marek and beautiful wife Iryna: you have added a wonderful new dimension to my life that I didn’t even know I was missing. Kuhner_973-XFRONT.fm Page iii Thursday, March 27, 2008 4:06 PM www.it-ebooks.info Kuhner_973-XFRONT.fm Page iv Thursday, March 27, 2008 4:06 PM 76a2626bcfb21763948a3d635f6fe985 www.it-ebooks.info v Contents at a Glance About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi ■CHAPTER 1 Introducing the .NET Micro Framework . . . . . . . . . . . . . . . . . . . . . . . . 1 ■CHAPTER 2 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 ■CHAPTER 3 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 ■CHAPTER 4 Introducing the .NET Micro Framework Base Class Library . . . . . 47 ■CHAPTER 5 Accessing Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 ■CHAPTER 6 Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 ■CHAPTER 7 Wireless Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 ■CHAPTER 8 Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 ■CHAPTER 9 Advanced .NET Micro Framework Programming . . . . . . . . . . . . . . 189 ■CHAPTER 10 Globalization and Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 ■CHAPTER 11 Graphics and Graphical User Interfaces . . . . . . . . . . . . . . . . . . . . . . 235 ■CHAPTER 12 Hardware Emulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 ■CHAPTER 13 Emulator Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 ■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 Kuhner_973-XFRONT.fm Page v Thursday, March 27, 2008 4:06 PM www.it-ebooks.info Kuhner_973-XFRONT.fm Page vi Thursday, March 27, 2008 4:06 PM www.it-ebooks.info vii Contents About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi ■CHAPTER 1 Introducing the .NET Micro Framework . . . . . . . . . . . . . . . . . . . 1 What Is the .NET Micro Framework? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 .NET Micro Framework History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Embedded Development in the Past. . . . . . . . . . . . . . . . . . . . . . . . . . . 3 A Different Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Benefits of Managed Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Where the .NET Micro Framework Fits. . . . . . . . . . . . . . . . . . . . . . . . . 5 What the Framework Is Not. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Licensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Benefits of the .NET Micro Framework . . . . . . . . . . . . . . . . . . . . . . . . 6 The .NET Micro Framework and Windows SideShow. . . . . . . . . . . . . 7 Technical Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Introducing the Bootable Runtime Environment . . . . . . . . . . . . . . . . . 9 Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Compiling for the .NET Micro Framework . . . . . . . . . . . . . . . . . . . . . 11 Target platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Platform Porting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Links for Further Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 ■CHAPTER 2 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Freescale i.MXS Development Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Device Solutions Meridian and Tahoe . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Meridian CPU. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Tahoe Development Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Digi International’s Embedded Development Products . . . . . . . . . . . . . . 19 Digi Connect ME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Digi ConnectCore 9P 9215 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Kuhner_973-XFRONT.fm Page vii Thursday, March 27, 2008 4:06 PM www.it-ebooks.info viii ■CONTENTS SJJ Embedded Micro Solutions Embedded Development Kit . . . . . . . . . 23 Crossbow Imote2.NET Edition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Multisensor Board. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Development Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Adeneo Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 PHYTEC phyCORE-LPC3180 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Atmel AT91SAM9261. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 GHI Electronics Embedded Master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 The Embedded Master Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Development Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 emtrion HiCO.ARM9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 The HiCO.ARM9-Core Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Development Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 ■CHAPTER 3 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Getting Your System Ready . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Installing the .NET Micro Framework SDK . . . . . . . . . . . . . . . . . . . . . 36 Using Visual Studio and the .NET Micro Framework . . . . . . . . . . . . . . . . 36 Creating a New Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Your First .NET Micro Framework Application. . . . . . . . . . . . . . . . . . 37 The Visual Studio Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Setting Project Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Building, Deploying, Executing, and Debugging . . . . . . . . . . . . . . . . 40 The .NET Micro Framework SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 File Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 The Base Class Library Runtime Assemblies . . . . . . . . . . . . . . . . . . 41 The MFDeploy Tool. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 The TFConvert Tool. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 ■CHAPTER 4 Introducing the .NET Micro Framework Base Class Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Text Output for Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Pausing Program Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Setting and Getting the System Time and Time Zone . . . . . . . . . . . . . . . 50 Using Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Kuhner_973-XFRONT.fm Page viii Thursday, March 27, 2008 4:06 PM www.it-ebooks.info [...]... NET Micro Framework T his chapter introduces the NET Micro Framework; we will discuss its history, motivation, goals, and architecture We will have a look at where the NET Micro Framework fits in the story of Microsoft’s offerings for embedded development, and you will learn about the benefits and limitations of the NET Micro Framework Finally, the chapter provides a technical overview of the NET Micro. .. Finally, the chapter provides a technical overview of the NET Micro Framework What Is the NET Micro Framework? The Microsoft NET Micro Framework is a small and efficient NET runtime environment used to run managed code on devices that are too small and resource constrained for Windows CE and the NET Compact Framework The NET Micro Framework enables you to write embedded applications for small, connected,... containing the NET Micro Framework, but the fee is lower than the one for Windows CE Also, you are not required to pay the fee directly When you buy readyto-use prebuilt modules or development boards containing the NET Micro Framework, the license fee has already been paid to Microsoft Benefits of the NET Micro Framework For embedded development, the advantages of the NET Micro Framework can be summarized... executing native code With the NET Micro Framework, all managed code will be interpreted There is no just-in-time compiler that compiles managed code parts to native machine code on the first execution as there is for the full NET Framework and NET Compact Framework Licensing The NET Micro Framework SDK is available for download at no cost To develop for the NET Micro Framework, you need Visual Studio... the processor to have a memory management unit (MMU) Therefore, the NET Micro Framework can run on small and inexpensive 32-bit processors without consuming a lot of power .NET Micro Framework History Let’s take a look at the history and versions of the NET Micro Framework: • Smart Personal Object Technology (SPOT) started at Microsoft Research in 2001 David Massarenti developed the first proof-of-concept... prototyping and debugging using the extensible emulator • Live debugging on devices The NET Micro Framework and Windows SideShow You often hear about Microsoft Windows SideShow together with the NET Micro Framework SideShow is an environment based on the NET Micro Framework that runs on devices containing the framework; it can get content from a host computer and display that content on small devices... manufacturers started shipping Windows SideShow-capable devices (see Figure 1-5) • Later in 2007, Service Pack 1 for the NET Micro Framework 2.0 was released • In February 2008, Microsoft released the NET Micro Framework 2.5 Figure 1-1 A smart watch Figure 1-2 A Sumo robot Figure 1-3 A NET Micro Framework development board (copyright of Freescale Semiconductor, Inc 2008, used by permission) www.it-ebooks.info... issues • Detecting design issues Where the NET Micro Framework Fits Now that we have discussed the benefits of managed code, let’s look at where the NET Micro Framework fits in the story of Microsoft’s offerings (see Figure 1-6) Windows XP, Windows XP Embedded, and Windows Vista support the full NET Framework, while Windows CE supports the NET Compact Framework There may be an overlap among the offerings,... Figure 1-6 Microsoft’s embedded offerings www.it-ebooks.info 5 Kuhner_973-XC01.fm Page 6 Wednesday, March 26, 2008 11:16 AM 6 CHAPTER 1 ■ INTRODUCING THE N ET M IC RO FRA MEWORK The NET Micro Framework is the smallest NET platform to date and provides only a subset of the full NET Framework and NET Compact Framework While Windows CE configurations supporting managed code with the.NET Compact Framework. .. which is written with the NET Micro Framework, shows the SCF content as well as supporting interaction, like menu navigation and responding to other user input The SideShow-enabled environment on the devices could theoretically be ported to platforms other than the NET Micro Framework However, no other port is available now, and the NET Micro Framework does the job well Microsoft provides a Windows . Thor) The eXPeRT s VOIce ® In .neT Jens Kühner Expert .NET Micro Framework Embedded programming of microcontrollers with C# and Microsoft Visual Studio BOOks fOR PROfessIOnals By PROfessIOnals ® Expert. Introducing the .NET Micro Framework . . . . . . . . . . . . . . . . . . . 1 What Is the .NET Micro Framework? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 .NET Micro Framework History. Studio BOOks fOR PROfessIOnals By PROfessIOnals ® Expert .NET Micro Framework Dear Reader, The Microsoft .NET Micro Framework is a small and efficient .NET run- time environment used to run managed code

Ngày đăng: 05/05/2014, 13:39

Từ khóa liên quan

Mục lục

  • Expert .NET Micro Framework

  • Contents at a Glance

  • Contents

  • About the Author

  • About the Technical Reviewer

  • Acknowledgments

  • Introduction

  • Introducing the .NET Micro Framework

    • What Is the .NET Micro Framework?

    • .NET Micro Framework History

    • Motivation

      • Embedded Development in the Past

      • A Different Approach

      • Benefits of Managed Code

      • Where the .NET Micro Framework Fits

      • What the Framework Is Not

      • Licensing

      • Benefits of the .NET Micro Framework

      • The .NET Micro Framework and Windows SideShow

      • Technical Overview

        • Introducing the Bootable Runtime Environment

        • Architecture

          • User Code Layer

          • Base Class Library Layer

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan