embedded software boot camp


Tuesday, May 20th, 2008 by Nigel Jones

I have been writing this blog now for about 18 months and in reviewing my posts I’ve noticed that my posts are often critical of technologies, manufacturers and or products. Well today is a first for me, because I’d like to offer my first product endorsement. The endorsement goes to visualSTATE from IAR . I’ve been using this product for about the same length of time I’ve had this blog and have concluded that it represents the biggest step forward in productivity for me since I made the move from assembly language to C. (Yes folks, the move from C to C++ was a virtual non-event for me, as I found almost no improvement in my productivity, mainly I suspect because I have written for years in object oriented C).

Anyway, back to the topic of visualSTATE. If you aren’t familiar with it, then you should be. It allows you to design complex, hierarchical state machines with ease and to push a button and obtain code that just seems to work. I have now completed three projects using this tool and am well on the way to finishing a fourth. In all cases, the boost to my productivity has been astonishing. I find that I spend most of my time on the functional design and almost no time on debugging the high level application.

visualSTATE’s main strengths seem to be in the following areas:

1. Products that are highly modal – i.e. a product can be in one of N operating modes depending upon circumstances..
2. User interfaces. I’ve had great success with products that contain bespoke LCD and membrane keypads.
3. Products that contain complex sequencing requirements, particularly when coupled with a plethora of failure modes that have to be handled.

I’ve found the learning curve on visualSTATE to be quite long – but definitely worth it. Although you can certainly be up and running in a day or so, I found that it took me a lot longer to work out how best to partition a problem between visualSTATE and traditional code. However, with experience I’m now finding that I rarely get it wrong anymore.

I’ve also found some very nice and unexpected benefits from visualSTATE. To wit:

1. Code reuse. visualSTATE does of course require some code support. However, I’ve found that a lot of this code can be reused. As a result, I can now bring up a new board with a visualSTATE processing engine running on it in a matter of hours. Try doing that with your average RTOS.
2. Although we all know that lots of small functions are “better” than a few big functions, human nature being what it is, we tend to just expand an existing function rather than decomposing it into its constituent parts. Well when using visualSTATE I find that it almost forces one in to writing lots of small (less than 5 lines) functions. I suspect that these small functions are part of the reason that my visualSTATE projects just seem to work with almost no debugging time.
3. Documentation. As well as the documentation benefits associated with small functions (i.e. the comments actually match the code!), visualSTATE comes with a terrific documentation tool. Many of my clients quite rightly demand excellent documentation on the designs I do for them. The documentation engine in visualSTATE makes this a breeze!
4. Communication. My clients often ask questions such as “what does the code do if …”. In a traditional project this usually means pouring through complex code trying to ascertain the answer. With visualSTATE projects I find that most of the time I simply look at the state charts. Since the state charts are effectively the code (since they are tied together), then I can give an answer quickly and authoritatively – which makes my clients happy and helps assure me of future business.

All in all, kudos to IAR for such a great tool.


9 Responses to “visualSTATE”

  1. Anonymous says:

    Why not use a UML tool instead? E.g. Telelogic rhapsody./Oscar

  2. Nigel Jones says:

    visualSTATE is a UML tool, albeit a subset of UML (for which I’m grateful). Since I don’t know much about Rhapsody I can’t compare the two products – but then that’s not really my point. I think the point is that by using a tool such as visualSTATE (and presumably Rhapsody if it’s any good) one can achieve dramatic gains in productivity. If you have particular experience of Rhapsody I’d love to hear about them.

  3. Anonymous says:

    “… I found that it took me a lot longer to work out how best to partition a problem between visualSTATE and traditional code.”Can you offer general guidance regarding partitioning “best practices”?

  4. Nigel Jones says:

    Apologies for how long it has taken to respond. The answer is no – at least within the confines of a blog. Partitioning is a mix of art, science and blind luck. Having said that, I’m finding that the more I do it, the less luck is involved. If you really need help on this are, then I do offer a training course on visualSTATE, which I’ll publicize on my web site as and when I get the time.

  5. Gregory says:

    I can't say I've used VisualSTATE, but I've had good success with SMC, an open source state machine compiler. There's no GUI, but it produces decent code in a wide variety of languages from a very readable state description file format.

  6. Miro Samek says:

    The new, free QM tool from Quantum Leaps provides features very comparable to IAR visualSTATE. In particular, you get a very intuitive graphical editor for hierarchical state machine diagrams and automatic code generator based on the QP state machine frameworks.

    Unlike visualSTATE, QM gives you complete control over the generated code structure, directory names, file names, and elements that go into every file. You can mix your own code with the synthesized code and use QM to generate as much or as little of the overall code as you see fit. At the low level, QM respects your graphical layout as much as possible and will not re-attach or re-route connectors, resize nodes, or adjust text annotations. You will find that you don’t need to fight the tool.

    You can download QM from state-machine.com/qm. QM is free to download and free to use without any restrictions and without filling any forms.

    • Nigel Jones says:

      As a general rule, I don’t allow comments from tool suppliers that are promoting their products. I have made an exception in this case because (a) Miro is a fellow blogger here at EmbeddedGurus, and (b) I have a lot of respect for his technical abilities. Come the happy day that I have a spare week on my hands, I will take QM tools out for a test drive and report my results.

      • Andrew Ashworth says:

        I hope that day is soon! I believe a comparative review of the major players would be very useful. I know I am definitely interested.

  7. […] I haven’t seen anyone else write about it (except IAR with their technical articles). I found one blog post giving kudos to it, but that’s roughly it. If you want to toy around with it in the meantime, […]

Leave a Reply