gpt4 book ai didi

c# - 体验使用 .NET Micro Framework 进行编程

转载 作者:太空狗 更新时间:2023-10-29 20:04:01 25 4
gpt4 key购买 nike

在我的敦促下,我所咨询的一家公司正在寻求切换到由 .NET Micro Framework 提供支持的设备,以便我们可以更快地将设备推向市场。至少在理论上,这个想法是用 C# 而不是 C 或汇编编码会更快并且更不容易出错。就像我说的,这都是理论,因为我从未对嵌入式设备进行过编程。

我的问题如下:

  1. .NET Micro Framework 能胜任这项任务吗?
  2. .NET Micro Framework 不能做哪些事情?
  3. 有哪些陷阱?
  4. 插件设备是否有可行的第 3 方市场?我在 Microsoft 的网站上没有看到太多内容。
  5. 谁能指出使用 MF 框架开发的商业设备。

谢谢。

最佳答案

在不了解您的应用程序和嵌入式设备的当前功能的情况下,如果 .NET MF 能够胜任这项任务,我将很难给出明确的意见。如果嵌入式设备是具有 2K RAM 和 32K ROM 的低功耗 8 位 CPU,那么 .NET MF 将不适合该设计。

在许多情况下,迁移到 .NET MF 将涉及对芯片组的硬件更改,这些芯片组受到许多通常针对 ARM7 或 ARM9 内核的供应商的青睐。这样做的主要原因是利用在移植 HAL 并将 PAL 和 TinyCLR 交叉编译为相关处理器的 native 代码方面已经完成的工作。然后,如果您的应用程序适合 .NET MF 模型,您只需要开发托管代码。

development boards 的比较可能会帮助您为新设计选择平台。 GHI products的优势是您可以购买带有他们开发的固件的裸芯片组,以与您的硬件设计集成。

问题 1 的答案:.NET Micro Framework 是否能胜任这项任务?

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

问题 2 的答案:.NET Micro Framework 不能做什么?

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.

问题 3 的答案:有哪些问题?

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.

问题 4 的答案:插件设备是否存在可行的第 3 方市场?

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)

抱歉,没有问题 5 的答案,因为我不关注此类内容。 landing page for .NET MF Microsoft 上似乎有商业设备的图像,但我从未访问过这些链接。

关于c# - 体验使用 .NET Micro Framework 进行编程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1329251/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com