Get Started with Microsoft .Net Micro Framework

Introduction

The .NET Micro Framework is an innovative development and execution environment for resource-constrained devices . The typical .NET Micro Framework device has a 32 bit processor with no external memory management unit (MMU) and could have as little as 64K of random-access memory (RAM).

Architecture

The .NET Micro Framework architecture is highly optimized for small devices and makes it possible for you to use Microsoft Visual Studio® and C# to program embedded systems. It uses a layered architecture that is designed to be extremely flexible and highly adaptable to new hardware platforms.

The following diagram shows the .NET Micro Framework hardware and software architecture.

dotnetMFArch

Hardware Layer

The hardware layer contains the microprocessor and other circuitry that you select for your hardware platform. Currently, the .NET Micro Framework runs on several processors based on the ARM7, ARM9, Cortex, XScale, ARC, and ADI Blackfin architectures. However, the ARC version of the porting kit is available only upon request.

It is possible to port the framework so that it runs on top of an operating system. Of course, the hardware is still there. However, the framework no longer communicates with it directly. Instead, it uses the services provided by the operating system. In fact, this is how the emulator that ships with the .NET Micro Framework Platform SDK works. The emulator is nothing more than a port of the framework onto Windows.

Runtime Component Layer

The runtime component layer (RCL) includes three components: the .NET Micro Framework common language runtime (CLR), a hardware abstraction layer (HAL), and a platform abstraction layer (PAL). In .NET Micro Framework terminology, this layer is referred to as the "firmware" for a device.

CLR

The .NET Micro Framework CLR is a subset of the .NET Framework CLR, which is the run-time environment provided by the .NET Framework. The primary difference is that the .NET Micro Framework CLR is redesigned from scratch to target small embedded devices.

The porting kit provides you with the CLR source code. The CLR source code is an hardware-independent library that can be compiled for several architectures and through several compilers using the porting kit.

HAL and PAL

The CLR communicates with the underlying hardware through the HAL and the PAL. Both the HAL and the PAL consist of groups of C++ driver functions called by the CLR. As you might expect, the HAL functions are extremely hardware-dependent. The PAL functions, on the other hand, are designed to be independent of the hardware.

Note: The HAL and PAL driver functions are also referred to as "primitives" in the HAL and PAL source code.

Many of the drivers form pairs. That is, the PAL and the HAL each contain a driver, and these two drivers must be used together to accomplish a particular task. In such cases, the CLR calls the PAL driver, which in turn uses the HAL driver to access the hardware.

The bootstrap code is an additional piece of code that is associated with the HAL. The bootstrap code initializes the low-level hardware when the device is turned on. It then starts the CLR, which performs the higher-level initializations. The bootstrap code performs its tasks through calls to the HAL and assembly-language routines. Other than starting the CLR, it has no interaction with the code preceding it in the software architecture.

Also, the HAL contains configuration information in the form of chip support packages (CSPs) and board support packages (BSPs). CSP files define configuration information for a particular chip. This includes complex configurations such as a CSP for a system-on-a-chip (SoC), or simpler configurations for peripheral devices like a pulse width modulation (PWM) device. Board support packages (BSPs) contain configuration information for an entire hardware platform, such as a development board.

Class Library Layer

The class library included with the .NET Micro Framework is an object-oriented collection of reusable types that developers use to write embedded applications. It is possible for 3rd-party developers to provide additional classes in their versions of the .NET Micro Framework. For example, development board manufacturers can add class libraries for peripheral devices that their boards support.

Application Layer

The top layer of the .NET Micro Framework contains managed applications that you create for your devices. The types of applications you develop depend entirely on the hardware in your device. C# is currently the only language supported for managed applications.

Technically speaking, any embedded software can be called firmware. However, in .NET Micro Framework terminology, your applications are not called firmware. The term "firmware" is used to refer to the contents of the runtime component layer of the .NET Micro Framework.

Features

  1. HTTP and HTTPs: An object model is now provided for handing both HTTP clients and servers, similar to the .NET Framework, with the new types System.Net.HttpWebRequest, System.Net.HttpWebResponse, and System.Net.HttpListener from assembly System.Http.dll
  2. Multi-touch: Basic support for multi-touch events, such as moving two fingers on a touch screen, is now provided in the object model and the emulator. Gesture support has been redesigned to be faster and more flexible.
  3. Versioning: Versioning has been implemented to strictly identify assemblies by the version number at build time and on the device, and eventually re-deploying missing assemblies. Side-by-side load and bind for types belonging to the same assemblies with a different version number is supported. Support has also been added for assembly naming which includes the version number.
  4. Emulator support for SSL and HTTPS: The emulator now explicitly supports SSL and HTTPs emulation.
  5. Native XML Parser: The XML parser has been moved to native code for better performance.
  6. Native collections: The collection classes have been moved to native code for performance, and have been enriched with Queue and Stack types.
  7. Time sync: Devices can use the new Time Sync API to sync the system time with a specified server's time, automatically or manually.
  8. Arbitrary display size: A custom heap and allocation area is now provided to support bitmaps larger than 760KB.
  9. Large buffers: A new type, Microsoft.SPOT.Hardware.LargeBuffer, is provided for allocating buffers larger than 760KB, which would not fit in the managed heap. This type is located in assembly Microsoft.SPOT.Hardware.
  10. Watchdog and Power Level control: The power level and the watchdog behavior can now be controlled from the managed application using types Microsoft.SPOT.Hardware.PowerState and Microsoft.SPOT.Hardware.Watchdog from assembly Microsoft.SPOT.Hardware.dll.
  11. Thick pens and gradient fills: A richer graphic model is now provided for designing widgets and controls.
  12. TinyCore performance improvements: TinyCore performance has been enhanced in the area of event dispatching and layout.

Get Started

Getting started with the .NET Micro Framework is as simple as 1-2-3.

  1. Download .NET Micro Framework SDK and install at your system. Current available version is 4.1. You get it in the form of SDK (Software Development Kit).
  2. If your have Visual Studio 2008 or higher version then you can use it for development environment. Other option is to use Visual C# Express edition.
  3. Write your code using the built-in emulator to prototype
  4. Deploy to your chosen hardware by flipping a switch

In the next post, I will discuss you how to start development with Micro Framework…..

Thanks

Posted by: Manish

Categories: .Net Micro Framework, C#

Tags: , , , ,