Code Generation Visual Studio 2017 for CANoe-Modell .dll

19 views (last 30 days)
Ali Zeitoun
Ali Zeitoun on 16 Mar 2019
Commented: Vasile Solcan on 9 Nov 2020
Hello, For my bachelor thesis I'm currently trying to integrate a Simulink model into CANoe.
I'm using Visual Studio Community 2017 as a compiler, Windows SDK 7.1, and Matlab 2018b.
>> mex -setup MEX configured to use Microsoft Visual C ++ 2017 (C) for C language compilation.
>> installedCompilers.Location
ans = 'C: \ ProgramData \ MATLAB \ SupportPackages \ R2018b \ 3P.instrset \ mingw_w64.instrset'
ans = 'C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ Community \'
The model works in offline mode and synchronized mode. For HiL-Mode you need to generate a DLL file. However, many errors occur during code generation:
Checking block usage. ### Generate CANoe Model Viewer information for model: sin_ ### Generate model description file: sin_.ini 0 file(s) in 2.9 sec generated. ### Starting Real-Time Workshop build procedure for model: sin_ ### Generating code and artifacts to 'Model specific' folder structure
Code Generation
Elapsed: 28 sec
### Generating code into build folder: C:\Users\Ali Zeitoun\Desktop\Sine\sin__cn_rtw
### Invoking Target Language Compiler on sin_.rtw
### Using System Target File: C:\Program Files\MATLAB\R2018b\rtw\c\canoe\cn.tlc
### Loading TLC function libraries ### Initial pass through model to cache user defined code .
### Caching model source code
### Generating TLC interface API.
### Writing source file sin__capi.c ...... // Hier war die Generierung erfolgreich
TLC code generation complete.
### Processing Template Makefile: C:\Program Files\MATLAB\R2018b\rtw\c\canoe\cn_msdll.tmf
### which is generated from C:\Program Files\MATLAB\R2018b\rtw\c\canoe\cn_msdll.tmf is up to date
### Building sin_: .\\sin_.bat
C:\Users\Ali Zeitoun\Desktop\Sine\sin__cn_rtw>set VSCMD_START_DIR=C:\Users\Ali Zeitoun\Desktop\Sine\sin__cn_rtw C:\Users\Ali Zeitoun\Desktop\Sine\sin__cn_rtw>set
WINSDK_71A=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\
C:\Users\Ali Zeitoun\Desktop\Sine\sin__cn_rtw>cd .
C:\Users\Ali Zeitoun\Desktop\Sine\sin__cn_rtw>call "set MINGW_ROOT_PATH=C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\mingw_w64.instrset" x86
Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch. \\ error
Der Befehl "nmake" ist entweder falsch geschrieben oder konnte nicht gefunden werden. \\ error
C:\Users\Ali Zeitoun\Desktop\Sine\sin__cn_rtw>echo The make command returned an error of 9009
The make command returned an error of 9009 \\hier der 3.Fehler
C:\Users\Ali Zeitoun\Desktop\Sine\sin__cn_rtw>An_error_occurred_during_the_call_to_make Der Befehl "An_error_occurred_during_the_call_to_make" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
Error(s) encountered while building "sin_" \\ here are also errors to find..
Could jmd please help me?
für meine Bachelorarbeit versuche ich im Moment, ein Simulink-Modell in CANoe zu integrieren.
Ich verwende Visual-Studio Community 2017 als Compiler, Windows SDK 7.1, und Matlab 2018b.
>> mex -setup MEX configured to use 'Microsoft Visual C++ 2017 (C)' for C language compilation.
>> installedCompilers.Location
ans = 'C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\mingw_w64.instrset'
ans = 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\'
Das Modell funktioniert in Offline-Mode und synchronized-Mode. Für HiL-Mode braucht man eine DLL Datei zu generieren.
Jedoch bei der Code-Generierung tauchen viele Fehler auf (siehe den Code oben)
Könnte mir jmd bitte helfen?
Viele Grüße

Answers (1)

Stefanie Schwarz
Stefanie Schwarz on 27 May 2020
Edited: Stefanie Schwarz on 27 May 2020
In general, please contact Vector for questions regarding their cn.tlc target:
As far as we know, cn.tlc uses C++ language so please make sure to:
1) Run the command
>> mex -setup c++
in MATLAB to select the supported Visual Studio compiler.
2) Select C++ as Language in the model settings under Configuration Parameters > Code Generation.

Community Treasure Hunt

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

Start Hunting!