MATLAB Answers

Package generated code with the minimal set of files necessary for compilation using packNGo

4 views (last 30 days)
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?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Feb 2019
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 Comments

Sign in to comment.

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!