Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Experiences programming with the .NET Micro Framework

A company I consult for is looking, at my urging, to switch to devices powered by the .NET Micro Framework, so that we can bring devices to the market faster. The idea, in theory at least, is that coding in C# rather than C or assembly will be much faster and less bug prone. Like I said, this all theory, as I've never programmed an embedded device.

My questions are as follows:

  1. Is the .NET Micro Framework up to the task?
  2. What are some of the things the .NET Micro Framework cannot do?
  3. What are some of the gotchas?
  4. Is there a viable 3rd party marketplace for plugin devices? I didn't see a whole lot on Microsoft's site.
  5. Can someone point to a commercial device that has been developed with the MF Framework.

Thanks.

like image 214
AngryHacker Avatar asked Aug 25 '09 16:08

AngryHacker


People also ask

What is .NET Framework with example?

Net framework was 1.0 which came in the year 2002. In easy words, it is a virtual machine for compiling and executing programs written in different languages like C#, VB.Net, etc. It is used to develop Form-based applications, Web-based applications, and Web services.

What is .NET Framework and how it works?

The .NET Framework is an open-source platform for developing Windows-based applications. The .NET Framework includes a variety of developer tools and class libraries. The .NET Framework works with applications developed in C#, F#, Visual Basic, and other popular programming languages.

What is .NET in programming?

.NET is a free, cross-platform, open source developer platform for building many different types of applications. With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, games, IoT, and more.


1 Answers

Without knowing your application and the current capability of the embedded device it will be hard for me to give a definitive opinion if .NET MF is up to the task. If the embedded device is a low power 8-bit CPU with 2K of RAM and 32K of ROM then the .NET MF would not be suitable for that design.

In a large number of cases the move to .NET MF would involve hardware changes to a chipset favoured by many vendors that typically target ARM7 or ARM9 cores. The main reason for this is to leverage the work already done in porting the HAL and cross-compiling the PAL & TinyCLR to the native code for the processor in question. Then, if you application fits the .NET MF model, you only need to develop managed code.

A comparison of development boards might help you to select a platform for a new design. The advantage of the GHI products is that you can purchase the bare chipsets with the firmware that they have developed to integrate with your hardware design.

Answer to Question 1: Is the .NET Micro Framework up to the task?

Sorry, I cannot answer this about your application without more information.

Answer to Question 2: What are some of the things the .NET Micro Framework cannot do?

The micro-framework is not realtime like so many of the competing products. The scheduler is fairly simple and not optimised for systems that require deterministic timing.
The TinyCLR interprets the IL from the next waiting "thread" for a 20ms. Threads can yield their allotted time slice by calling Thread.Sleep(0). ONLY between each thread time slice will the Runtime Interpreter check flags from the hardware and dispatch events to managed code or waking up threads if they are blocked waiting for hardware. As far as I understand, there is no way for a thread to be unblocked from native code interrupt service routines (ISR) or for a higher priority thread pre-emptively interrupting a lower priority thread.

Answer to Question 3: What are some of the gotchas?

Everything seems to be working, you've understood the how the runtime interperter loop works (the scheduling of threads and reacting to hardware events) and then you forget about GARBAGE COLLECTION!!
Best to minimise the amount of thrashing of memory (review carefully each time you new an object). Instead of creating and destroying commonly used objects, consider holding a pool of objects usually GC'd and recycle them when needed again.

Answer to Question 4: Is there a viable 3rd party marketplace for plugin devices?

The third party involvement is mainly in the development boards and reference designs on the hardware side of things. From a software point of view, this code-share link might be of interest. As a side issue, don't forget that most of the VS2008 development tools also work on .NET MF (e.g. Resharper and VisualSVN)

Sorry, don't have an answer to question 5 as I do not follow this type of thing. The landing page for .NET MF on Microsoft does seem to have a images of commercial devices but I've never followed the links.

like image 97
Rhys Avatar answered Sep 22 '22 05:09

Rhys