I'm looking for a Statechart (Harel) tool that supports C code generation, and is free (not trial copies). Any suggestions?
Statechart tool to generate C
Oct 15, 2009
22 Replies
Book: Practical Statecharts in C/C++ by Miro Samek, pub CMP Books, ISBN
1-57820-110-1I'm actually looking for a software tool. I have an extremely good understanding of statecharts having used iLogix Statemate for many years. I'm looking for a free tool that hopefully targets C/PIC processors. I wish to draw my statecharts and then autogenerate code. The book recommended is a methodology, not really the type of tool I'm looking for.
Has a CD of the code, but good luck.
Nel suo scritto precedente, Marc Hillman ha sostenuto :
Hi, these days I0m trying out YAKINDU, a plugin for Eclipse.
formatting link
http://www.grgmeda.it
,
You might want to try:
formatting link
Which you cannot use without buying a license :(
John Devereux
Rule #3: Always check
formatting link
Searching on "state machine" returns several results, including
formatting link
Rich Webb Norfolk, VA
Rich Webb escreveu:
It seems SMC does not generate Harel (hierarchical) state charts.
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
In my experience (several years of professional OO work), if you need hierarchical state charts, your class model is incorrect.
formatting link
formatting link
I think you experience does not apply here. It is possible to do the design using only state machines and turning them in code without need to resort to OO (be it analysis or design). OTOH, since Harel (hierarchical) cope well with the expansion of states that "flat" state machines have when working in real life projects.
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
wish
aThe book and website actually contains a really vast amount of reference code that runs on dozens of embedded platforms.
What this would give you is a framework to create your own application with or without a premptive RTOS component. The framework gives you active objects, event queues, multiple simultaneous statemachines and other services.
check out the ports here:
formatting link
It isn't going to generate code for you, but coding of the state machines is a breeze if you create the appropriate diagrams in Visio (or other drawing package). Filling in the actual "application code" is what takes time, and I don't know of many tools that can generate that for you. ;-)
--------------------------------------- This message was sent using the comp.arch.embedded web interface on
formatting link
formatting link
I'm confused... UML 2.0 is very broad and includes multiple tools for high level software design. OO would be a subset of that, right?
Anyway, the hierarchical state charts are one tool that I've found particularly useful in the past. It has worked for me when using C on embedded chips.
I don't see how that would automatically mean I'm engaged in bad OO design...
--CG
--------------------------------------- This message was sent using the comp.arch.embedded web interface on
formatting link
vinnie escreveu:
formatting link
I'm not sure if your comments are addressing my post or nobody's one, so. . .
UML is a 'modeling language' so is not a tool nor includes any tool at all. I will take you're using 'tool' here as figure of speech.
Yes, that's why I made my comment above.
Me either.
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
IAR's visualSTATE
formatting link
Dan Henry
Dan Henry escreveu:
But it is not free, is it?
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
,
formatting link
GPL
Since this forum mentions my book ("Practical Statecharts in C/C++") and the website
formatting link
I'd like to clarify some misconceptions about state machines, UML, and tools.
For starters, I'd recommend reading a few articles about modern state machines in embedded systems (see also
formatting link
rs.htm).
- The articles "Who Moved My State" formatting link
formatting link
explain what state machines are and what kind of programming problem they address. You learn how state machine can become very powerful "spaghetti-code reducers" and how they are fundamentally different from flowcharts. The article gives also some guidelines for designing state machines and concrete C and C++ code examples (the code is available for download at
formatting link
- The article "D=E9j=E0 vu" formatting linkintroduces the more advanced concept of hierarchical state nesting and shows how it counteracts the "state and transition explosion" problem of traditional non-hierarchical state machines. The source code accompanying this article is available for download atformatting link
- The article "UML at .99" formatting linkshows that contrary to widespread misconceptions, modern hierarchical state machines are applicable to the tiniest, deeply embedded microcontrollers. This article shows an tiny state machine framework and real-time kernel running in a USB Toolstick from Silicon Labs (8051-based C8051F300 MCU), with just 8K of flash ROM and 256 bytes or RAM.
The bottom line is that to use state machines effectively, you first need to make a paradigm shift from the traditional sequential programming (such as a traditional RTOS or just a "superloop") to event-driven programming. Event-driven programming leads to inversion of control (a.k.a. the Hollywood Principle: "Don't call us, we'll call you") between the application and the event-driven infrastructure. This inversion of control, in turn, means that the event-driven infrastructure for executing state machines naturally takes a form of an application framework.
Which brings us to the tools based on state machines. As it turns out, virtually all such code-generating tools have an event-driven framework buried inside (e.g., the Rhapsody tool generates code for either the OXF or the IDF framework). In fact, the framework is the most important enabler of automatic code generation.
But you don't need a big tool to use an event-driven framework. You just need the framework. For example, the QP family of very lightweight, open source frameworks
formatting link
qpc/) are designed for manual coding of hierarchical state machines . The code you need to write directly in C or C++ is actually simpler than the state machine specification for the SMC compiler
formatting link
mentioned in this forum. SMC is not hierarchical.
Miro Samek
formatting link
It is not GPL it is "Dual Licensing" very different!!
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
Thanks for your comments Miro. It is amazing how quickly a thread can descend down a rabit hole, and the original question get lost.
I have been programming, professionally, with Harel Statecharts for 10 years, in an Avionics environment. I have an exceptionally good understanding of Statecharts. I'm used to an enviromnent with animation, and the ability to connect models to real hardware.
What I'm trying to achieve is something similar to the rich environment I'm used to in aerospace industry, but accessable to your average hobbiest, as I'm in that mode now. What I'm after is a statechart drawing tool that supports the full statechart notation, including concurrent states, so I can design my software. I have your book, but the Visio templates provided are a bit manual for my liking, and I still haven't worked out why they are needed - the Visio ones seem smarter. I'd like a system with some completeness/correctness checking. It also has to be free. I'd also like it to be possible, if I decided to do so, to 'autocode' from the statecharts to QP (C). It's a bit tedious transcribing the drawn statecharts into C, but I'm happy to do this if autocode is not feasible.
I'm still looking, so any suggestions for a Statechart tool welcome.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required