| Real-Time Workshop Embedded Coder | ![]() |
Custom File Processing Templates
The ERT target now supports use of custom file processing templates (CFP template) during code generation. A CFP template is a TLC file that calls a high-level API, referred to as the code template API. The code template API simplifies generation of custom source code by letting you
.c) or header (.h) file. A CFP template can emit code to the standard generated model files (e.g., model.c, model.h, etc.) or generate files that are independent of model code.
#define or #include statements), or comments into each section as required.
model_initialize, model_step, etc.
Note that, although use of CFP templates simplifies custom code generation, the feature still requires some understanding of TLC programming. See the Target Language Ccompiler Reference Guide documentation to learn the basics of TLC.
The files provided to support custom file processing are located in the directory matlabroot/rtw/c/tlc/mw. The key files are
ertcodetemplatelib.tlc: A TLC function library that implements the code template API. ertcodetemplatelib.tlc also provides the comprehensive documentation of the API in the comments headers preceding each function.
example_file_process.tlc: An example CFP template, which you should use as the starting point for creating your own CFP templates. Guidelines and examples for creating a CFP template are provided in Generating Source and Header Files with a CFP Template below.
Once you have created a CFP template, you must integrate it into the code generation process, using the File customization template option. This option is located in the ERT code templates category of the Real-Time Workshop pane of the Simulation Parameters dialog (shown in the figure below).
The File customization template option specifies the name of a CFP template file to use when generating code files. This file must be located on the TLC path. The default CFP template is example_file_process.tlc.
| Generating Custom Code File Banners | Template Structure | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2010 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |