Skip navigation
State-Machine Tool Now Generates C# and Java Code

State-Machine Tool Now Generates C# and Java Code

IAR’s Visual State, which graphically constructs state-machine models, adds C# and Java code to its C and C++ repertoire.

To describe parts of embedded systems, designers will frequently use state machines, and that often means leveraging modeling tools like UML. These models are sometimes part of the certification process for safety-related applications. Turning these models into code can be challenging, especially if one needs to keep the model in sync with the code.

IAR’s Visual State (Fig. 1) allows designers to graphically construct state-machine models using the Visual State Designer. The hierarchical IAR models are compatible with the UML standard.

IAR’s Visual State

1. IAR’s Visual State allows designers to graphically create state machines and then turn models into C, C++, C#, or Java code.

Models can then be turned into C, C++, C#, or Java source code using the Visual State Coder tool. C# and Java are new additions. Changes made to the model can be easily turned into source code, allowing an application to be created from the latest model.

Visual State would be useful just for its ability to create source code, but it includes other handy features. The Validator, a state-machine simulation tool, allows a model to be tested regardless of what code will eventually be generated. The Verificator tool provides formal system verification. It can check for errors like state dead ends, ambiguous assignments, and unused elements.

For example, the Documenter tool is used to generate documentation reports in HTML or RTF formats. It correlates information from the Validator, Verificator, and Coder tools.

Visual State will work with any toolset since it generates source code, but it’s integrated with IAR’s own Embedded Workbench IDE (Fig. 2). A similar workflow would be used with any other toolset. The advantage of using IAR’s IDE comes when debugging and application. It supports state-machine breakpoints.

Visual State is integrated with IAR Embedded Workbench IDE

2. Visual State is integrated with IAR Embedded Workbench IDE.

IAR’s IDE also supports MISRA C/C++ compliance. Visual State includes an option to support the standard, addressing details such as avoiding embedding assignments in subexpressions.

SourceESB banner with caps

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish