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
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 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.
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.
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.
For a kick start, watch our screencasts and read our tutorial.