| Real-Time Workshop® Embedded Coder™ | ![]() |
| On this page… |
|---|
Template Symbol Groups and Template Symbols describe MPF template symbols and rules for using them. The location of a symbol in one of the supplied template files (code_c_template.cgt, code_h_template.cgt, data_c_template.cgt, or data_h_template.cgt) determines where the items associated with that symbol are located in the corresponding generated file. Template Symbol Groups identifies the symbol groups, starting with the parent ("Base") group, followed by the children of each parent. Template Symbols lists the symbols alphabetically.
| Symbol Group | Symbol Names in This Group |
|---|---|
Base (Parents) | Declarations Defines Definitions Documentation Enums Functions Includes Types |
Declarations | ExternalCalibrationLookup1D ExternalCalibrationLookup2D ExternalCalibrationScalar ExternalVariableScalar |
Defines | LocalDefines LocalMacros |
Definitions | FilescopeCalibrationLookup1D FilescopeCalibrationLookup2D FilescopeCalibrationScalar FilescopeVariableScalar GlobalCalibrationLookup1D GlobalCalibrationLookup2D GlobalCalibrationScalar GlobalVariableScalar |
Documentation | Abstract Banner Created Creator Date Description FileName History LastModificationDate LastModifiedBy ModelName ModelVersion ModifiedBy ModifiedComment ModifiedDate Modified History |
Notes ToolVersion | |
Functions | CFunctionCode |
Types | This parent has no children. |
| Symbol Name* | Symbol Group | Symbol Scope | Symbol Description (What the symbol puts in the generated file) |
|---|---|---|---|
Abstract | Documentation | N/A | User-supplied description of the model or file. Placed in the generated file based on the Stateflow® note, Simulink® annotation, or DocBlock on the model.** |
Banner | Documentation | N/A | Comments located near top of the file. Contains information that includes model and Real-Time Workshop® versions, and date file was generated. |
CFunctionCode | Functions | File | All of the C/C++ functions. Must be at the bottom of the template. |
Created | Documentation | N/A | Date when model was created. From Created on field on Model Properties dialog box. |
Creator | Documentation | N/A | User who created model. From Created by field on Model Properties dialog box. |
Date | Documentation | N/A | Date file was generated. Taken from computer clock. |
Declarations | Base | Data declaration of any signal or parameter. For example, extern real_T globalvar;. | |
Defines | Base | File | Any necessary #defines of .h files. |
Definitions | Base | File | Data definition of any signal or parameter. |
Description | Documentation | N/A | Description of model. From Model description field on Model Properties dialog box.** |
Documentation | Base | N/A | Comments about how to interpret the Real-Time Workshop generated files. |
Enums | Base | File | Enumerated data type definitions. |
ExternalCalibrationLookup1D | Declarations | External | *** |
ExternalCalibrationLookup2D | Declarations | External | *** |
ExternalCalibrationScalar | Declarations | External | *** |
ExternalVariableScalar | Declarations | External | *** |
FileName | Documentation | N/A | Name of the generated file. |
FilescopeCalibrationLookup1D | Definitions | File | *** |
FilescopeCalibrationLookup2D | Definitions | File | *** |
FilescopeCalibrationScalar | Definitions | File | *** |
FilescopeVariableScalar | Definitions | File | *** |
Functions | Base | File | Generated function code. |
GlobalCalibrationLookup1D | Definitions | Global | *** |
GlobalCalibrationLookup2D | Definitions | Global | *** |
GlobalCalibrationScalar | Definitions | Global | *** |
GlobalVariableScalar | Definitions | Global | *** |
History | Documentation | N/A | User-supplied revision history of the generated files. Placed in the generated file based on the Stateflow note, Simulink annotation, or DocBlock on the model.** |
Includes | Base | File | #include preprocessor directives. |
LastModificationDate | Documentation | N/A | Date when model was last saved. From Last saved on field on Model Properties dialog box. |
LastModifiedBy | Documentation | N/A | User who last saved model. From Last saved by field on Model Properties dialog box. |
LocalDefines | Defines | File | #define preprocessor directives from code-generation data dictionary. |
LocalMacros | Defines | File | C/C++ macros local to the file. |
ModelName | Documentation | N/A | Name of the model. |
ModelVersion | Documentation | N/A | Version number of the Simulink model. |
ModifiedBy | Documentation | N/A | Name of user who last modified the model. From Model version field on Model Properties dialog box. |
ModifiedComment | Documentation | N/A | Comment user enters in the Modified Comment field on the Log Change dialog box. See Creating a Model Change History in the Simulink documentation. |
ModifiedDate | Documentation | N/A | Date model was last modified before code was generated. |
ModifiedHistory | Documentation | N/A | Text from Modified history field on Model Properties dialog box.** |
Notes | Documentation | N/A | User-supplied miscellaneous notes about the model or generated files. Placed in the generated file based on the Stateflow note, Simulink annotation, or DocBlock on the model.** |
ToolVersion | Documentation | N/A | A list of the versions of the toolboxes used in generating the code. |
Types | Base |
| Data types of generated code. |
* All symbol names must be enclosed between %< >. For example, %<Functions>.
** This symbol can be used to add a comment to the generated files. See Adding Global Comments. The code generator places the comment in each generated file whose template has this symbol name. The code generator places the comment at the location that corresponds to where the symbol name is located in the template file.
*** The description can be deduced from the symbol name. For example, GlobalCalibrationScalar is a symbol that identifies a scalar. It contains data of global scope that you can calibrate .
The following are the rules for creating any MPF template. Comparison of a Template and Its Generated File illustrates several of these rules.
Place a symbol on a template within the %< > delimiter. For example, the symbol named Includes should look like this on a template: %<Includes>. Note that symbol names are case sensitive.
Place a symbol on a template where desired. Its location on the template determines where the item associated with this symbol is located in the generated file. If no item is associated with it, the symbol is ignored.
Place a C/C++ statement outside of the %< > delimiter, and on a different line than a %< > delimiter, for that statement to appear in the generated file. For example, #pragma message ("my text") in the template results in #pragma message ("my text") at the corresponding location in the generated file. Note that the statement must be compatible with your C/C++ compiler.
Use the .cgt extension for every template filename. ("cgt" stands for code generation template.)
Note that %% $Revision: 1.1.4.10.4.1 $ appears at the top of the MathWorks™ supplied templates. This is for internal MathWorks use only. It does not need to be placed on a user-defined template and does not show in a generated file.
Place a comment on the template between /* */ as in standard ANSI®[1] C. This results in /*comment*/ on the generated file.
Each MPF template must have all of the Base group symbols, in predefined order. They are listed in Template Symbol Groups. Each symbol in the Base group is a parent. For example, Declarations is a parent symbol.
Each symbol in a non-Base group is a child. For example, LocalMacros is a child.
Except for Documentation children, all children must be placed after their parent, before the next parent, and before the Functions symbol.
Documentation children can be located before or after their parent in any order anywhere in the template.
If a non-Documentation child is missing from the template, the code generator places the information associated with this child at its parent location in the generated file.
If a Documentation child is missing from the template, the code generator omits the information associated with that child from the generated file.
[1] ANSI is a registered trademark of the American National Standards Institute, Inc.
![]() | MPF Panes on the Configuration Parameters Dialog Box | mpt Parameter and Signal Properties | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |