A .NET micro framework for the STM32

Did you ever want to use C# and Visual Studio for programming a modern microcontroller? Swiss-based Oberon Microsystems Inc. has contributed its port of Microsoft's .NET Micro Framework (NETMF) to the open source community, under the same license as NETMF itself (Apache 2.0). It targets the STM32 microcontroller family, which is based on the ARM Cortex-M3 architecture.

The .NET Micro Framework (NETMF) is an implementation of.NET specifically for microcontrollers. It allows writing embedded software in C#, using Microsoft’s Visual Studio tools. NETMF is able to run directly on the hardware, without underlying operating system (it is a "bootable .NET runtime").

The .NET Micro Framework is governed by the Apache 2.0 open source license: there are no "target royalties", you may develop commercial software without being required to pass on your own improvements, and adaptations to new hardware are possible anytime.

There have been NETMF ports to various ARM7 and ARM9 cores for some time now. An ARM core is a specific implementation of an ARM architec-ture, where there may exist multiple cores for the same architecture. Confusingly, an ARM7 core implements the ARMv3, ARMv4, or ARMv5 architecture. An ARM9 core implements the ARMv4 or ARMv5 architecture. Cores that implement the current ARMv7M architecture have a more intuitive naming scheme. They are called Cortex-M, with a suffix that indicates the relative performance and functionality.

Oberon has ported NETMF to the Cortex-M3 core. This task involved mainly the core initializations: interrupts, reset, error handling, etc. . STMicroelectronics is one of several ARM licensees that have built products around the Cortex-M3 core and there are over 170 different STM32 variations. Oberon has ported NETMF to the STM32F103 family. This involved writing drivers for the on-chip peripherals: GPIOs, analog inputs and outputs, I2C, SPI, UARTs, USB, internal flash, power management, and timers.

One specific example is the STM32F103RE, which has 512 KB of flash and 64 KB of RAM in a 64 pin package that measures 10 by 10 millimeter. The flash and RAM are sufficient to run the .NET Micro Framework plus a small application, even without attaching additional external memory chips (which is possible with some other family members).

One product containing an STM32F103 is the MCBSTM32E evaluation kit from Keil and Oberon has ported NETMF to this board. This involved writing drivers for the external flash (8 MB) and the external RAM (1 MB). There is no support for the board’s LCD display.

The ET-STM32-Stamp from Futurlec is board which contains another STM32F103 model. Oberon has ported NETMF to this board. This involved using the boot loader built into the STM32 chips, instead of using the normal NETMF boot loaders. This saves memory – the board has no additional external memory.

Oberon says it is possible to adapt one of the above board ports to any other board with the STM32F103. Depending on your experience and knowledge of NETMF and the C/C++ tool chain that you use, this may take from less than one day to several weeks. Additional work may be required depending on what additional hardware the board provides. For example, if the board has a GSM module, then a driver for this module must be developed.

The board shown below uses an STM32F103RE microcontroller and NET-MF for STM32. It was custom-designed for Phonak (aka Unitron), the world’s largest provider of hearing aids. The board helps the Phonak engineers to test new hearing aids. It allows switching between several pairs of attached hearing aids. This switching is controlled by a PC via USB.

For the PC, Oberon provided a .NET library that sends control commands to the board. In this way, it was able to use .NET, C# and Visual Studio both for the PC application and for the embedded software, eliminating the need for special-purpose embedded tools.

The company has contributed the port(s) described above to the open source community. The source code, governed by the Apache 2.0 license, has been integrated into Microsoft's NETMF Porting Kit. You can download the source code from the download section of Codeplex.

Oberon can provide technical support exclusively within customer projects and says if you find any issues with the code, the issue tracker on Codeplex should be used to report them. Oberon Microsystems AG

---------------------------------------------------------------If you found this article to be of interest, visit the Micocontroller Designline where you will find links to relevant technical articles, blogs, new products and news.

You can also get a weekly newsletter highlighting the latest developments in this sector - just Click Here to request this newsletter using the Manage Newsletters tab - if you aren't already a member you'll be asked to register.

I was unable to find much using the links in the article. The Oberon site is in German, but if you click to the NETMF page, there does not seem to be any download links. Where can we get some useful information about this?

.NET Micro Framework
The .NET Micro Framework is .NET for small and resource constrained devices. It offers a complete and innovative development and execution environment that brings the productivity of modern computing tools to this class of devices.
For current .NET developers, this means that they can now create applications that run on a range of devices from targeted devices like remote controls to PCs and Servers and on to the cloud – all with the same programming model and tools.
For current Embedded developers, this means that they can now leverage the productivity gains that have been achieved on the desktop and reduce their time to market.
The .NET Micro Framework is a fully integrated Visual Studio experience brings a reliable and productive development system to the embedded world.
The typical .NET Micro-Framework device has a 32 bit processor with or without a memory management unit (MMU) and could have as little as 64K of random-access memory (RAM). The .NET Micro Framework supports rich user experience and deep connectivity with other devices.
Such devices include: consumer devices, consumer medical, home automation, industrial automation, automotive, sideshow devices / PC peripherals.
to buy .NET Micro Framework Boards visit http://www.netmfdevices.com/eshop/products.php?21
For more on what the.NET Micro Framework is, please go to www.microsoft.com/netmf.

Please don't confuse the .NET *Micro* Framework with the full .NET Framework for desktops and servers, which is indeed large (several dozen MB).
NETMF is a completely separate implementation. On the custom board mentioned in the article, it takes up about 240 KB of Flash and about 30 KB of RAM, leaving half of the chip's Flash and half of its RAM for the application (more than that on the larger members of the STM32 family). Yet it allows C# source level cross-debugging, breakpoints, etc. from Visual Studio.