Migration of Memory Section and Shared Utility Settings from Configuration Parameters to Code Mappings
For a model created in a release before R2018a, when you open the Embedded Coder app
or use the coder.mapping.create
function, Simulink® migrates memory section and shared utility settings from the configuration
parameters to the code mappings of the model. As part of the migration, Simulink configures the Embedded Coder Dictionary that the model uses:
To refer to the package that defines the memory sections, as described in Refer to Code Generation Definitions in a Package.
To contain a function customization template that specifies the naming rule and, if applicable, memory section settings that you specified for shared utilities.
Effects of Migration
The migration process makes changes to the model file, which you must save. The changes include:
Translation of the configuration parameter settings into code mappings.
If no data dictionary is attached to the model, configuration of the internal Embedded Coder Dictionary in the model file to refer to the memory section package and to contain a function customization template.
If a data dictionary is attached to the model, the migration process makes changes to the dictionary, which you must save. The changes include:
If the configuration parameters are stored in the model file (the model does not refer to a
Simulink.ConfigSet
object), configuring the Embedded Coder Dictionary of the data dictionary to refer to the memory section package and to contain a function customization template.If the data dictionary references other dictionaries, the migration process configures the dictionary at the bottom of the reference hierarchy so other models and dictionaries in the hierarchy can use the memory section and function template definitions.
If the model refers to a
Simulink.ConfigSet
object, configuring the Embedded Coder Dictionary of the data dictionary that stores the object.
Considerations Before Migrating
When you open the Embedded Coder app, Simulink executes the migration process. Do not open the Embedded Coder app unless you are ready to migrate memory section and shared utility naming settings.
If a model has multiple configuration sets (one active and one or more inactive) or refers to a
Simulink.ConfigSet
object, the Embedded Coder app displays an informational message indicating that information from the referenced configuration set has been imported into the Embedded Coder Dictionary and code mappings.If you use Simulink data dictionaries, before you or other users open the Embedded Coder app for a model, consider creating and configuring the dictionaries first.
In a hierarchy of referenced data dictionaries (for example, a dictionary hierarchy that parallels a model hierarchy), only one dictionary can contain an Embedded Coder Dictionary. Setting up data dictionaries before migrating associated models enables you to control where the Embedded Coder Dictionary resides in the dictionary hierarchy. Create or identify a data dictionary at the bottom of the hierarchy so that models in the hierarchy can access the memory section and function template definitions. Then, when you initiate migration by opening Embedded Coder app for a model, Simulink configures that data dictionary.
For information about sharing an Embedded Coder Dictionary between models by using referenced dictionaries, see Share Code Interface Configuration Between Models.
The migration process makes changes based on the active configuration set of the model (see Manage Configuration Sets for a Model) when you open the model in the Embedded Coder app. Before you open the model in the Embedded Coder app, activate the configuration set whose settings you want the migration process to use.
The process ignores settings in inactive configuration sets. If different configuration sets of the model specify different settings, you must choose one set to migrate.
Considerations After Migrating
In a branching hierarchy of referenced models and referenced data dictionaries, after you or other users migrate referenced models in different branches, opening the Embedded Coder app in a parent model can generate an error due to the presence of multiple Embedded Coder Dictionaries in the data dictionary hierarchy. To resolve these errors, use
coder.dictionary.move
andcoder.dictionary.remove
to transfer and delete Embedded Coder Dictionaries until only one dictionary remains. Place the remaining Embedded Coder Dictionary in a data dictionary at the bottom of the hierarchy so that the models in the hierarchy can access the memory section and function template definitions.For information about sharing an Embedded Coder Dictionary between models by using referenced dictionaries, see Share Code Interface Configuration Between Models.
After you migrate a model, memory section and shared utility model configuration parameters are not accessible. If you use
set_param
orget_param
to access these configuration parameter settings programmatically, the functions generate errors. To change these settings, use the Code Mappings editor or the programmatic interface as described in C Data and Function Interfaces.If a model contains atomic subsystems that have nondefault memory section settings, you can select the memory sections from built-in packages that are loaded into the Embedded Coder Dictionary. See Override Default Memory Placement for Individual Data Elements and Override Default Memory Placement for Subsystem Functions and Data.
If a model refers to a
Simulink.ConfigSet
object, after migration, the model does not use the memory section and shared utility settings in the object. If you used the object to set the configuration parameters of multiple models:Changing memory section and shared utility settings in the object affects only models that you have not migrated.
Migrated models do not acquire memory section and shared utility settings from a single location (the
Simulink.ConfigSet
object). To change the settings for these models, use the Code Mappings editor of each model.
See Also
Embedded Coder Dictionary | Code Mappings Editor – C
Related Topics
- C Code Generation Configuration for Model Interface Elements
- Define Service Interfaces, Storage Classes, Memory Sections, and Function Templates for Software Architecture
- Configure Default C Code Generation for Categories of Data Elements and Functions
- Control Data and Function Placement in Memory by Inserting Pragmas
- Generate Shared Utility Code
- C++ Data and Function Interfaces