Code Definition and Mapping Limitations and Considerations - MATLAB & Simulink (original) (raw)

Limitations

Default Code Mapping Constraints

Unresolved Code Definitions

If someone removes the definition for a storage class, function customization template, or memory section from the Embedded Coder Dictionary associated with a model, the Code Mappings editor identifies the definition as Unresolved. For example, this figure shows that the function customization template for execution entry-point functions was removed from the dictionary associated with the model.

To fix the unresolved code definition, do one of the following:

Model Editing Operations and Individual Data Element Code Mappings

While editing a model in the context of a coder app, you should be aware of the relationship between Simulink model editing tools, such as copy and undo, and code mappings. In the context of a coder app, when you perform copy-and-paste or cut-and-paste editing operations within a model, the coder app preserves the code mappings for individual data elements. For example, within a model, if you copy and paste the source block of a signal that is configured with a specific storage class, the pasted version of the signal port retains the same storage class.

While you can use undo and redo operations for editing actions on model data elements, they are unavailable while configuring code mappings. For example, if you delete a state block, and then click Undo, the block reappears in the model canvas and the code configuration for the state reappears in the code mappings. In theCode Mappings editor, if you change the storage class setting for a state from Auto to Model default, and then clickUndo, the storage class does not revert toAuto. In this case, the change pertains to the code mapping, not to the model data element.

Storage Classes and Reentrant, Multi-Instance Models and Components

The code that you generate from a model or component (referenced model or subsystem) is multi-instance code if it allows your application to maintain multiple independent instances of the component during execution. For example, you can generate reentrant, multi-instance code from an entire model by setting the model configuration parameter Code interface packaging toReusable function. For general information about multi-instance models and components, see Model Composition and Reuse.

Under some circumstances, applying storage classes can:

To avoid errors and unexpected generation of single-instance code and singleton data, observe the guidelines and limitations below.

Directly Applied Storage Classes

When you apply a storage class directly to a data element (see C Data Code Interface Configuration for Model Interface Elements):

Storage Classes Applied by Default

When you apply a default storage class (see C Data Code Interface Configuration for Model Interface Elements):

For more information, see What Is Reentrant Code? and Choose Storage Class for Controlling Data Representation in Generated Code.

Copy Code Mappings When Converting Subsystems to Referenced Models

You can copy code mappings when you convert a subsystem to a referenced model.

See Also

Code Mappings Editor – C | coder.mapping.api.CodeMapping

Topics