Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# for embedded systems? [closed]

Tags:

c#

embedded

"C# is intended to be suitable for writing applications for both hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions." -- design goals (wikipedia)

Although it greatly depends on how embedded is "emebedded",

How well do you think C# has reached this goal?

Do you consider C# to be just as good if not better tool for the job than C/C++?

like image 375
Tim Matthews Avatar asked Feb 20 '09 04:02

Tim Matthews


5 Answers

Well, there is Micro Framework; I don't hear a lot of noise about it, but I'm not into "embedded". But it would depend on what it was doing... C# is a good general purpose language, but there are still times when something hard-core is needed (and hang the code-complexity).

like image 110
Marc Gravell Avatar answered Sep 22 '22 00:09

Marc Gravell


There are lot of commercially successful software applications written in C# and for the WinCE platform. For example, some set-top-boxes (from AT&T etc) run C# code on .net CF. Given these boxes have 64 or 128 MB ram, I think C# in embedded is embedded enough.

Point is with advancements like hardware accelerations and other compiler advancements a JITed language like C# are able to good job.

And the greatest advantage is with latest Visual Studio you are able to debug the device from VS. At least for a dev environment, there is nothing as good now.

note: platform wise there are lot of competitors for WinCE/ WinMobile and each has its strong point. In above I am only talking about the dev environment advantages.

like image 41
Sesh Avatar answered Sep 22 '22 00:09

Sesh


As you know, you need to have an embedded .net mini runtime if you want to write your code against it, in C#. You could say, like Win CE.

I hope we'll have low cost .NET mini-mini embedded chips soon in market, or are they already there? Just a little bit interested about this news

http://www.windowsfordevices.com/news/NS4666205829.html

A small startup in Microsoft's backyard is poised to begin shipping a tiny, 32-pin chip-like computer module that runs ".NET Embedded," a new Microsoft embedded software platform developed for use in watches and other "smart personal objects." The module, developed by startup .netcpu Corp., incorporates portions of Microsoft's Smart Personal Objects Technology (SPOT) hardware and software.

How ever, here is something interesting for you. Have a look at the COSMOS project. It can translate your IL code to various platforms (and in future to embedded architectures hopefully)

http://www.gocosmos.org/index.en.aspx

Cosmos includes a compiler (IL2CPU, which is part of Cosmos) that reads the input file (usually the shell) and Cosmos libraries and compiles the resulting IL to x86 code. IL2CPU has a layer for cross platform and we plan to support other processors and platforms, including x64. IL2CPU also supports certain extension methods which allow C# code to interact directly with the CPU, registers, and ports in the kernel. IL2CPU contains some inline assembler, but there are no ASM files that need to be linked in.

Currently IL2CPU first outputs raw asm files (with IL comments) and then processes them through nasm (a free assembler). Later we plan to emit directly to binary.

like image 38
amazedsaint Avatar answered Sep 26 '22 00:09

amazedsaint


You can checkout Netduino. It is an application of .Net Micro Framework on an ARM 32 bit microcontroller using C#. Its on netduino.com or this video http://www.youtube.com/watch?v=UN-JXHHlgcY.

Since C# uses a framework or a virtual machine which serves as an intermediate between its C# code and the machine code, I expect it would run slowler than using the C or C++. But in applications where speed is not that crucial, and delivery is immediate, this is definitely considerable.

like image 45
LEMUEL ADANE Avatar answered Sep 24 '22 00:09

LEMUEL ADANE


C# on embedded systems not using WinCE or Windows Embedded requires .NET Micro, so there is in fact no distinction between "hosted and embedded", since it requires to be hosted regardless. That is it is hosted, and can be embedded so "hosted or embedded" makes no sense.

Currently .NET Micro has a memory footprint of 300Kb, and is supported only on ARM, and Blackfin, thus rendering it unsuitable or too expensive for use of a large range of embedded applications. Moreover while it supports multi-threading, it is not real-time capable, making it unsuitable for another large chunk of applications.

A few years ago, Microsoft held a free session at the UK Embedded Systems Show launching the then new .NET Micro; during the Q&A when I asked the question about real-time support, and got the answer "No, it is not real-time.", there was an audible groan from the audience, and a number got up and left, having had their time wasted.

like image 41
Clifford Avatar answered Sep 25 '22 00:09

Clifford