SYSTEM INTEGRATION
Embedded Windows
Look, Ma! No RTOS! Getting to Know Microsoft .NET Micro Framework
Is your application small, relatively simple, cost-sensitive? Do you not need all the bells and whistles of a full RTOS? Microsoft’s new .NET Micro Framework might get you going with less hassle, less overhead and shorter development time.
SEAN D. LIMING AND JOHN R. MALIN, SJJ EMBEDDED MICRO SOLUTIONS
Wouldn’t it be nice to have an off-the-shelf platform that was ready to be programmed with your custom application? No need to spend a big budget to develop the hardware and adapt firmware from some OS vendor, where documentation and support is lacking in both areas. Maybe simply control some I/O and send information to a screen or over a serial connection. Best of all, wouldn’t it be nice to write the application using tools that you already have and in a known programming language? Well, this is the concept behind the Microsoft .NET Micro Framework. Program using C# in Visual Studio and download your application to a device that already has the firmware running on a feature-rich system running a 32-bit RISC processor.
Microsoft’s latest offering for embedded developers, the Microsoft .NET Micro Framework (.NET MF), addresses the needs of smart, small-footprint devices for such applications as robotics, security systems and simple interfaces. Built from the ground up, .NET MF exposes hardware like GPIO, I2C, SPI, Serial, etc. and allows developers to write C# applications in Visual Studio to access that hardware directly. The footprint is about 1 Mbyte so it is much smaller than Windows CE. As with any new technology, there are always a number of questions.
What is .NET Micro Framework?
The .NET Micro Framework consists of a TinyCLR that allows developers to write managed code (C#) applications in Visual Studio. CLR means Common Language Runtime. The CLR is an agent that manages code at execution time, providing core services such as memory management, thread management, exception handling and debug services, while also enforcing strict type safety and other forms of code accuracy that promote application security and robustness.

The TinyCLR is a smaller footprint implementation of the full CLR used in .NET Framework or the CompactFramework. For .NET MF, the TinyCLR sits directly on top of a Hardware Abstraction Layer (HAL), which makes it possible to port .NET MF to different processors. Currently, it supports ARM7 and ARM9 processors. .NET MF has been ported to the Cirrus Logic 93XX series, FreeScale i.MXS, Atmel AT91SAM9 and the NXP LPC2000. .NET MF consists of four layers: Application, Class Library, Runtime Component and Hardware (Figure 1).
Application Layer: The top layer simply consists of the managed application you write in Visual Studio. These applications are specific to the hardware that you are writing them for. Even though Visual Studio and .NET support different languages, C# is the only language currently available to write .NET MF managed code applications.
Class Library Layer: The class libraries are the re-usable objects that you can use when writing applications. Communication libraries, I/O access, storage and support for Windows Presentation Foundation are available.
TinyCLR: This layer consists of three components. The TinyCLR is the interpretive engine that handles all the processing of the applications. The HAL and the PAL control the underlying system hardware. Both the HAL and the PAL are groups of C++ / assembly functions called by the CLR. The HAL is the component that can be modified to support different processors and different hardware configurations. It contains some bootstrap code, as well as the drivers that make up the system. The HAL can also be adapted so .NET MF can run on different hardware platforms or on an operating system.
Hardware Layer: The hardware layer contains the microprocessor and the microprocessor support and I/O devices. Currently, .NET Micro Framework only runs on ARM7 and ARM9 RISC processors. There is also an independent boot loader known as TinyBooter that loads the TinyCLR into memory. Although the TinyCLR can be booted directly, the TinyBooter is used so that it can also update the TinyCLR code, when desired.
How Does This All Work?
Probably the first question that most designers will ask is, “What is the processing architecture?” First of all, the .NET Micro Framework is NOT a real-time kernel or OS. Windows CE is Microsoft’s real-time embedded operating system. The TinyCLR is not deterministic, and interrupts are currently not preemptive.


Kontron
Interphase