MATLAB: C-Code Generation for TI C2000 device, IQMath Library

code generationreal time workshopTarget Support Package

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?

Best Answer

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).