How can I locate the source code Real-Time Workshop uses to generate and compile code for various algorithms used in the blocks in my model?

1 view (last 30 days)
I have a model that uses signal processing blocks to implement algorithms like the least mean square (LMS) algorithm. I would like to examine the source code that Real-Time Workshop uses to generate code for these algorithms for my model.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The makefile that Real-Time Workshop generates for a model contains information about the source files that are included in the compilation process for building the executable for a particular model.
To find the code that implements an algorithm, search for a function in the source files that are included by the model's makefile.
Consider the following example, which is based on Real-Time Workshop 6.2 (R14SP2).
1. Open the model lmsdemo.mdl, by typing the following MATLAB command at the command prompt:
lmsdemo
2. Set the system target file to grt.tlc (Visual C/C++ Project makefile only for the "grt" target).
3. Select "Generate Code only" and click on "Generate Code" button.
Real-Time Workshop generates the file lmsdemo.c and places it in the directory "lmsdemo_grt_rtw".
4. Open lmsdemo.c source file.
5. Find the function named "MWDSP_lmsn_ay_wy_DD". This function implements the LMS algorithm. The source code for this algorithm is in the file lmsn_ay_wy_dd_rt.c, which is in the directory $MATLABROOT\toolbox\rtw\dspblks\c\dsplms. The makefile lmsdemo.mak (in the "lmsdemo_grt_rtw" directory) contains information about all the files Real-Time Workshop uses to compile the code generated for the model.
For example, the following line of code appears in the makefile lmsdemo.mak (generated for lmsdemo.mdl). This line shows that lmsn_ay_wy_dd_rt.c is included during compilation of the code for the model.
SOURCE=D:\Applications\MATLAB704\toolbox\rtw\dspblks\c\dsplms\lmsn_an_wy_dd_rt.c

More Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!