C-Code Generation for TI C2000 device, IQMath Library

11 views (last 30 days)
Hello!
I am currently doing my Master's thesis and as a part of it, I have to generate code out of a Simulink model. So far, I have managed to use the Legacy Tool in order to create some s-functions out of existing C-code. The existing code uses the IQMath Library provided by Texas Instruments. However, the Legacy Tool can not make use of it, as the library is exclusively written for TI C28x devices. No problem for the simulation, I can replace the functions like multiplications and so on by functions in math.h. But still I want my generated code to be efficient. So my main question is: Is there any way to tell the Real Time Workshop by means of the *.tlc file to replace the function calls (for example sin(x)) by _IQsin(x) used in the IQMath library?

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 11 Apr 2011
Yes, you can call your optimized routines in the TLC file written to inline the S-function in generated code; while using generic math functions for simulation.
Note that you can also register your own function replacement table to replace other common math operations in your model with optimized routines in generated code. However, I don't think the replacement is done in user-written S-function code (because the corresponding TLC file is assumed to contain the true version of generated code).
  3 Comments
Kaustubha Govind
Kaustubha Govind on 13 Apr 2011
Are you looking for operations to be replaced within your S-function code? Like I said, I'm not sure that these are replaced - I think the TLC is assumed to call into the desired functions. AFAIK, the replacement libraries are only applied to Simulink library blocks (eg. Sum. Product, etc.) with fixed-point inputs. Also, if you plan to generate code for TI C28x devices, I recommend using Target Support Package for C2000 devices (in R2011a, these Target Support Package toolboxes have been bundled into the Embedded Coder: http://www.mathworks.com/products/embedded-coder/ti-adaptor.html)
David
David on 11 May 2011
Thanks for the answer, I just read it right now. Somehow, I did not receive an email notification about your comment. Yes, your were right, I was trying to find an answer for code being replaced in S-Functions. Still, I have not found a solution, but I have not put any additional effort in this problem so far...

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!