How can I generate code from the same model to different targets without deleting the shared utilities folder?

5 ビュー (過去 30 日間)
I am trying to generate code for two different targets from the same Simulink model using Release R2022b. For example, one of them is 'ARM Cortex' and the other is 'Linux 64'. I am changing the target platform on the Simulink model, going to Modeling -> Model Settings -> Hardware Implementation.
I can generate code for the first target, but when I switch the settings to the second target, I get an error informing me of a conflict in the slprj/ert/_sharedutils folder:
 
Error using build_model_reference_target
Error building model 'test_function'. The current model configuration differs from the model configuration used to generate the shared utility code folder, '[...]\slprj\ert\_sharedutils'
Error in demo (line 34)
slbuild('test_application')
Suggested Actions:
Configure settings for 'test_function' so that there are no parameter differences. - Open
Remove '[...]\slprj\ert\_sharedutils'. - Fix
Consider generating code to a different folder structure.
The only way I have found to get around this error is to clear the artifacts between builds, including the "_sharedutils" folder. However, that is undesirable, because I want to use the code for both of the targets.
Is there any way to generate code successively for the two targets without deleting the shared utilities folder?

採用された回答

MathWorks Support Team
MathWorks Support Team 2022 年 10 月 18 日
That error appears because the “target” for the coder is “ert” for both ARM and Linux. However, those two platforms have differences that create incompatibilities in the code generation for shared utilities.
A simple way to solve it is to use the Simulink coder preferences to create code in different folders. You can do this using "Simulink.fileGenControl". For example, create a folder named "ARM_code", and before creating code for the ARM target, execute the following code:
cfg = Simulink.fileGenControl('getConfig');
cfg.CacheFolder = '.\ARM_Code';
cfg.CodeGenFolder = '.\ARM_Code';
Simulink.fileGenControl('setConfig', 'config', cfg);
Use a similar workflow for the second target platform.
You may read more about “fileGenControl” here:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

タグ

タグが未入力です。

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by