Embedded Coder Dictionary - Create code definitions to control code generation for model data and

        functions - MATLAB ([original](https://www.mathworks.com/help/ecoder/ref/embeddedcoderdictionary.html)) ([raw](?raw))

Main Content

Create code definitions to control code generation for model data and functions

Description

The Embedded Coder® Dictionary is a file that you use to store and control the code interface configuration. In the interface configuration, you create custom code interface definitions that define how the generated code interacts with the target platform software on which you deploy the code. By applying the configuration to models, you and your users can generate code that conforms to a specific software architecture by default. For example, you can create your own storage class, which you and your users can apply by default to a category of model data, such as root-level inputs, or to individual data elements, such as parameters.

A dictionary contains only one of these types of interface configurations:

In the interface configuration you can create these types of code interface definitions:

For general information about creating code generation definitions, see Define Service Interfaces, Storage Classes, Memory Sections, and Function Templates for Software Architecture.

A model, not shared, Embedded Coder Dictionary

More

Open the Embedded Coder Dictionary

Examples

Create and Verify Storage Class

In a model, create a storage class that aggregates internal model data, including block states, into a structure whose characteristics you can control. Then, verify the storage class by generating code from the model.

  1. Open the model RollAxisAutopilot by entering this in the MATLAB® Command Window:
    openExample("RollAxisAutopilot");
  2. If the model does not open in the Embedded Coder app, open the app and click the C Code tab.
  3. On the C Code tab, select Code Interface > Embedded Coder Dictionary. The Embedded Coder Dictionary window displays code generation definitions that are stored in the model file.
  4. On the left pane, click Storage Class. In theStorage Classes section, clickCreate.
  5. Select the new storage class that appears at the bottom of the list, StorageClass1. In the pane on the right, set the property values listed in this table.
    Property Value
    Name InternalStruct
    Header File internalData_$R.h
    Definition File internalData_$R.c
    Storage Type Structured
    Structure Properties > Type Name internalData_T_$M
    Structure Properties > Instance Name internalData_$M
    After making your changes, in the bottom pane, verify that the pseudocode preview reflects what you expect.
  6. Return to the model editor. To open the Interface editor, below the canvas, double-click Code Mappings. On theData Defaults tab, expand theSignals section. Select the Signals, states, and internal data row and set Storage Class to InternalStruct.
  7. In the Configuration Parameters dialog box, on the Code Generation > Code Placement pane, setFile packaging format toModular.
  8. Generate code.
  9. In the Simulink Editor Code view, open and inspect the fileinternalData_RollAxisAutopilot.h. The file defines the structure type internalData_T_, whose fields represent block states in the model.
    /* Storage class 'InternalStruct', for system '' /
    typedef struct {
    real32_T FixPtUnitDelay1_DSTATE; /
    '/FixPt Unit Delay1' /
    real32_T Integrator_DSTATE; /
    '/Integrator' /
    int8_T Integrator_PrevResetState; /
    '/Integrator' /
    } internalData_T_;
    The file also declares a global structure variable namedinternalData_.
    /
    Storage class 'InternalStruct' */
    extern internalData_T_ internalData_;
  10. Open and inspect the fileinternalData_RollAxisAutopilot.c. The file allocates memory for internalData_.
    /* Storage class 'InternalStruct' */
    internalData_T_ internalData_;

Create Function Customization Template

With a function template, you can specify a rule that governs the names of generated entry-point functions. This technique helps save time and maintenance effort in a model that has many entry-point functions, such as an export-function model or a multirate, multitasking model.

This example shows how to create a function template that specifies the naming rule func_$N_$R. $N is the base name of each generated function and $R is the name of the Simulink model.

  1. Open the example modelMultirateMultitaskingBareBoard.
  2. Update the block diagram. This multitasking model has two execution rates, so the generated code includes two corresponding entry-point functions.
  3. In the model, set model configuration parameter System target file to ert.tlc. To use a function customization template, you must use an ERT-based system target file.
  4. In the Simulink Editor, open the Embedded Coder app and open the Embedded Coder Dictionary.
  5. In the Embedded Coder Dictionary, on the Function Customization Template tab, click Create.
  6. For the new function template, set these properties:
    • Name tomyFunctions.
    • Function Name tofunc_$N_$R.
      After making your changes, verify that the pseudocode preview reflects what you expect.
  7. In the model window, open the Code Mappings editor. On theFunction Defaults tab, for theInitialize/Terminate andExecution rows, set Function Customization Template tomyFunctions.
  8. Generate code.
  9. In the Code view, open and inspect the fileMultirateMultitaskingBareBoard.c. The file defines the two execution functions,func_step0_MultirateMultitaskingBareBoard andfunc_step1_MultirateMultitaskingBareBoard, whose names conform to the rule that you specified in the function template.

For an example that shows how to create a memory section, see Control Data and Function Placement in Memory by Inserting Pragmas.

Create Storage Class for Use with Statically and Dynamically Initialized Data

This example shows how to create a storage class that places global variable definitions and declarations in files whose names depend on the model name. You create two copies of the storage class so that you can use one copy with parameter data (the data category Model parameters) and one copy with other data.

Typically, the generated code initializes parameter data statically, outside any function, and initializes other data dynamically, in the model initialization function. When you create a storage class by using the Custom Storage Class Designer or an Embedded Coder Dictionary, you set theData Initialization property to specify the initialization mechanism.

In an Embedded Coder Dictionary, for each storage class, you must selectStatic or Dynamic initialization. Consider creating one copy of the storage class for parameter data (Static) and one copy for other data (Dynamic).

Create Storage Class

  1. Open the model RollAxisAutopilot by typing this command:
    openExample("RollAxisAutopilot");
  2. If the C Code tab is not open, open the Embedded Coder app and click the C Code tab.
  3. Select Code Interface > Embedded Coder Dictionary.
  4. On the left pane, click Storage Class. In theStorage Classes section, clickCreate.
  5. For the new storage class, set these properties:
    • Name toSigsStates
    • Header File to$R_my_data.h
    • Definition File to$R_my_data.c
    • Data Initialization toDynamic
      After making your changes, verify that the pseudocode preview reflects what you expect.
  6. Place your cursor over the row for the storage classSigsStates and click Duplicate code definition. A new storage class,SigsStates_copy, appears.
  7. For the new storage class, set these properties:
    • Name toParams
    • Data Initialization toStatic
      Verify that the pseudocode preview reflects what you expect.

Apply Storage Class and Generate Code

  1. In the model, open the Code Mappings editor. Below the model canvas, double-click Code Mappings - Component Interface.
  2. On the Data Defaults tab, for the Parameters > Model Parameters row, in the Storage Class column, select Params.
  3. For the Signals > Signals, states, and internal data row, set Storage Class toSigsStates.
  4. Configure some parameter data elements in the model so that optimizations do not eliminate those elements from the generated code. On the Modeling tab, click Design > Model Workspace.
  5. In the Model Explorer, on the center pane, select the three rows that correspond to the variables dispGain,intGain, and rateGain in the model workspace.
  6. Right-click one of the rows and click Convert to parameter object. The Model Data Editor converts the workspace variables to Simulink.Parameter objects.
  7. In the row for the parameter dispGain, in theStorage Class column, clickConfigure. The model window highlights the row for the dispGain parameter in the Code Mappings editor.
  8. For each variable, in the Storage Class column, select Model default: Params, which means that they acquire the default storage class that you specified forModel parameters.
  9. In the Configuration Parameters dialog box, on the Code Generation > Code Placement pane, set File packaging format toModular.
  10. Generate code.
  11. In the Code view, open and inspect the filesRollAxisAutopilot_my_data.c andRollAxisAutopilot_my_data.h. These files define and declare global variables that correspond to the parameter objects and some block states, such as the state of theIntegrator block in theBasicRollMode subsystem.
    /* Storage class 'SigsStates' /
    real32_T rtFixPtUnitDelay1_DSTATE;
    real32_T rtIntegrator_DSTATE;
    int8_T rtIntegrator_PrevResetState;
    /
    Storage class 'Params' */
    real32_T dispGain = 0.75F;
    real32_T intGain = 0.5F;
    real32_T rateGain = 2.0F;

Refer to Code Generation Definitions in a Package

You can configure an Embedded Coder Dictionary to refer to code generation definitions that you store in a package (see Create Code Definitions for External Data Objects). Those definitions then appear available for selection in the Code Mappings editor. In this example, you configure the Embedded Coder Dictionary inRollAxisAutopilot to refer to definitions stored in the built-in example package ECoderDemos.

  1. Open the Embedded Coder Dictionary forRollAxisAutopilot. For instructions, see Create and Verify Storage Class.
  2. In the Embedded Coder Dictionary window, on theMemory tab, click Manage Packages.
  3. In the Manage Packages dialog box, click Refresh. Wait until more options appear in the Select package drop-down list.
  4. Set Select package toECoderDemos and clickLoad.
    In the Embedded Coder Dictionary window, on the Storage Classes tab, the table shows the storage classes defined in the ECoderDemos package. Now, inRollAxisAutopilot, you can select these storage classes in the Code Mappings editor on the Data Defaults tab.
  5. To unload the package, in the Manage Packages dialog box, select the package in the Select package drop-down list and clickUnload.

For an example that shows how to share code generation definitions between models by using data dictionaries, see Share Code Interface Configuration Between Models.

For an example that shows how to configure default code mappings in a shared Embedded Coder Dictionary, see Configure Default Code Mapping in a Shared Dictionary.

Parameters

expand all

These properties appear in the right pane in the Embedded Coder Dictionary window.

Storage Classes

Name — Name of storage class

StorageClass1 (default) | text

Description — Purpose and functionality of storage class

text

Custom text that you can use to describe the purpose and functionality of the storage class.

Data Source — Location of storage class definition

text

Data Access — Specification to access the data

Direct (default) | Function | Pointer

Specification to access data associated with the model. Access the data directly (Direct), through customizableget and set functions (Function), or by using a pointer (Pointer). For more information, see Access Data Through Functions by Using Storage Classes in Embedded Coder Dictionary.

Dependencies

In addition, setting this property to Function enables these properties:

Data Scope — Specification to generate data definition

Exported (default) | Imported

Specification that the generated code define the data (Exported) or import (Imported) the data definition from external code. Built-in storage classes and storage classes in packages such as Simulink can use other scope options, such asFile.

Dependencies

Header File — Name of header file that declares data

$N.h (default) | text

Name of the header file that declares the data, specified as a name or naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Name of associated data element
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control

Dependencies

Definition File — Name of source file that defines data

$N.c (default) | text

Name of the source file that defines the data, specified as a name or naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Name of associated data element
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control

Dependencies

Setting Data Scope toImported disables Definition File. To include your external source code file in the build process, use model configuration parameters. For an example, seeConfigure Data Interface.

Access Mode — Specification to access data through functions

Value (default) | Pointer

Allowed Access — Specification to allow access to data through functions

Read/Write (default) | Read Only | Write Only

Specification for the storage class to allow read and write (Read/Write), read-only (Read Only), or write-only (Write Only) access to the data.

Dependencies

This property is enabled only when you set Data Access to Function.

Name of Getter — Name of the get function that fetches the associated data

get_$N$M (default) | text

Name of the get function that fetches the associated data, specified as a name or naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$N Name of associated data element (required)
$R Name of root model
$M Mangle text that ensures uniqueness
$U User token text. See Identifier Format Control.

Dependencies

This property is enabled only when you set Data Access to Function.

Name of Setter — Name of the set function that modifies the associated data

set_$N$M (default) | text

Name of the set function that fetches the modifies data, specified as a name or naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$N Name of associated data element (required)
$R Name of root model
$M Mangle text that ensures uniqueness
$U User token text. See Identifier Format Control.

Dependencies

This property is enabled only when you set Data Access to Function.

Use different property settings for single-instance and multi-instance data — Specification to assign separate storage settings

off (default) | on

Specification for the storage class to use either the storage settings that you specify in the Single-instance storage section or the storage settings that you specify in the Multi-instance storage section. When you apply the storage class to a data item, the Embedded Coder Dictionary determines if it is a single-instance storage class or a multi-instance storage class by the type of data and by the context of the model within the model reference hierarchy.

Dependencies

Selecting this property enables the sections Single-instance storage and Multi-instance storage. The properties Storage Type, Type Name, and Instance Name appear in both the Single-instance storage andMulti-instance storage sections.

Storage Type — Specification to aggregate data into a structure

Unstructured (default) | Structured

Specification to aggregate the data that uses the storage class into a structure in the generated code. Each data element appears in the code as a field of the structure. To create a structure, useStructured.

Dependencies

Setting this property to Structured enablesType Name and Instance Name.

Type Name — Name of structure type

$R$N$G$M (default) | text

Name of the structure type in the generated code, specified as a name or a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Base name of associated function, such asstep
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted, if necessary, to avoid name collisions

Dependencies

Setting Storage Type toStructured enables this property.

Instance Name — Name of structure variable

$N$G$M (default) | text

Name of the structure variable in the generated code, specified as a name or a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Base name of associated function, such asstep
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted, if necessary, to avoid name collisions

Dependencies

Setting Storage Type toStructured enables this property.

Data Initialization — How to initialize data

Auto (default) |Dynamic | Static |None

Specification that the generated code initialize the data.

Dependencies

Memory Section — Location in memory to allocate data

None (default) | existing memory section

Preserve array dimensions — Specification to preserve dimensions of multidimensional arrays

off (default) | on

Const — Specification to apply const qualifier

off (default) | on

Specification to apply the const qualifier to the data.

Dependencies

Volatile — Specification to apply volatile qualifier

off (default) | on

Specification to apply the volatile qualifier to the data.

Other Qualifier — Specification to apply a custom qualifier

text

Parameters — Whether to allow usage with model parameters

off (default) | on

Specification indicating whether to allow usage of the storage class with model parameters.

Dependencies

Signals — Whether to allow usage with model signals

on (default) | off

Specification indicating whether to allow usage of the storage class with model signals.

Dependencies

Function Customization Templates

Name — Name of function template

FunctionTemplate1 (default) | text

Name of the template. The name must be unique among the function templates in the dictionary. Embedded Coder provides the built-in templates listed in this table.

Description — Purpose and functionality of function template

text

Custom text that you can use to describe the purpose and functionality of the function template.

Data Source — Location of function template definition

text

This parameter is read-only.

The location of the function template definition.

Function Naming Rule — Names of generated functions

$R$N (default) | text

Names of the functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Base name of associated function, such asstep
$U User token text, which you specify for a model as described in Identifier Format Control
$C For shared utility functions, a checksum inserted to avoid name collisions
$M Name-mangling text inserted, if necessary, to avoid name collisions

Memory Section — Location in memory to allocate function

None (default) | existing memory section

Header File — Name of header file that declares function

text

Definition File — Name of source file that defines function

text

Memory Sections

Name — Name of memory section

text

Name of the memory section. The name must be unique among the memory sections in the dictionary. Embedded Coder provides the built-in memory sections listed in this table.

Memory Section Description
MemConst Apply the storage type qualifier const to the data.
MemVolatile Apply the storage type qualifiervolatile to the data.
MemConstVolatile Apply the storage type qualifiersconst and volatile to the data.

Description — Purpose and functionality of memory section

text

Custom text that you can use to describe the purpose and functionality of the memory section.

Data Source — Location of memory section definition

text

Comment — Comment to insert in the generated code

text

Code comment that the code generator includes with the pragmas or other decorations that you specify with Pre Statement andPost Statement.

Pre Statement — Code to insert before data or function code

text

Code, such as pragmas, to insert before the definitions and declarations of the data or functions that are in the memory section.

You can use the token $R to represent the name of the model that uses the memory section.

When you set Statements Surround to Each variable, you can use the token $N to represent the name of each variable or function that uses the memory section.

Post Statement — Code to insert after data or function code

text

Code, such as pragmas, to insert after the definitions and declarations of the data or functions that are in the memory section.

You can use the token $R to represent the name of the model that uses the memory section.

When you set Statements Surround to Each variable, you can use the token $N to represent the name of each variable or function that uses the memory section.

Statements Surround — Specification to wrap data and functions separately or in a group

Each variable (default) | Group of variables

Specification to insert code statements (Pre Statement and Post Statement):

Receiver Service Interfaces

Since R2022b

Name — Name of receiver service

text

Name of the receiver service. Embedded Coder provides the example services listed in this table.

Receiver Service Description
ReceiverExample1 Favor memory optimization over data freshness. The service reads data from another function before the function starts executing.
ReceiverExample2 Favor data freshness over memory optimization. The service reads data from another function immediately during execution.
ReceiverExample3 Use this option to maximize performance of component code or if mutual exclusion is inherent in component model design. The platform service reads data from generated function code directly by using memory that platform services manage for the target execution environment.

Data Communication Method — How receiver data transmission is handled

Outside Execution (default) | During Execution | Direct Access

How receiver data transmission is handled between the target platform service and the run-time environment, specified as one of these options:

Function Naming Rule — Names of generated receiver functions

text

Names of the receiver functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$G Service name
$N Element name
$X Current callable function
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted to avoid name collisions

Dependencies

To specify a function naming rule, you must set Data Communication Method to Outside Execution or During Execution.

Storage Class — Storage class definition

text

Storage class definition, specified as one of the definitions in theStorage Class section of the dictionary.

Dependencies

To specify a storage class receiver services, you must setData Communication Method to Direct Access.

Sender Service Interfaces

Since R2022b

Name — Name of sender service

text

Name of the sender service. Embedded Coder provides the example services listed in this table.

Sender Service Description
SenderExample1 Favor data freshness over memory optimization. The platform service reads data from another function immediately during execution.
SenderExample2 Favor memory optimization over data freshness. The service sends data to another function after the function executes.
SenderExample3 Use this option to maximize performance of component code or if mutual exclusion is inherent in component model design. The platform service reads data from generated function code directly by using memory that platform services manage for the target execution environment.

Data Communication Method — How sender data transmission is handled

Outside Execution (default) | During Execution | Direct Access

How sender data transmission is handled between the task and the run-time environment, specified as one of these options:

Function Naming Rule for Value — Names of generated sender functions

text

Names of the sender functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$G Service name
$N Element name
$X Current callable function
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted to avoid name collisions

Dependencies

To specify a function naming rule, you must set Data Communication Method to Outside Execution or During Execution.

Function Naming Rule for Value by Reference — Names of generated sender functions that use reference

text

Names of the sender functions that send a value by reference in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$G Service name
$X Current callable function
$U User token text, which you specify for a model as described in Identifier Format Control

Dependencies

To specify a function naming rule, the definition must be a data sender service and you must set Data Communication Method to Outside Execution orDuring Execution.

Storage Class — Storage class definition

text

Storage class definition, specified as one of the definitions in theStorage Class section of the dictionary.

Dependencies

To specify a storage class receiver services, you must setData Communication Method to Direct Access.

Data Transfer Service Interfaces

Since R2022b

Name — Name of data transfer service

text

Name of the data transfer service. Embedded Coder provides the example services listed in this table.

Data Transfer Service Description
DataTransferExample1 Favor data freshness over memory optimization. The platform service reads data from another function immediately during execution.
DataTransferExample2 Favor memory optimization over data freshness. The service receives and sends data from another function outside of function execution.

Data Communication Method — How data transmission is handled

Outside Execution (default) | During Execution

How data transmission is handled between the task and the run-time environment, specified as one of these options:

Receiver Function Naming Rule — Names of generated receiver functions

text

Names of the receiver functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Element name
$X Current callable function
$M Name-mangling text inserted to avoid name collisions

Sender Function Naming Rule — Names of generated sender functions

text

Names of the sender functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Element name
$X Current callable function
$M Name-mangling text inserted to avoid name collisions

Timer Services

Since R2022b

Name — Name of timer service

text

Name of the timer service. Embedded Coder provides the example service listed in this table.

Timer Service Description
TimerServiceExample1 The timer service executes outside of function execution.

Data Communication Method — How data transmission is handled

Outside Execution (default) | During Execution

How data transmission is handled between the task and the run-time environment, specified as one of these options:

Function Clock Tick Function Naming Rule — Clock tick function naming rule

text

Names of the clock tick functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$G Service name
$X Current callable function
$U User token text, which you specify for a model as described in Identifier Format Control

Dependencies

Parameter Tuning Interfaces

Since R2022b

Name — Name of parameter tuning service

Not tunable (default) | text

The name of the tuning service for parameters that need to be tuned. If the parameters do not need to be tuned, Name has the default value, Not tunable.

Storage Class — Name of storage class definition

text

Name of storage class definition to use with the tuning service, specified as one of the compatible definitions in the Storage Class section of the dictionary.

Note

The Storage Class is not applicable for theNot tunable entry.

Parameter Argument Tuning Interfaces

Since R2022b

Name — Name of parameter argument tuning service

Not tunable (default) | text

The name of the tuning service for parameter arguments that need to be tuned. If the parameter arguments do not need to be tuned,Name has the default value, Not tunable.

Storage Class — Name of storage class definition

text

Name of storage class definition to use with the tuning service, specified as one of the compatible definitions in the Storage Class section of the dictionary.

Note

The Storage Class is not applicable for theNot tunable entry.

Measurement Service Interfaces

Since R2022b

Name — Name of measurement service

Not measured (default) | text

The name of the measurement service for signals, states, and internal data elements that need to be measured. If the signals, states, and internal data elements do not need to be measured, Name has the default value, Not measured.

Storage Class — Name of storage class definition

text

Name of storage class definition to use with the measurement service, specified as one of the compatible definitions in the Storage Class section of the dictionary.

Note

The Storage Class for the Not measured entry cannot be configured. Model elements that are specified as Not measured and cannot be optimized away will be generated according to theStorage Class specified for theInternal Data section in the dictionary.

Limitations

For additional limitations for code generation definitions in the Embedded Coder Dictionary of a data dictionary (.sldd file), see Deploy Code Generation Definitions.

Version History

Introduced in R2018a

expand all

R2024a: Not measured and Not tunable as dictionary default

You can now specify Not measured as the default value of the Measurement Service Interfaces section in the coder dictionary, and you can specify Not tunable as the default value of the Parameter Tuning and Parameter Argument Tuning sections in the dictionary. The Not measured and Not tunable entries are included in the dictionary, and are preselected as default values in newly created dictionaries. You can select other entries as dictionary default for these sections, but you cannot delete these entries from the dictionary.

R2024a: Changes in service interfaces dictionary sections

R2022b: Create service interface configuration definition with service interfaces

When you create a shared coder dictionary in an SLDD file, you create either a data interface configuration or a service interface configuration definition in the dictionary:

Existing Embedded Coder Dictionaries contain a data interface configuration with the code definitions.

R2022b: Dictionary refreshes when you load model from earlier release

Package-based code definitions have changed. If your Embedded Coder Dictionary refers to code definitions that you store in a package, the dictionary refreshes when you load a model from an earlier release. To prevent the dictionary refresh, resave the model, or the Simulink data dictionary that contains the Embedded Coder Dictionary, in the current release.

R2021b: Pointer data access for storage classes

When you create an unstructured storage class, you can configure the storage class to use pointer data access. Set Data Scope toImported and set Data Access toPointer.

R2021a: Automatic data initialization for storage classes

For new storage classes, the default Data Initialization setting is now Auto. With this setting, you can apply the same storage class to signals, states, and parameters. The generated code statically initializes parameter data and dynamically initializes signal and state data.

Previously, the options for the Data Initialization setting were limited to Dynamic, Static, andNone.

R2020a: $R token for memory sections

You can now use the $R token in the Pre Statement and Post Statement for a memory section. $R expands to the model name. Previously, you could use only the $N token for memory sections. $N expands to the name of the data element or function.

R2019a: Preserve array dimensions in storage classes

To preserve the dimensions of array data that uses a storage class, select thePreserve array dimensions property for the storage class.

R2019a: get and set data access for storage classes

You can now define a storage class for root-level inports, root-level outports, and local parameters so that they can be accessed by customizableget and set functions. Set the newData Access property to Function. You can also configure these new properties:

R2019a: Storage classes with different settings for single-instance and multi-instance data

You can now create storage classes that use different settings for single-instance and multi-instance data. Select the new property Use different property settings for single-instance and multi-instance data. For single-instance data, you can specify the storage type and structure properties. You can separately specify the structure properties for multi-instance data.

When you apply the storage class to a data item, the Embedded Coder Dictionary implements either the single-instance settings or the multi-instance settings depending on the type of data and the context of the model within the model reference hierarchy.

R2019a: Load multiple packages in one dictionary

You can now load and refer to code definitions from multiple packages in one dictionary.

R2019a: Use code definitions from local and shared Embedded Coder Dictionaries

When a shared Embedded Coder Dictionary is attached to the model, the model can use the code definitions from both the shared dictionary and the local Embedded Coder Dictionary of the model. The local Embedded Coder Dictionary of the model displays the shared definitions as read-only.

R2018b: Restrict mapping of storage classes to parameters or signals

Specify whether users can map a storage class to parameters, signals, or parameters and signals. To allow users to map a storage class to each category, select one or both of the new properties Parameters andSignals.

R2018b: Select default definitions in shared Embedded Coder Definitions

For a shared Embedded Coder Dictionary, which is saved in an SLDD file, you can select the default code definition for each category of data or functions.

R2018b: Pseudocode preview for code definitions

When you create a code definition in the Embedded Coder Dictionary, you can view a pseudocode preview of the code that will generate for the function or data item that uses the code definition.

MathWorks - Domain Selector