How can I debug the S-Function generated for SIL simulation with a target from Embedded Coder 5.5 (R2011a)?

1 view (last 30 days)
I use Embedded Coder to run SIL (Software-In-the-Loop) simulations. I would like to be able to debug the S-Function that is generated for the SIL simulation.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 Dec 2021
Edited: MathWorks Support Team on 13 Dec 2021
To debug the SIL S-Function you need to build the necessary libraries with debug information. Please follow the steps below to do this.
1.
Check the ”Verbose build” check box under Code Generation > Debug in the Configuration Parameters.
2.
Prepare and generate code for model with the required settings to generate the SIL-block. For details on the required settings, please see:
3.
Edit the generated make file
\<model>_<target>_rtw\<model>.mk
by changing the DEBUG_BUILD flag in the following section to 1:
# To enable debugging:
# set DEBUG_BUILD = 1
DEBUG_BUILD = 0
4.
Close the model with the SIL block and execute the command
>> clear mex
to make sure the SIL S-Function MEX file is not locked.
5.
Execute the file
\<model>_<target>_rtw\<model>.bat
To rebuild the model with debug information.
You can do this from within MATLAB by making the
\<model>_<target>_rtw\
folder your current directory and then execute:
>> !<model>.bat
6.
The project is now built for debugging.
For information on how to debug S-Functions/MEX-files, please see the following guide:

More Answers (0)

Categories

Find more on Build Configuration in Help Center and File Exchange

Products


Release

R2011a

Community Treasure Hunt

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

Start Hunting!