Real-Time Workshop Embedded Coder    

Code Generation with Custom Storage Classes

The procedure for generating code with data objects that have a custom storage class is similar to the procedure for code generation using Simulink data objects that have built-in storage classes. If you are unfamiliar with this procedure, please see the discussion of Simulink data objects in the Code Generation and the Build Process chapter of the Real-Time Workshop documentation.

To generate code with custom storage classes, you must

  1. Create one or more data objects of class Simulink.CustomParameter or Simulink.CustomSignal.
  2. Set the custom storage class property of the objects, as well as the class-specific attributes (if any) of the objects.
  3. Reference these objects as block parameters, signals, block states, or Data Store memory.

When generating code from a model employing custom storage classes, make sure that the Ignore custom storage classes option is not selected, as shown in this picture. This is the default for the Real-Time Workshop Embedded Coder.

When Ignore custom storage classes is selected:

Ignore custom storage classes lets you switch to a rapid prototyping target such as the generic real-time target (GRT), without having to reconfigure your parameter and signal objects.

When using the Real-Time Workshop Embedded Coder, you can control the Ignore custom storage classes option via the check box in the ERT code generation options (2) category of the Real-Time Workshop tab of the Simulation Parameters dialog box.

If you are using a target that does not have a check box for this option (such as a custom target) you can enter the option directly into the System target file field in the Target configuration category of the Real-Time Workshop pane. The following example turns the option on:


  Assigning a Custom Storage Class to Data Ordering of Generated Storage Declarations