5 min. reading time
Yakindu_CREATE_300px Information: YAKINDU Statechart Tools Is Now itemis CREATE
One of the new features offered by the Professional Edition of YAKINDU Statechart Tools is the integration of statecharts with custom C code.
This feature, called deep C integration, allows for accessing C function, variable and type declarations directly inside a state machine model. The generated code directly uses your custom code, avoiding implementation of boiler-plate glue code. Statecharts using C declarations can be even simulated to validate their behavior independent of code generation.

Using C Declarations in Statecharts

In order to create a statechart with integrated C access use the new C Statechart creation wizard by navigating to File -> New -> C Statechart Model.  The tool recognizes header files in your workspace and transforms contained declarations into the SCT specific type model that is utilized by the statechart editor. Thereby the tool understands

  • function declarations,
  • external variable declarations,
  • typedefs for primitive types and
  • typedefs for complext types, i.e. structs, unions and enums.

These elements can be accessed in statechart models, for example to create and use variables of your own C datatypes or to reference your C function declarations. In addition to your custom types, the C99 standard primitive types, like int16_t, are also available out of the box.

The editing features of the statechart editor, like code completion, hyperlink navigation and type-checking increase your modelling productivity. You can use the content assistant (Ctrl+Space) to see members of complex types or function signatures. Pressing Ctrl (or Cmd on Mac) allows for direct navigation between your statechart and your header files. The type-checker recognizes when a wrong type is used in an expression and shows error markers accordingly. In this way, modelling statecharts becomes a natural extension to writing C code.

Generating Statechart Code

Generating statechart code works in the same way as in the Open Edition of YAKINDU Statechart Tools. The generator configuration is still defined in an .sgen file and even the generator ID yakindu::c did not change. The tool decides how to generate C code based on the statechart's domain. In case of statecharts using the deep C integration feature, all references to C elements are investigated and corresponding include statements added to the generated statechart header. Since these include statements are always relative to the generation target folder, your code stays portable to other devices.


What's Next?

As the current release of the Professional Edition is a Beta version only, it has some limitations that we strive to tackle for the official release. Among these, the capability to use arrays and pointers is probably the most useful feature for real life development scenarios. Therefore, we plan to incorporate this in the next release. 

Apart from this, it is also planned to implement type range validations. Assigning an int32_t variable to an int8_t variable would then result in a corresponding warning. This allows for spotting potential bugs already during statechart modelling or simulation where exceeding type limits could be checked.

Getting Started

You can try out the YAKINDU Statechart Tools Professional Edition for free! 

As usual, we appreciate all feedback, be it a bug report, a feature request or a technical question. Please do not hesitate to use the Mail Support function in the tool or directly write an e-mail to sct-pro@itemis.de

Download and try  YAKINDU Statechart Tools

For a kick start, watch our screencasts and read our tutorial.