Main Content

Choose Code Interface for Code Generation

In addition to representing code interfaces as elements in your model design, for some elements, you must provide the code generator with mappings of those elements to code interfaces. The code generator uses the mappings to produce code that can interact with target platform services. You configure a model with a data or service interface, depending on your project requirements, deployment objective, and the code generation product that you are using. Service interfaces require Embedded Coder®.

As the following figure shows, you must configure a model to use a data code interface for application deployment or if you are using Embedded Coder and generating C++ class code. Code generated for application deployment is optimized to a specific scheduler (single-tasking, rate-monotonic, or concurrent) based on your model configuration.

For C component deployment, a service code interface offers benefits such as:

  • Customized interface code that includes built-in safeguards for maintaining data coherence for outside-execution and during-execution data communication

  • Customized code for data transfers between functions outside of (before and after) function execution

  • Support for accessing time values in tasks

  • Flexible scheduling

  • Mapping of model elements to complete interface abstractions rather than to storage classes and specific property settings

Choose between a data or service interface based on your project requirements and deployment objective.

For more information, see: