Unable to generate code with shared exported files witout deleting .dmr file in _sharedutils folder

26 ビュー (過去 30 日間)
My physical system (parent model) consists of different smaller subsystems, that all run on separate ECUs, thus are referenced models for separate code generation. All of the subsystems share some buses, which are exported in the global .sldd file, and saved to a file sharedSimulinkTypes.h, which is generated under the _sharedutils folder. When a shared bus is changed, generating code will result in an error, stating:
The contents of the following objects do not match those in the current slprj directory:
Content
' struct exampleBus { ... }; '
for exampleBus does not match content
' struct exampleBus { ... }; '
in the shared header file "sharedSimulinkTypes.h".
To continue, either manually remove the Simulink cache files and the slprj folder, or rename these objects.
I identified that the problem is a shared_file.dmr in _sharedutils folder, as deleting that file will allow code generation and sharedSimulinkTypes.h will just be replaced. What is the shared_file.dmr, why is it created and is it necessary? I tried to find a way of disabling the generation of it, or creating a callback before code generation starts to delete the file, but was unsuccessful in finding a way to do that.

回答 (1 件)

Divyanshu
Divyanshu 2025 年 1 月 15 日
Hello @Morgan,
I think this is expected behavior because whenever code is generated from a model, slprj, .dmr, _sharedutils all these temporary files and folders are created. These basically contain some signal logs and temporary data associated with the model and Simulink.
Whenever, there is any modification in the model new slprj folder and all its sub-folders are automatically generated when code is generated from the modification without any errors, unless something is explicitly specifed which may not be compatible with the change in model.
You can refere this MATLAB answer thread for more details about DMR files.
If possible can you attach your files to the question so that I can reproduce it on my end?
  1 件のコメント
Morgan
Morgan 2025 年 1 月 19 日
Thank you, for the answer.
I'm afraid I cannot exactly grasp what you mean by:
"Whenever, there is any modification in the model new slprj folder and all its sub-folders are automatically generated when code is generated from the modification without any errors, unless something is explicitly specifed which may not be compatible with the change in model."
I understand that when changing the model, the generated files are replaced. However, it fails in doing that, if the changes are made to structs with "exported" data scope. The link you provided does not make things much clearer, as it shouldn't have anything to do with running simulations, unless Simulink does this when generating code? The shared_file.dmr in my repository is not deleted after closing MATLAB, as specified in the thread.
I won't be able to provide you with the files I use in my project due to confidentiality and recreating similar structure will take a bit of time and I might look into that in a couple of weeks. As of now, I would perhaps keep this open for a bit to see if anyone experiences something similar.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMulticore Processor Targets についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by