How can I change the code generation directory depending on my selection of the System Target File in Real-Time Workshop 6.5 (R2006b)?

I created a custom target and I have used the header comments in my System Target File (STF) to define multiple targets in just one STF. I want to generate my code into different directories depending on my target selection.

 Accepted Answer

The advantage of using the header comments in a System Target File to define multiple targets is to have only one tlc file for the most options. This makes maintenance easier. On the other hand you usually have one line defining the BuildDirSuffix for all cases.
If you want to use different directories based on your selection of the System Target File you could use the getActiveConfigSet function to get the description of the System Target File which was selected. Then you can create different BuildDirSuffix for different descriptions, as shown in the following example:
cs = getActiveConfigSet(gcs);
tmp = cs.Components(7).Description;
switch tmp
case 'my_grt1'
rtwgensettings.BuildDirSuffix = '_mygrt1_rtw';
otherwise
rtwgensettings.BuildDirSuffix = '_mygrt2_rtw';
end
Attached you can find the example System Target File and the VDP demo model.

More Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products

Release

R2006b

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!