状态机与微控制器的 RTOS [英] State machine versus RTOS for microcontrollers

查看:40
本文介绍了状态机与微控制器的 RTOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我偶然发现了一个 免费状态机工具.这似乎用于以图形方式对嵌入式系统进行编程.通过这样做,作者声称生成的代码比使用 RTOS 时更易于维护.该工具基于 UML,很高兴知道,但学习曲线陡峭.

I stumbled across a free state machine tool. This appears to be for programming embedded systems graphically. By doing so, the author claims that the resulting code is more maintainable than if an RTOS had been employed. This tool is based on UML, which is nice to know, but has a steep learning curve.

我想知道这里一些更有经验的程序员如何看待这个工具.

I would like to know what some of the more experienced programmers here think of this tool.

我正在为 LM3S5P36 微控制器开发嵌入式应用程序.TI 有一个名为 Code Composer Studio (CCS) 的 IDE.我还没有进入 CCS,但我怀疑它是否具有能够将所需行为输入状态机图表、转动曲柄并弹出 C 或 C++ 代码的很酷的功能.然后返回编辑图表以生成相应的修改代码.我用 C 编写了微控制器,但对 UML 几乎一无所知.过去我维护了两个文件,一个是微控制器代码,另一个是流程图.每个代码修订意味着维护两个单独的文件.

I am developing an embedded application for the LM3S5P36 microcontroller. TI has an IDE called Code Composer Studio (CCS). I have not got into CCS yet, but I doubt it has the cool feature of being able to enter the desired behavior into a state machine chart, turn the crank, and pop out C or C++ code. Then go back and edit the chart to generate corresponding revised code. I have programmed microcontrollers in C, but know almost nothing about UML. In the past I have maintained two files, one of them microcontroller code and the other a flow chart. Each code revision meant maintaining two separate files.

所以我的困境是:发现了这个很酷的从图表到代码的一体化文档工具,我很想使用它,但更重要的是,我只想完成我的项目.我是按照旧的方式来做,还是花几周时间学习 UML?

So my dilemma is: having discovered this cool chart-to-code all-in-one-documentation-included tool, I would love to use it, but, more than that, I just want to get my project done. Do I do it the old way, or spend a few weeks learning UML?

推荐答案

您可能还对 Miro Samek 的书C/C++ 中的实用 UML 状态图".请注意,Miro 是 Quantum Leaps 的创始人兼总裁,因此本书与该工具密切相关.

You may also be interested in Miro Samek's book "Practical UML Statecharts in C/C++". Note that Miro is founder and president of Quantum Leaps, so this book goes hand-in-hand with the tool.

似乎 Miro 在状态图开发方面投入了大量资金而不是 RTOS 开发,他撰写了大量关于该主题的书和博客.他在 LinkedIn 的实时嵌入式工程小组中发起了主题为RTOS 真的是设计嵌入式系统的最佳方式吗?" - 关于这个主题有很多意见!.

It seems that Miro has a lot invested in state-chart development over RTOS development, having written the book and blogged on the subject extensively. He started the thread on LinkedIn's Real-Time Embedded Engineering group titled "Is an RTOS really the best way to design embedded systems?" - plenty of opinions on the subject there!.

我不确定两者是否一定不同;将单个 RTOS 线程实现为状态机通常很有用(并且经常这样做).他在他的博客我讨厌 RTOS 中提出了一些很好的观点, 但他的推理主要是基于糟糕的应用程序设计而不是 RTOS 技术本身.正如 C 或 C++ 在不明智地使用时可能会很危险一样,RTOS 也是如此.我通常看到的是应用程序线程太少,内聚力差,紧密耦合,但我相信 Miro 会为解决更多线程而烦恼!

I am not sure that the two are necessarily distinct; it is often useful (and frequently done) to implement individual RTOS threads as state-machines. He makes some good points in his blog "I Hate RTOSes, but his reasoning is largely based around poor application design than RTOS technology itself. Just as C or C++ can be dangerous when used ill-advisedly, so to can an RTOS. What I typically see is applications with too few threads with poor cohesion and tight coupling, but I am sure that Miro will be tearing his hair out at the thought that the solution is more threads!

UML 2.2 指定了 14 种图,状态机只是其中一种,因此无需完整学习 UML.在这种情况下使用它是因为它是一个定义明确的模型,具有清晰的语法和语义,适用于定义行为细节.状态机图(或状态图)可能是最容易理解的 UML 行为图,并且在任何 UML 图中具有最明确的定义语义.

UML 2.2 specified 14 types of diagram, state-machine being just one, so there is no need to learn UML in its entirety. It is used in this case because it is a well defined model with clear syntax and semantics, suitable for defining behavioural detail. State-machine diagrams (or state-charts) are probably the easiest UML behavioural diagrams to understand, and have the most clearly defined semantics of any UML diagram.

这篇关于状态机与微控制器的 RTOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆