Real-Time Workshop    

Steps in the Build Process

Code generation begins with a two-step process, which is followed by two more steps whenever an executable is being compiled. The four steps (also summarized in The Build Process) are automatically completed when you click the Build button on the Real-Time Workshop dialog (assuming that Real-Time Workshop detects no constraints to generating code for your model; if it does, it will issue warnings):

  1. Real-Time Workshop analyzes your block diagram and compiles it into an intermediate hierarchical representation called model.rtw.
  2. The Target Language Compiler reads model.rtw and translates it to C code, which it places in a build directory within your working directory.
  1. If you have selected the Generate code only check box (in which case the Build button will be labeled Generate code), the process halts there.

  1. The Target Language Compiler constructs a makefile from the appropriate target makefile template, and places it in the build directory.
  2. Your system's make utility reads the makefile to compile source code, link object files and libraries, and generate an executable (called model or model.exe), which is left in your working directory.
  1. If Generate HTML report was selected (the default) under General code generation options, the MATLAB Help browser will display the report once the build is done. The report files occupy a directory called /html within the build directory. The report contents vary depending on the target, but all reports feature clickable links to generated source files, as well as hyperlinks in source header comments that cause the respective block in the model diagram to be highlighted.

    The model.rtw file will be deleted unless you selected Retain .rtw file under TLC Debugging options. There is no benefit to preserving this file (which is produced every time Real-Time Workshop generates code for a model, even if no changes were made), other than to refer to when debugging TLC scripts.

Additional details about each of the four steps are given below.


  Automatic Program Building 1. Analyze the Model