Manage Build Process Folders - MATLAB & Simulink (original) (raw)
The build process places generated files from Simulink® diagram updates and model builds into a hierarchy of folders that is specified by default. You can change the default specification for build process folders, if, for example:
- Your company does not use the current working folder as the location for the code generation folder or the simulation cache folder.
- You place the code generation folder under version control, but do not place the simulation cache folder under version control.
The MATLAB® session parameters CacheFolder
,CodeGenFolder
, and CodeGenFolderStructure
are file generation control parameters that specify the folder locations for the build process. At the start of a MATLAB session, these Simulink preferences determine the values of the parameters:
Simulation cache folder –CacheFolder
Code generation folder –CodeGenFolder
Code generation folder structure –CodeGenFolderStructure
To modify the parameters during a MATLAB session, use Simulink.fileGenControl. The parameter values that you set expire at the end of the MATLAB session.
File Generation Control Parameters
This table provides information about how you can use the parameters to manage build process folders.
MATLAB Session Parameter | Simulink Preference | Description |
---|---|---|
CacheFolder | Simulation cache folder | The build process places generated files from Simulink diagram updates and model build artifacts for simulation and code generation in the simulation cache folder_simulationCacheFolder_. The folder is a root folder.By default (CacheFolder = ''),simulationCacheFolder is the current working folder, pwd.You can use the parameter to specify another folder. For example, if you want to: Separate generated files from the models and other source material.Reuse or share previously built simulation targets without having to set the current working folder back to a previous working folder. |
CodeGenFolder | Code generation folder | The build process, which uses system target files to generate production code from a Simulink model, places the production code in the code generation folder_codeGenerationFolder_. The folder is a root folder.If you choose to generate an executable program file, the build process writes the file_model_.exe (Windows®) or model (UNIX®) to the folder.By default (CodeGenFolder = ''), codeGenerationFolder is the current working folder, pwd.You can use the parameter to specify another folder. For example, if you want to separate generated production code from: Models and other source material.Generated simulation and code generation artifacts.If you specify the root folder of a drive as the code generation folder, the build process cannot generate code for your model. For example, C:\. |
CodeGenFolderStructure | Code generation folder structure | To specify the folder structure within the code generation folder, use the parameter. For example, if you configure models for different target environments, you can specify a separate subfolder for the generated code from each model. |
Build Process Folders
This table provides information about howCodeGenFolderStructure
controls the folder structure within the simulation cache folder and the code generation folder.
Folder Name when CodeGenFolderStructure ='ModelSpecific' | Folder Name when CodeGenFolderStructure ='TargetEnvironmentSubfolder' | Description |
---|---|---|
codeGenerationFolder/model_ target_rtwThe default for target is the name of the selected system target file, for example, grt, ert, andrsim. You can change target with the rtwgensettings.BuildDirSuffix field in the system target file. | codeGenerationFolder/targetSpecific/_model_The build process uses configuration information for the system target file and the hardware device to produce a unique label for the subfolder,targetSpecific. | Build folder, which stores generated source code and other files created by the build process.Contains the generated code modules,model.c and_model_.h, and generated makefile,model.mk.model.mk is for compiling and linking code generated from model components.model is the name of the source model. |
codeGenerationFolder/model_ target_rtw/services | codeGenerationFolder/targetSpecific/model/services | Folder created when you generate code for a component model that uses a service code interface configuration. Containsservices.h, the header file that specifies function prototypes for target platform services.For more information, seeGenerate and Verify Code and Identify and Package Files for Deployment. |
codeGenerationFolder/model_ target_rtw/services/lib | codeGenerationFolder/targetSpecific/model/services/lib | Contains buildInfo.mat, which you use for building the component model library that represents the generated code compiled againstservices.h.For more information, see Generate and Verify Code and Identify and Package Files for Deployment. |
codeGenerationFolder/model_target_rtw/html | codeGenerationFolder/targetSpecific/model/html | Code generation report folder that contains report files generated by the build process. |
codeGenerationFolder/slprj/target/model | codeGenerationFolder/targetSpecific/_ref/model | Model reference target files. |
codeGenerationFolder/slprj/target/model/referenced_model_includes | codeGenerationFolder/targetSpecific/_ref/model/referenced_model_includes | Header files from models referenced by_model_. |
codeGenerationFolder/slprj/target/model/tmwinternal | codeGenerationFolder/targetSpecific/_ref/model/tmwinternal | MAT-files used during code generation. |
codeGenerationFolder/slprj/target/_sharedutils | codeGenerationFolder/targetSpecific/_shared | Utility functions for model reference system target files, which are shared across models.Folder also containsrtwshared.mk for compiling generated shared utility code |
simulationCacheFolder/slprj/sim/model | simulationCacheFolder/slprj/sim/model | Simulation target files for referenced models. |
simulationCacheFolder/slprj/sim/model/tmwinternal | simulationCacheFolder/slprj/sim/model/tmwinternal | MAT-files used during code generation. |
simulationCacheFolder/slprj/sim/_sharedutils | simulationCacheFolder/slprj/sim/_sharedutils | Utility functions for simulation system target files, which are shared across models. |
If the system target file is ERT-based, then these model configuration parameters also control the location of shared utility code:
- Shared code placement (
UtilityFuncGeneration
) - Existing shared code (
ExistingSharedCode
)
You can use RTW.getBuildDir to display build folder information for the model.
See Also
RTW.getBuildDir | Simulink.fileGenControl
Topics
- Manage Build Process Files
- Manage Build Process File Dependencies
- Add Build Process Dependencies
- Build Process Support for File and Folder Names
- Build Process Workflow for Real-Time Systems
- Generate Code for Model Reference Hierarchy
- Cross-Release Shared Utility Code Reuse
- Cross-Release Code Integration
- Generate Code and Simulate Models in a Project
- Generate Code and Simulate Models Programmatically with Project