DLL generation by RTW with reference to external libraries

2 views (last 30 days)
Hello everyone,
I have a simulink model composed by a DymolaBlock and some blocks from the standard simulink library.
I have some issues when I try to generate the code for a Dspace system by using Real Time Workshop (former Simulink coder) as some missing libraries, some functions which are declared but not defined......
So my guess is : I should specify the path where Matlab can find the requested libraries.
Therefore I filled the custom libraries fields of the RTW options, but I still have some errors of unresolved references when I tried to generate the dll.
So I contacted the Dassault custom service and they told me :
In order to compile the model for dSPACE you also have to modify the makefiles. The recommended practice for dSPACE is to change the <model>usr.mk. The easiest way to create a* <model>usr.mk* is to build the application according to the instructions in the dSPACE documentation, which will fail because additional files from the Dymola distribution are unavailable The following definitions are needed to compile Dymola models on dSPACE
# Additional C source files to be compiled.
USER_SRCS = dymc.c dymf.c amat.c usertab.c
# Directories for C source files.
USER_SRCS_DIR = \dymola\source
# Path names for user include files.
USER_INCLUDES_PATH = \dymola\source
# Additional compiler definitions.
# The MATLAB option defines "MATLAB 5.1 or later".
OPTS = -O5 -D_INLINE -DDYMOLA_DSPACE -DMatlab51
Actually you can find a copy of their answer on this pdf
So in order to make these changes, I launched again the dll generation of the Simulink model of course the generation was interrupted for an error but in this way I got a makefile for this model, then I opened this file added the lines mentioned above.
Then with the option generate makefile unticked from RTW option, I relaunch the process of dll generation.
But nothing happens. It suddenly stopped without error message and no dll has been generated.
Do you have any ideas of what I could do? any advise?
Actually by continuing reading the pdf file, which I mentioned, I found this sentence :
For dSPACE release 4.0 compiler options are set in the options dialog of Real-Time Workshop. The following definitions are needed to compile Dymola models on dSPACE
-DDYMOLA_DSPACE -DMatlab51
How can I add this option on RTW ? I cannot find any suitable fields on the RTW options
thanks 4 reading

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 6 Nov 2012
You can add compiler options to the Make command field on the Configuration Parameter window's Code Generation pane, like so:
make_rtw OPTS="-DDYMOLA_DSPACE -DMatlab51"
Regarding rebuilding after modifying the makefile as recommended by Dassault, you should manually run the makefile - you should see a .bat file (on Windows) or a .sh file (on *nix) that you need to run which will execute the modified makefile.

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!