My workplace use MATLAB and sub-products Simulink, Realtime workshop (RTW), RTW Embedded Coder. We have a large simulink model that is compiled to C then to an object file for loading onto the embedded target. The whole compilation process takes ~3h which is quite long, it's mostly the compilation and linking of the C files produced from the simulink model.
Removing one particular subsystem reduces the compilation time down to 30mins, and since this subsystem doesn't change very often I plan to code this in C and then into MEX and use the MEX file in the main model.
Will the technique reduce the compilation time? Is there another technique I should be looking into?
EDIT: I think the solution will be roughly: Generate C from the offending subsystem Compile this to some kind of object, library Include this in the model (but I'm not interested in simulation, it has inputs only) Include this in the build process, presumably linking after compiling the rest of the code
You could try to put the offending subsystem into another model and use Model Reference. You can convert a subsystem to a Model block using Simulink.SubSystem.convertToModelReference.
Model Reference has incremental code generation, so as long as the model doesn't change, Simulink won't regenerate or recompile the code for the referenced model.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With