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.

TMS320F28027F: 28027_IQsampleC can't find 2000Ware files

Part Number: TMS320F28027F
Other Parts Discussed in Thread: C2000WARE

Hej

I am trying to find out how to use the sine function in IQmath.

I am trying to run the example 28027_IQsampleC which I have downloaded from the Resource explorer. When building I get these errors:

>> Compilation failure
makefile:137: recipe for target '28027_IQsampleC.out' failed
"C:\\Users\\romu\\AppData\\Local\\Temp\\{DFAEF166-FEB0-43F1-849F-A3B122313BFA}", line 21: warning:
   cannot resolve archive
   C:/ti/C2000Ware_4_01_00_00/libraries/math/IQmath/c28/lib/IQmath.lib to a
   compatible library, as no input files have been encountered
"C:/ti/C2000Ware_4_01_00_00/libraries/math/IQmath/c28/examples/cmd/28027_IQmath_lnk.cmd", line 72: warning:
   no matching section
"C:/ti/C2000Ware_4_01_00_00/libraries/math/IQmath/c28/examples/cmd/28027_IQmath_lnk.cmd", line 76: warning:
   no matching section
 
 undefined       first referenced   
  symbol             in file        
 ---------       ----------------   
 __IQ24asin      ./IQsampleSmall.obj
 __IQ24atan2PU   ./IQsampleSmall.obj
 __IQ24exp       ./IQsampleSmall.obj
 __IQ24log       ./IQsampleSmall.obj
 __IQ24mpyI32int ./IQsampleSmall.obj

I have checked the 2000Ware installaton file. This is the path to the file IQmath.lib fle:

C:\ti\C2000Ware_4_01_00_00\libraries\math\IQmath\c28\lib

which corresponds to the error message. But this file IQmath.lib has only 1kb !

There are other (larger) files in the directory like IQmath_coff.lib.

(I recall when installing CCS vsn 12.0.0 that there was a message about another version of IQmath was being installed - 'coff' ?? or something!  The message was only there for a second!)

Can you help with this?

Regards

Roger

  • Roger, 

    IQmath.lib is meant to be like an index, it is meant to point to the COFF or the EABI version of the IQMath library depending on your project configuration.

    Can you try to use the "IQmath_coff.lib" instead of "IQmath.lib" in your project and try to compile it again?

    Best Regards

    Siddharth

  • Hi Siddarth

    Thanks for your reply. Sorry, but I can't see how to change the library to IQmath_coff.lib.  Where do I find the location specified in CCS? - I have tried looking everywhere under Project->Properties.

    I have also just tried Project->Add files  and added the file IQmath_coff.lib
    (which exixsts in C:\ti\C2000Ware_4_01_00_00\libraries\math\IQmath\c28\lib)

    but I still get these errors on building the project:

    "C:\\Users\\romu\\AppData\\Local\\Temp\\{0611F15C-BDD9-4C67-BF75-5E83DA849543}", line 21: warning:
       cannot resolve archive
       C:/ti/C2000Ware_4_01_00_00/libraries/math/IQmath/c28/lib/IQmath.lib to a
       compatible library, as no input files have been encountered
    "C:/ti/C2000Ware_4_01_00_00/libraries/math/IQmath/c28/examples/cmd/28027_IQmath_lnk.cmd", line 72: warning:
       no matching section
    "C:/ti/C2000Ware_4_01_00_00/libraries/math/IQmath/c28/examples/cmd/28027_IQmath_lnk.cmd", line 76: warning:
       no matching section
    warning: entry-point symbol other than "_c_int00" specified:  "code_start"
    Finished building target: "28027_IQsampleC.out"

    Can you please help?

    Regards,

    Roger

  • Roger, 

    The linker command file (28027_IQmath_lnk.cmd) also references IQMath.lib.  Can you update it to use the IQmath_coff.lib. 

    Best Regards

    Siddharth

  • Hi Siddarth,

    Thanks for the reply. In the file 28027_IQmath_lnk.cmd I could only find the following two references to IQMath.lib and have updated them thus:

    IQmath           : > RAML0,      PAGE = 0
       IQmathTables     : > IQTABLES,   PAGE = 0, TYPE = NOLOAD
       IQmathTables2    : > IQTABLES2,  PAGE = 0, TYPE = NOLOAD
       {
            IQmath_coff.lib<IQNexpTable.obj> (IQmathTablesRam)
       }
       IQmathTables3    :> IQTABLES3,   PAGE = 0, type = NOLOAD
       {
           IQmath_coff.lib<IQNasinTable.obj> (IQmathTablesRam)
       }

    But I still get the same sort of errors on building:

    "C:/ti/C2000Ware_4_01_00_00/libraries/math/IQmath/c28/examples/cmd/28027_IQmath_lnk.cmd" "./CodeStartBranch.obj" "./IQsampleSmall.obj" "../IQmath_coff.lib"  -lrts2800_ml.lib
    "C:/ti/C2000Ware_4_01_00_00/libraries/math/IQmath/c28/examples/cmd/28027_IQmath_lnk.cmd", line 72: warning:
       no matching section
    "C:/ti/C2000Ware_4_01_00_00/libraries/math/IQmath/c28/examples/cmd/28027_IQmath_lnk.cmd", line 76: warning:
       no matching section
    warning: entry-point symbol other than "_c_int00" specified:  "code_start"

    I hope you can help..

    Regards

    Roger

  • Roger, 

    These are only warnings but it is able to generate the binary file . The error related to "undefined symbols" is resolved. Are you still seeing that issue?

    Best Regards

    Siddharth

  • Hi Siddharth,

     

    Many thanks.

    After restarting CCS I now don’t get (even) any warnings. The program seems to run (as fa as I can see...).

    Now I have to work out which parts of this project I need to import into my own project. It all seems a bit complicated – the link command file, etc.!

    All I really want to do is look up a sine value given an index. If you know of a simple, cut-down version of this project that can do that, I would be very interested.

    What I am actually trying to do is generate a sinewave PWM signal. If you know of any solutions for this processor, I would be very grateful (it seems like a very common thing to want to do!).

     

    Regards

    Roger

  • Roger,

    Glad that you were able to get it working. 

    The linker command file is needed since it determines where to load the sections of the code to in the memory. 

    You can try to retain the code that you code that you need and add it to your project. .

    Best Regards

    Siddharth  

  • Hej

    OK, thanks. I will try. But I’m afraid don’t have much understanding of the link cmd file.

    I am getting a bit confused. I hope the following is not a stupid question:-)

    There seem to be two ways of getting a sine function – are they equivalent, or what?

    (1) In the example we are using in this thread, the sine function seems to be called using

    IQsin(...)

    as in the line

    Dlog.Xwaveform[i] = tempX = _IQmpy(_IQsin(Step.X), Step.GainX);

     

    also it seems to need the definitions in the file 28027_IQmath_lnk.cmd, like

    IQmath           : > RAML0,      PAGE = 0

       IQmathTables     : > IQTABLES,   PAGE = 0, TYPE = NOLOAD

       IQmathTables2    : > IQTABLES2,  PAGE = 0, TYPE = NOLOAD

       {

            IQmath_coff.lib<IQNexpTable.obj> (IQmathTablesRam)

       }

     

     

    (2) BUT on the other hand I have found several examples in the Forum that just use sine_table[index]  (e.g. thread F28069 sinusoidal PWM generation – OK, but it’s another processor)

     

    E.g.

    #include "IQmathLib.h"
    #pragma DATA_SECTION(sine_table,"IQmathTables");
    _iq30 sine_table[512];

    ....

    sine_table[index]

     

    as in e.g.

    EPwm1Regs.CMPA.half.CMPA = EPwm1Regs.TBPRD - _IQsat(_IQ30mpy((sine_table[index]+_IQ30(0.9999))/2, EPwm1Regs.TBPRD),EPwm1Regs.TBPRD,0);

     

    and there is no mention of defining memory locations in a file such as xxx_lnk.cmd

     

    The second solution seems much easier to use (no link cmd table)!

    Please could you clarify the difference? Perhaps it is something to do with using the tables in the boot ROM – but instead of what?

    Regards

    Roger

  • Roger, 

    In the first case, the linker command syntax is used to allocate the tables into the memory section. 

    In the second case, #pragma is a compiler directive to create a separate section "sine_table" to allocate the IQMath table

    Both are equivalent , only different ways of doing it. 

    If you find the second one to be easier, you can use that. 

    Best Regards

    Siddharth 

  • Thanks for your reply. Very helpful.

    OK, it seems easier to use the second method. (Here, the .lib file is not even mentioned in the .cmd file whether it is _coff or not!)

    I am using the ’guts’ of an example I found in the Forum by Frank Borumm

    while(1){

            Pwm1Regs.CMPA.half.CMPA = EPwm1Regs.TBPRD - _IQsat(_IQ30mpy((sine_table[index]+_IQ30(0.9999))/2,

            EPwm1Regs.TBPRD),EPwm1Regs.TBPRD,0);

            if (index++ >511) index = 0;

        }

    It seems to work, in that the sine value is scaled and assigned to the CMPA register.

    But could you please explain:

    (1) Why is type conversion from _iq30 (the result of _IQsat(..)) to the register format (Uint16) not necessary?

    (2) How can I display values of _iq30 types?  E.g. xx in this:..

    _iq30 xx;

    ....

    xx=sine_table[up_down]

    The IQ manual IQmath_v15a   states that the Watch window can be used:

    Step 3: Viewing IQmath variable

    To view a variable in the watch window, simply type the following commands in the watch

    window. They will convert the specified "VarName" in IQ format to the equivalent floatingpoint

    value:

    For C variables:

    _IQ(VarName) ; GLOBAL_Q value

     

    but if I type e.g. _IQ(xx)  into the Expressions tab, all I get is a ‘not found’ error in the Watch window.

     

    Regards

    Roger

  • Roger, 

    Will forward your query to an IQmath expert.

    Best Regards

    Siddharth

  • Hello Roger,

    To answer your questions:

    1. Why is type conversion from _iq30 to the register format (Uint16) not necessary?
      1. This depends on the situation. The _iq data type is a fixed-point integer, but can be stored as an integer of a similar size. However, the compiler may not be catching the problem here, because the _iq data type should be long (32-bits). I'm not not sure if it's not throwing a warning or something, but most likely it should.
    2. How can I display values of _iq30 types?
      1. The PDF seems to be out-of-date with regards to viewing IQ values in CCS. From my own testing, if you add the variable name to the expressions window (just the name of the variable), and then right-click on the value, there should be an option called "Q-Values". From this you should be able to choose or enter the appropriate value. I will try to get this updated in the document.

    Best regards,

    Omer Amir