Error: ERROR: Code generation failed: Project export failed while using Twincat Target for Simulink

19 次查看(过去 30 天)
I am trying to send simulink model to twincat using the twincat TE1400 TwinCAT 3 Target for Simulink. These are the softwares installed in my Windows 10 system, Visual Studio 2019 community; Matlab R2024b; Twincat 3.1 4024.55 with TE14xx-ToolsForMatlabAndSimulink installed and run on the Matlab command window as administrator. Twincat was manually integrated with VS 2019 in the setup itself. I created a simple simulink model with and AND operation.The config settings are attached below for my simulink model. The build completion was working with the code generation being successful and the model porting to the twincat XAE shell interface without any problems, until yesterday morning when i started to get this error.
Top model targets:
Model Build Reason Status Build Duration
=================================================================================================================================
TRIAL Information cache folder or artifacts were missing. Failed to build. For more information, see build log. 0d
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 23.303s
I tried searching for a solution online but was not able to find any. Can you guide me through this?

回答(1 个)

Manish
Manish 2025-6-4
Hi,
I was working on a similar use case and encountered the same issue. After trying several approaches, I found a workaround that might be helpful for you as well.
In your current working directory in MATLAB, delete the slprj, work, and *_grt_rtw folders manually if they exist, or clear the code generation folders (those created using codegen).
Then, reopen your Simulink model and try building it again.
Hope this helps!
  1 个评论
Infento Varun
Infento Varun 2025-6-6
Thank you so much for the response. But unfortunately the problem is the Repository folder in C:\TwinCAT\3.1\Repository\TE140x Module Vendor is not being created at all whenever I run codegen in simulink. Because of this, the .tmx file is not being signed by my certificate and it keeps giving me this error
----------------------------------------------------------------------------------------------------------------------------------------
C:\TwinCAT\3.1\SDK\MsBuild\TcSign\TcSign.targets(162,3): error MSB3073: The command ""C:\TwinCAT\3.1\SDK\bin\TcSignTool.exe" sign "C:\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\Trial_tcgrt\_products\TwinCAT RT (x64) Release\Trial.tmx" /f "C:\TwinCAT\3.1\CustomConfig\Certificates\MyOemCert.tccert" /q" exited with code 1. [:\TwinCAT\Functions\TE14xx-ToolsForMatlabAndSimulink\Trial_tcgrt\Trial.vcxproj]
---------------------------------------------------------------------------------------------------------------------------------------
in simulink and this occurs =================================================================================================================================
TRIAL Information cache folder or artifacts were missing. Failed to build. For more information, see build log. 0d
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 23.303s
-------------------------------------------------------------------------------------------------------------------------------------------------
I spoke with beckhoff support about this and they told me to sign the .tmx file using cmd prompt
TcSignTool sign /f "C:\TwinCAT\3.1\CustomConfig\Certificates\ MyCertificate.tccert" /p MyPassword "C:\TwinCAT\3.1\Repository\TE140x Module endor\ModulName\0.0.0.1\TwinCAT RT (x64)\MyDriver.tmx"
But they dont understand that there is nothing in the Repository after I run the codegen. the tmx files are getting saved in the tcgrt folder. I tried specifying the repository folder to save the C++ project and then copy the files to Trial\0.0.0.1 so that it shows up in Twincat but then i get
-------------------------------------------------------------------------------------------------------------------------------------------------Severity Code Description Project File Line Suppression State
Error 6/4/2025 8:46:55 AM 072 ms | 'TCOM Server' (10): Error loading repository driver 'C:\TwinCAT\3.1\Boot\Repository\TE140x Module Vendor\Trial1\0.0.0.1\Trial1' - hr = 0xc0000225
------------------------------------------------------------------------------------------------------------------------------------------------- I dont know what to do and Beckhoff suppport does seem to get it. Can you help me

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by