Major application area of this code generation option is to complete the model-based design flow for software control units of embedded and real-time systems. In other words, ANSI C code synthesis of FSM models offers the possibility to transform a designed and verified model into functional equivalent ANSI C source code. With respect to some limitations the code generator supports all significant design elements of MLDesigner FSM models. The resulting source code can be customized for specific run-time systems, provided that the underlying C compiler is ANSI C conform.
Generator Input
MLDesigner provides automated ANSI C code generation for two generator input model types: FSM modules and single FSM models.
Generator Output
There are three categories of source files produced by the code generator.
Limitations
Some design limitations and conditions are necessary to ensure widespread and efficient usage of the ANSI C source code, produced by the code generator.
Code Generation Process
ANSI C code synthesis for either an FSM module or single FSM model can be activated by the
icon available in the Modeling toolbar or model context menu.
Run-time Environment
To ensure an equivalent execution behavior between a generator input model and its corresponding ANSI C code implementation, the generator output includes an additional run-time environment.
Output Source Files
The set of generator output files includes ANSI C declaration header (*.h) as well as definition source (*.c) files, which are partially dependent on each other. With respect to older C compilers, all source file names are limited to 8 characters.
Code Customization
An accurate and efficient execution of a generated FSM module application on a specific run-time system is affected by several hardware/software architecture layers.
Code Debugging
ANSI C code synthesis of MLDesigner FSM models supports monitoring of relevant information within several areas of generated FSM module applications.
Example
This example shows how ANSI C code synthesis for MLDesigner FSM models is used to develop a controller application for a Hitachi H8 microcontroller.