Target Language Compiler | ![]() ![]() |
Build Process
As part of the code generation process, Real-Time Workshop generates a model
.rtw
file from the Simulink model. This file contains information about the model that is then used to generate code. The code is generated through calls to a utility called the Target Language Compiler. The Target Language Compiler then converts these files into the desired language (e.g., C) and enables the code generation.
This section presents an overview of the build process, focusing more on the Target Language Compiler's role in this process.
The Target Language Compiler is a separate binary program that is included as a MEX-file. The Compiler compiles files written in the target language. The target language is an interpreted language, and thus, the Compiler operates on source files every time it executes. You can make changes to a target file and watch the effects of your change the next time you build a model. You do not need to recompile the Target Language Compiler binary or any other such large binary to see the effects of your change.
Because the target language is an interpreted language, some statements may never be compiled or executed (and hence not checked by the compiler for correctness).
In the above example, the Invalid_function_call
statement will never be executed. This example emphasizes that you should test all your the Target Language Compiler code with test cases that exercise every line.
![]() | Code Generation Architecture | A Basic Example | ![]() |