This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IQ math library include vs. IQmath.h include

Other Parts Discussed in Thread: TMS320F28035

I'm building a project for a TMS320F28035 and trying to speed up the math calculations using the IQmath functions.  The _IQsmpy() , _IQ() , _IQabs(), and _IQmpyI32() functions all work with just the IQmath.h included, but the _IQdiv() function keeps giving me an error when I try to build the project with it being used in it.

 

Do I need to add the IQmath.lib  to the project or can I just use the IQmath.h?

  • Hello!

    It seems there is such solution. At the file IQmath.h you can see following:

    #ifndef GLOBAL_Q
    #define GLOBAL_Q (24)
    #endif

    ...........................................

    #if GLOBAL_Q == 24
    #define _IQdiv(A,B) (_IQ24div((A),(B)))
    #endif

    Therefore try using _IQ24div() insted _IQdiv(). Also you can use other variants of _IQdiv() according to your needs if you will redefine GLOBAL_Q appropriately.

    Regards,

    Igor

  • Randy Carpenter said:
    The _IQsmpy() , _IQ() , _IQabs(), and _IQmpyI32() functions all work with just the IQmath.h included,

    _IQ() is simply a multiplication and thus can be performed by the parser.  The definitions are in the .h file and no function is actually called.

    i.e.

    #if GLOBAL_Q == 29
    #define   _IQ(A)  _IQ29(A)
    #endif

    #define   _IQ29(A)      (long) ((A) * 536870912.0L)

    The rest of the functions you mention are built into the compiler so you don't need additional code (library).   IQabs() uses a function in the runtime support library.

    Randy Carpenter said:

    but the _IQdiv() function keeps giving me an error when I try to build the project with it being used in it.

     

    Do I need to add the IQmath.lib  to the project or can I just use the IQmath.h?

    Yes IQdiv() requires a function which is provided in the library - a library is a set of pre-compiled functions.  In order to use sin/cos/tan/div/etc you will need the lib to be linked into your project.

    -Lori

  • Hi!

    At http://processors.wiki.ti.com/index.php/C28x_Compiler_Error_and_Warning_Messages (Error: unresolved symbols remain....):

    For example, if your code had the statement c = IQdiv(a,b); but the IQmath library has not been included in the project, the symbol IQdiv will be flagged as undefined.

    Regards,

    Igor