A .NET Foundation open source project has emerged for using C# to write embedded applications, letting developers leverage familiar Microsoft technologies to build software for small devices.
Called the .NET nanoFramework, the project lets developers use the Visual Studio IDE and C# to write managed code applications for embedded systems without having to worry about the low-level intricacies of a microcontroller. The platform is suitable for projects ranging from IoT sensors and wearables to robotics and industrial equipment.
The .NET nanoFramework includes a reduced version of the .NET Common Language Runtime and a subset of the .NET base class libraries as well as common APIs included in the Universal Windows Platform, enabling reuse of code from desktop applications, IoT Core applications, .NET code examples, and open source projects.
Specific features cited for .NET nanoFramework include runs on resource-constrained devices with as little as 256kB of flash and 64kB of RAM and runs directly on bare metal - at present, ARM Cortex-M and ESP32 devices are supported.
Other features include support for common embedded peripherals and interconnects such as GPIO, UART, SPI, I2C, and USB, in addition to native multithreading support and support for energy efficient operation such as devices running on batteries.
Delving deeper, Interop code support lets developers write libraries that have both managed (C#) and native code (C/C++), while inclusion of a mark-and-sweep garbage collector means there is no manual memory management, as well as execution constrains to catch device lock-ups and crashes.
.NET nanoFramework picks up where .NET Micro Framework for embedded application development left off and uses some of its building blocks, the project developers said. Many components were completely rewritten, others improved, and others reused.
Most core team members and contributors to .NET nanoFramework are embedded systems enthusiasts, according to the project’s GitHub repo.