为嵌入式微控制器创建图形化编程 IDE
我被要求为嵌入式 8 位和 32 位微控制器创建一个图形化编程 IDE。它需要像使用 LabVIEW 一样简单,但我不需要调试或模拟等功能(至少目前如此)。基本上,应用程序需要允许用户配置逻辑门、while/for 循环、case 语句、比较、流程控制等。程序完成后,它应该生成 C 代码,在连接的微控制器上编译和编写程序。现在我们的目标是 Atmel 和 Freescale 处理器,并将使用 DIO、用于电流感测的模拟 IO、CAN 总线、PWM,以及可能还有一些我缺少的功能。
我意识到这是一项艰巨的任务,需要很长时间才能开发,但我的公司希望在客户购买我们的硬件时向他们提供软件。为了备份并给您一些背景信息,我们公司构建了在 CAN 总线上或独立工作的 IO 模块。如今,对 PCB 上的微控制器进行编程的唯一方法是使用 Atmel (AVR Studio) 或 Freescale (CodeWarrior) 的 IDE。问题是客户并不总是具备用 C 语言编程的知识。所以...进入图形 IDE。 LabVIEW 对于客户来说太贵了,所以我们不得不创建自己的。
所以我的问题是:创建这个 IDE 的好方法是什么?我计划用 C#/WPF 进行开发,但我想知道将用户创建的逻辑转换为可由 Atmel/Freescale 编译器编译的 C 代码有多困难。或者也许有更好的方法?有人做过这样的事吗?
I have been asked to create a graphical programming IDE for embedded 8-bit and 32-bit microcontrollers. It needs to be as easy as using LabVIEW, but I don't need features like debugging or simulating (at least for now). Basically the application needs to allow the user to configure logic gates, while/for loops, case statements, comparisons, flow control, etc. Once the program is finished it should generate the C code, compile and write the program on the connected microcontroller. Right now were are targeting Atmel and Freescale processors and will be using DIO, analog IO for current sensing, CAN bus, PWM, and probably some more that I'm missing.
I realize that this is a HUGE undertaking that will take a very long time to develop, but it's software that my company wants to provide customers when they buy our hardware. To back up a bit and give you a little background information, our company builds IO modules that work on CAN bus or standalone. Today, the only way to program the microcontoller on our PCB is to use the IDE from Atmel (AVR Studio) or Freescale (CodeWarrior). The problem is that the customer does not always have the know-how to program in C. So... enter the graphical IDE. LabVIEW is too expensive for the customer, so we're stuck with creating our own.
So my question is: what is a good way to create this IDE? I am planning on developing this in C#/WPF, but I'm wondering how hard it will be to convert the logic that the user created into C code that can be compiled by the Atmel/Freescale compiler. Or perhaps there is a better method out there? Has anyone done anything like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们有一个非常相似的问题。我们的目标是创建一个图形建模工具,可以从 UML 状态机生成 C 或 C++ 代码。人们可能认为此类工具应该非常常见,但事实证明它们不能很好地支持状态嵌套,并且不能为嵌入式微控制器生成足够紧密的生产质量代码。
在比较了几个选项(例如与现有图形工具集成)后,我们决定在 Qt (qt.nokia.com) 中开发整个系统。事后看来,我们对这个选择非常满意,因为我们可以控制该工具的各个方面。
Qt框架提供了很多基础设施,例如2D图形场景和用户可以用鼠标操作的图形项目。您可以使用 XML 支持将模型存储在磁盘上。如果您需要公开一些脚本接口,那么您有一个脚本引擎。对我们开始使用 Qt 帮助很大的一件事是《C++ GUI Programming with Qt 4 (2nd Edition)》一书。
无论如何,我们创建的工具可以免费下载和免费使用(http://www.state-machine.com/qm),因此您可以使用它并了解它是如何工作的。
We had quite a similar problem. Our goal was to create a graphical modeling tool that would generate C or C++ code from UML state machines. One would think that such tools should be very common, but it turns out that they don't support state nesting very well and don't generate production-quality code tight enough for embedded microcontrollers.
After comparing several options, such as integration with existing graphical tools, we settled on developing the whole thing in Qt (qt.nokia.com). In the hindsight, we are very happy with that choice, because we can control every aspect of the tool.
The Qt framework provides a lot of infrastructure, such as the 2D graphical scene and graphical items that users can manipulate with the mouse. You have XML support to store your model on disk. And you have a scripting engine, if you need to expose some scripting interface. One thing that helped us immensely to get started with Qt was the book "C++ GUI Programming with Qt 4 (2nd Edition)".
Anyway, the tool we have created is free to download and free to use (http://www.state-machine.com/qm), so you can play with it and see how it works.
您是否考虑过制作一个 LabView 连接器以便您的客户可以使用 LabView?
这将为他们提供一个成熟、稳定的工具集,而您所要做的“所有”就是将其粘合在一起。
我会拒绝在这种情况下“仅仅”使用这部作品。
Have you considered making a LabView connector so your customers could use LabView ?
This would get them a mature, stable toolset, and "all" you have to do is glue it together.
I will resist using the work "just" in this context.
该要求似乎更像是使用 4GL/RAD 语言来生成 C 代码,而不是 IDE。
我个人会提出一种替代方法,即采用 Lua 或 TCL 等占用空间较小的脚本语言,并在 C 代码中构建一些自定义扩展。然后,您的客户可以使用您的扩展库在 Lua 或 TCL 中进行编码。
对于 IDE 本身,我会考虑构建一个 eclipse 插件。基础 Eclipse 拥有您所需的 90%,并且插件架构坚固且成熟,有大量示例可供遵循。
The requirement seems more like a 4GL/RAD language to generate C code than an IDE.
I personally would propose an alternative approach which is to take a small footprint scripting language such as Lua or TCL and build in some custom extensions in C code. Your customers can then code in Lua or TCL using your extension library.
For the IDE itself I would consider building an eclipse plugin. The base eclipse has 90% of what you will need and the plugin architecture is solid and mature with lots of examples to follow.