Export (0) Print
Expand All

Understanding .NET Micro Framework Architecture

This topic describes the Microsoft® .NET Micro Framework architecture.

Introduction

The .NET Micro Framework architecture is optimized for small devices and makes it possible for you to use Microsoft Visual Studio® and C# to program an embedded system. These devices include, but are not limited to:

  • Sensor networks
  • Robotics
  • GPS navigation
  • Wearable devices
  • Medical instrumentation
  • Industrial automation devices
  • Other small devices that require an efficient, low-resource-consuming Microsoft .NET client

The .NET Micro Framework is available for an increasing variety of hardware. Its architecture is designed to be extremely flexible and highly adaptable to new hardware platforms.

Architecture Essentials

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

Cc533001.arch2(en-us,MSDN.10).jpg

Figure 1.  The layers of the .NET Micro Framework architecture

The rest of this document presents overviews of the four layers that make up the .NET Micro Framework architecture, starting from the bottom of the preceding diagram.

Hardware Layer

The hardware layer contains the microprocessor and other circuitry that you select. The .NET Micro Framework runs on a growing number of hardware platforms. It can also run on top of operating systems such as Microsoft Windows® and some other proprietary operating systems belonging to companies partnering with Microsoft. It is possible to port the .NET Micro Framework onto other chipsets. If you are a hardware manufacturer that would like a version of the .NET Micro Framework for your chipset, please contact the .NET Micro Framework team at Microsoft by using the MSDN contact information provided on the main .NET Micro Framework page on MSDN.

Cc533001.note(en-us,MSDN.10).gifNote
The .NET Micro Framework SDK includes a device emulator that runs on 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).

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 .NET Micro Framework CLR provides robust application support. It manages memory, thread execution, code execution, and other system services. The CLR is able to provide all of these features and services from a very small memory footprint. It occupies only about 390 KB of memory when all of the provided functionality is being used. This memory-usage estimate is for Microsoft’s implementation framework for existing platforms. Your CLR implementation for your hardware may be smaller or larger than the estimate given here.

The CLR is fast; it performs at about 15,000 managed method calls per second at 27.6 MHz. (These results are based on the average method-call complexity developed for the SPOT watch application.)

You can program and debug the CLR by using Visual Studio .NET. Currently, the CLR supports only C# as its programming language.

Features of the .NET Micro Framework CLR include:

  • 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

Exceptions to and extensions of the CLR include:

  • Execution constraints that limit call durations and prevent failures.
  • Strings represented internally as UTF-8 and exposed as Unicode.
  • No support for multidimensional (sparse or jagged) arrays.
  • 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.
  • No virtual tables for method resolution, which saves RAM.
  • 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.

HAL and PAL

The HAL and the PAL control the underlying system hardware. Both the HAL and the PAL are groups of C++ functions called by the CLR. The PAL functions are independent of the hardware and should not need to be ported. However, you must write your own version of the HAL for your hardware platform.

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.

Class Library Layer

The class library included with the .NET Micro Framework is an object-oriented collection of reusable types that you can use to develop embedded applications. It includes C# libraries that provide support for the following:

  • Encryption
  • Debug, graphics, and shell DLLs
  • The CLR API class library and the CLR corelib
  • Access for managed C# applications to extended chipsets that support specific communications standards, such as GPIO, serial, SPI, or I2C

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.

Cc533001.note(en-us,MSDN.10).gifNote
C# is currently the only language supported for managed applications.
Show:
© 2014 Microsoft