How can I package generated code with the minimal set of files necessary for compilation using packNGo?

조회 수: 8 (최근 30일)
We are generating code from our Simulink model and would like to package the generated code into a folder with all necessary files for compilation, for example: simstruc.h, fixedpoint.h, tmwtypes.h, and simstruc_types.h in "matlabroot\simulink\include". The files are necessary may change depending on settings/blocks in the model.
However, the "packNGo" utility unnecessarily adds too many files. Instead of adding only the 4 necessary files for compilation, it will add 30 or even more. So code generation and compiling take much longer.
How can we package the generated code into a folder with the minimal set of files necessary for compilation?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2022년 9월 14일
편집: MathWorks Support Team 2022년 7월 28일
One of the limitations of the packNGo utility is that unnecessary files may be included even if they are not used. This happens because the utility includes additional files from the source and include paths, some of which may be unnecessary for your use case. The information for which files are to be included in the packaged zip folder is stored in an "RTW.buildInfo" object (for an example, see "model_ert_rtw\buildInfo.mat" file after generating code). The "packNGo" function is called with this "buildInfo" object for the model, as described here:
Therefore, if you would like to modify which files are included in the packaged folder you can modify the "buildInfo" object appropriately. Attached is a script that demonstrates how you might modify the "buildInfo" object to remove the "main" source files that are unnecessary. This script removes the "ert_main.c" or "rt_main.c" files that get generated. You can use this script as starting point to customize which files you want to be included in the packaged folder. More information on functions you can use with the "buildInfo" object can be found here:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by