MATLAB: Do I receive an error message when compiling a Simulink model with large C-MEX S-functions using the Real-Time Workshop

bibccodefilesgenerationlargeobjectrtwsimulink codersplittingsubfiles

Why do I receive an error message when compiling a Simulink model with large C-MEX S-functions using the Real-Time Workshop?
When compiling a large model that uses multiple S-functions (large C-files), sometimes I receive the following error message during the building process:
### Invoking Target Language Compiler on b1.rtw
tlc -r b1.rtw C:\MATLAB\rtw\c\dos\drt.tlc -O.
-IC:\MATLAB\rtw\c\dos -IC:\MATLAB\rtw\c\tlc -aInlineParameters=0
### Loading TMW TLC function libraries
### Initial pass through model to cache user defined code
### Creating (RealTime) source file b1.c
### Creating source file b11.c (split at function boundary)
### Creating part 1 of registration file b1.reg
### Creating parameter file b1.prm
### Creating model header file b1.h
### Creating part 2 of registration file b1.reg
### TLC code generation complete.
### Creating project marker file: rtw_proj.tmw
### b1.mk which is generated from
C:\MATLAB\rtw\c\dos\drt_watc.tmf is up to date
### Building b1: wmake -f b1.mk
WATCOM Make Version 10.6
Copyright by WATCOM International Corp. 1988, 1996. All rights reserved.
WATCOM is a trademark of WATCOM International Corp.
### Compiling b1.c
C:\WATCOM\binnt\wcc386 -zu -fpi87 -3s -oxat
-DMODEL=b1 -DRT -DNUMST=2 -DTID01EQ=1 -DNCSTATES=39 b1.c
WATCOM C32 Optimizing Compiler Version 10.6
Copyright by WATCOM International Corp. 1984, 1996.
All rights reserved.
WATCOM is a trademark of WATCOM International Corp.
b1.c: 296057 lines, included 17481, 0 warnings, 0 errors
b1.c(33911): Error! E1118: ***FATAL*** Object file too large
Error(E42): Last command making (b1.obj) returned a bad status
Error(E02): Make execution terminated
I have set the flag for file splitting (aFileSizeThreshold), but I continue to receive similar error messages. Is this a known problem? How can I fix this problem?

Best Answer

The ability to split generated code into separate files is not available in Real-Time Workshop.
Currently, to work around this issue, try manually partitioning the model with atomic subsystems. Each atomic subsystem block can specify a separate file, effectively splitting the code. This method also provides greater control over the file splitting process.
Related Question