Simulink custom target system file configuration (3) - make_rtw_hook.m file

foreword

The custom target system file consists of five major files:

  • xx.tlc system target file
  • xx_callback_handler.m RTW toolbox callback function
  • xx_make_rtw_hook.m tlc file call
  • xx_file_process.tlc file processes TLC files
  • xx_srmain.tlc controls the generation of the main function file

xx_make_rtw_hook.m hook function

During the compilation process, we need to perform certain operations when compiling and generating code, then we can use the hook method to add target-specific operations to the compilation process.

The execution flow of the compiled hook function is as follows:
Hook function execution flowAccording to this flow, we can perform the required operations in entry, before_tlc, ... exit respectively.

use of functions

When creating this file, it must be the same as the xx of the system target file. For example, my system target file is called zzz.tlc , then our function file is called zzz _make_rtw_hook.

Function prototype:

function STF_make_rtw_hook(hookMethod, modelName, rtwRoot, templateMakefile,buildOpts, buildArgs, buildInfo)

parameter:

hookMethod : A character vector specifying the phase of the compilation process that calls the STF_make_rtw_hook function. Inside the function, switch is used to schedule related codes.

The " entry " hook can be used to initiate the compilation process, change or verify settings before generating code. One of the uses of the " entry " hook is to re-run the auto-configuration script that was originally run at target selection time, so that the model parameters before and after script execution are compared for validation purposes.

Like me, I moved the generated .c and .h files into my project during the exit phase.

Because the implementation of the hook function is more complicated, the best way for the beginners of xdm is to modify it on the basis of the source code. For details, please refer to the hook function of the ert.tlc file: ert_make_rtw_hook .

Specific path: installation directory\toolbox\coder\embeddedcoder

Guess you like

Origin blog.csdn.net/dbqwcl/article/details/126958882