| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Real-Time Workshop Embedded Coder |
| Contents | Index |
| Learn more about Real-Time Workshop Embedded Coder |
| On this page… |
|---|
Custom Storage Class Memory Sections |
During the Real-Time Workshop build process, the storage class specification of a signal, tunable parameter, block state, or data object specifies how that entity is declared, stored, and represented in generated code. Note that in the context of the Real-Time Workshop build process, the term "storage class" is not synonymous with the term "storage class specifier", as used in the C language.
The Real-Time Workshop software defines four built-in storage classes for use with all targets: Auto, ExportedGlobal, and ImportedExtern, and ImportedExternPointer. These storage classes provide limited control over the form of the code generated for references to the data. For example, data of storage class Auto is typically declared and accessed as an element of a structure, while data of storage class ExportedGlobal is declared and accessed as unstructured global variables. For information about built-in storage classes, see Signal Considerations and Simulink Data Object Considerations in the Real-Time Workshop documentation.
The built-in storage classes are suitable for many applications, but embedded system designers often require greater control over the representation of data. Real-Time Workshop Embedded Coder custom storage classes (CSCs) extend the built-in storage classes provided by the Real-Time Workshop software. CSCs can provide application-specific control over the constructs required to represent data in an embedded algorithm. For example, you can use CSCs to:
Every custom storage class has an associated memory section definition. A memory section is a named collection of properties related to placement of an object in memory; for example, in RAM, ROM, or flash memory. Memory section properties let you specify storage directives for data objects. For example, you can specify const declarations, or compiler-specific #pragma statements for allocation of storage in ROM or flash memory sections.
See Creating and Editing Memory Section Definitions for details about using the Custom Storage Class designer to define memory sections. While memory sections are often used with data in custom storage classes, they can also be used with various other constructs. See Inserting Comments and Pragmas in Generated Code for more information about using memory sections with custom storage classes, and complete information about using memory sections with other constructs.
CSCs are associated with Simulink data class packages (such as the Simulink package) and with classes within packages (such as the Simulink.Parameter and Simulink.Signal classes). The custom storage classes associated with a package are defined by a CSC registration file. For example, a CSC registration file is provided for the Simulink package. This registration file provides predefined CSCs for use with the Simulink.Signal and Simulink.Parameter classes and with subclasses derived from these classes. The predefined CSCs are sufficient for a wide variety of applications.
If you use only predefined CSCs, you do not need to be concerned with CSC registration files. By default, you cannot add or change CSCs associated with built-in packages and classes, but you can create your own packages and subclasses, then associate CSCs with those. See Custom Storage Class Implementation for more information.
Three demos are available that show Custom Storage Class capabilities:
rtwdemo_cscpredef — Shows predefined custom storage classes and embedded signal objects
rtwdemo_importstruct — Shows custom storage classes used to access imported data efficiently
rtwdemo_advsc — Shows how custom storage classes can support data dictionary driven modeling
To launch a demo, click the demo's name above, or type its name in the MATLAB Command Window.
![]() | Creating and Using Custom Storage Classes | Resources for Defining Custom Storage Classes | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |