MATLAB: How to suppress the inclusion of legacy code source files while generating code for the S-function block in Real-Time Workshop 7.2 (R2008b)

custommodifysimulink codertlc

I have a model that utilizes legacy code via an S-function block generated using 'legacy code tool'. I would like to know if there is any way to suppress the inclusion of the related legacy code file when generating code using 'packNGo' command. I need this since the bigger project in which I am going to incorporate the generated code has all the relevant files included.

Best Answer

You can suppress the inclusion of the legacy code source file in the 'packNGo' generated zip file by appropriately modifying the TLC for the S-function. The Legacy Code Tool creates a TLC file for the S-function block. Within this TLC, you can comment out the lines:
%<LibAddToCommonIncludes("<headerfile.h>")>
%<LibAddToModelSources("<sourcefile.c>")>
where 'headerfile.h' and 'sourcefile.c' are the header and source files specified by the legacy code tool data structure.
Now when you generate code with the 'packNGo' option, the legacy code will not be included in the zip folder.