Main Content

Build Process

Set up compiler or IDE, configure and initiate build process, troubleshoot compiler errors

Before you can build an executable program or shared library for a model, choose and set up a compiler or IDE and configure the target environment. Several methods are available for initiating the build process. Tooling is available for reloading, rebuilding, and relocating generated code.

If your system includes referenced models, reduce build time and control whether the code generator regenerates code for the top model.

To improve the speed of code execution, consider using available profiling capabilities.

Functions

expand all

packNGoPackage generated code in ZIP file for relocation
rtw_precompile_libsRebuild precompiled libraries within model without building model
rtwbuildBuild generated code from a model
rtwrebuildRebuild generated code from model
coder.buildstatus.closeClose Build Status window
coder.buildstatus.openOpen Build Status window
RTW.getBuildDirGet build folder information from model build information
Simulink.fileGenControlSpecify root folders for files generated by diagram updates and model builds
switchTargetSelect target for model configuration set

Topics

Build Process Workflows

Build Process Workflow for Real-Time Systems

Generate C code from a model and build an executable program.

Build Models from a Windows Command Prompt Window

Build models by running MATLAB with a batch file.

Rebuild a Model

Rebuild a model after customizing generated source code or makefiles.

Reload Generated Code

Reload generated code from the Model Explorer.

Build Integrated Code Within the Simulink Environment

Add support files and control model code generation and builds within the Simulink Environment.

Relocate Code to Another Development Environment

Use code generation and packaging options to relocate code and artifacts to another development environment.

Compile and Debug Generated C Code with Microsoft® Visual Studio®

Build a Visual Studio® Solution from a model.

Profile Code Execution Speed

Profile execution speed of generated code with TLC hook function interface.

Configure Build Process

Choose Build Approach and Configure Build Process

Build executable programs from generated code.

Template Makefiles and Make Options

Template makefiles that are built into the code generator.

Select C or C++ Programming Language

Choose C or C++ as the programming language for code generation.

Select and Configure C or C++ Compiler

Consider programming language compliance for generated code and select a compiler for the build process.

Troubleshoot Compiler Issues

Identify and fix issues that prevent compiler operation in the build process.

Run-Time Environment Configuration

Select and configure target environment that best aligns with your application goals

Reports for Code Generation

Access the generated code files and information about the generated code with the code generation report.

Configure Model for Debugging

Configure a model so that generated code and the build process are set for debugging.

Build Process Considerations

Manage Build Process Folders

Manage folders that the code generator creates.

Manage Build Process Files

Work with generated source files and dependency files that the code generator produces.

Manage Build Process File Dependencies

Work with generated source files and dependency files that the code generator produces.

Add Build Process Dependencies

Add dependency information for external code to the build process.

Build Process Support for Folder Names with Spaces or Special Characters

Troubleshoot build process errors that occur when file system issues prevent file processing.

Executable Program Generation

Build executable programs with the code generator.