The .NET Micro Framework: A First Look

If you are like most developers, you’ve heard of Microsoft’s .NET Framework. If you have heard of the .NET Framework, you might also have heard of the .NET Compact Framework that was created for mobile devices. What you might not have heard about is the .NET Micro Framework.

The .NET Micro Framework is not the same thing as the .NET Compact Framework. Rather, it is yet another version of the .NET Framework, but this time targeted specifically to embedded systems. Of course, you might have heard of the Microsoft Embedded ToolKit. The .NET Micro Framework is also not the same thing as the Embedded Toolkits that Microsoft has available.

The .NET Micro Framework is a scaled-down version of the .NET Framework targeting embedded systems development using Managed code, and more specifically, C#. The .NET Micro Framework is a scaled-down version of the .NET Framework that is more specific to embedded devices.

In Figure 1, you can see the software architecture. As you can see, the .NET Micro Framework includes a runtime, libraries, and more. Also included in the architecture is an abstraction layer for the hardware (HAL). Whereas embedded applications are generally written to specifically target hardware, that is not the case with the .NET Micro Framework. As an embedded developer, you would use the standard routines in the library. The hardware vendor you use would then provides the underlying abstraction layers of the HAL along with an abstraction layer for the platform (PAL).

Figure 1: The .NET Micro Framework Architecture

When you get a piece of embedded hardware, the hardware manufacturer should supply you with a copy of the .NET Micro Framework. The version they give you will have their HAL and PAL included. The result is that you can write standard, Managed C# code using standard libraries. If you change hardware, you should only need to swap to the new hardware’s copy of the .NET Micro Framework, which will replace the HAL and PAL. Your program should require no changes as long as the hardware is similar.

The .NET Framework’s object model is smaller than the .NET Compact Framework and obviously smaller than the full .NET Framework. The framework can fit in as little as 256 Kb of RAM along with as little as 512 Kb of flash memory. In that tiny bit of space, you get a number of the classes that .NET Developers already know. This include threading, text, reflection, streaming, debugging, ArrayList, math, and much more. Figure 2 shows an abridged version of the object model.

Figure 2: Programming libraries in the .NET Micro Framework (abridged)

It is worth pointing out that the .NET Micro Framework is not a direct subset of the the .NET Frameworks. In some cases, classes have been moved to other libraries. This was done for the sake of easing navigation and providing a tight focus to keep things small.

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read