Custom Wrapper Generator

This is an overview of the custom wrapper, which is used to generate custom code for different targets.

The inline code generator's capacity to generate compact and efficient code makes it particularly useful for generating custom code for various targets for embedded usage. Different targets, however, require specific codes to be generated for certain operations. For example, the input and output operations, and the handling of interruptions, require often very target-specific code.

For the most part, the target-specific operations can be defined by blocks positioned on the "edges of the diagram," which are responsible for handling inputs and outputs, defining interfaces with external systems, or operations involving the definition of interruptions and clocks. These blocks need not be handled by the Inline code generator.

In the process of code generation, these wrapper blocks are replaced by input/output port blocks, resulting in a diagram, placed in a super block called the body super block, for which the inline code generator generates a body.c code. The latter is the same type of code generated for new block definition and FMU export.

This process of separating the wrapper blocks to create a diagram and applying the inline code generator to create the body is performed by the Custom wrapper and is fully automatic and transparent for the user.

The body.c defines functions associated with different clocks present in the model. They are exported as APIs in body.h to be used in main.c, which is to be generated for the target. The input and output codes provided by the wrapper blocks, along with the interrupt-specific code and calls to body APIs, make up the content of the main.c file to be generated.