MATLAB: Does the “Run on Custom Hardware” app not work with the custom target in R2019b and later

extmodefilesftsimulink codersystemtargettlc

We have a custom target (based on grt.tlc or ert.tlc) that we have been using in older versions of MATLAB for a long time. We always place the .tlc file under
<matlabroot>/rtw/c/
where <matlabroot> is usually located at C:\Program Files\MATLAB\RXXXXx\ on Windows OS.
Now, we upgraded to a more recent version that has the Simulink toolstrip (R2019b and newer). The code generation and build works without issue, but we are having trouble with using External Mode, since every time I try to use the "Run on Custom Hardware" app, the system target file switches back to one of the default targets (grt.tlc or ert.tlc). Why is this?

Best Answer

  • Placing custom files under <matlabroot> is generally not recommended. Up until R2019a, we did not check the location of custom target .tlc files, so they would work fine even if they were located somewhere under <matlabroot>.
    However, in R2019b, we introduced the new Simulink Toolstrip. And it was decided that when launching the "Run on custom hardware" app, it checks the location of the .tlc file specified in the model configuration. If the .tlc file is under <matlabroot>, then only certain MathWorks provided targets are supported, but not custom targets. This is why the app prompts you to switch the target back to grt.tlc.
    To work around the issue, place your custom .tlc in a different directory outside of <matlabroot>, and place the directory on your MATLAB path using addpath().