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.

Using Siglib DSP library

Other Parts Discussed in Thread: CCSTUDIO

Hello,

I am making use of a third-party DSP library (SIGLIB). I have the source files and have rebuilt their library to target a C6748 using CCS 3.3. There are a number of header files that are used for the library build and required to included in the project.

While the library builds with no trouble at all, the same includes for the project generate odd errors.

Example:

"C:\CCStudio_v3.3\MyProjects\MODEM_EMBEDDED\Common\Siglib\siglibms.h", line 37: error #821:
          badly formed pragma
  #pragma CODE_SECTION(SUF_SiglibVersion, ".text")
  ^

For every "CODE_SECTION" declaration this error occurs. The same headers in the library build don't generate any error.

The compile options used for the library build are:

-mv6740 -q -o3 -op3 -mt  -mh -mi %1.c -c

Using this and other combinations has not helped. I have not yet  found much information about error #821.

Any thoughts?

Thanks in advance.

Dan.

 

 

 

  • Are you including siglibms.h in C++ code?  That pragma is not valid in C++ code.  See http://processors.wiki.ti.com/index.php/Pragmas_in_C%2B%2B .

    Thanks and regards,

    -George

  • Hi George,

    Yup...We are using some C++ code. I will have to check with the creator of the library to see if this will fly, but it certainly seems likely. I will verify when I hear back. Thanks very much so far!

     

    Dan.

     

  • You are probably building the project (not the library) in C++ mode, either because the source files are C++ or because the -fg option is used. Pragmas have different syntax in C and C++. In C++ mode the pragma does not include the identifier as an argument. (This is an unfortunate artifact of the fact the the C syntax was defined before C++ came along, and did not work for C++, because of overloaded identifiers.)

  • George, adavis,

    Currently the library is built in C. It had been used with C++ in a Windows console application and the pragmas in that header were no trouble under Visual Studio, but I'm guessing the only way this may work for C++ under CCS is to manually make these pragma changes for each function and include all the source as part of the C++ project? Is there a way to leave the C-library the way it is and access it under C++ while not including these lines in the header?

    Thanks in advance?

     

    Dan.

  • Try building on the CSPRAGMA example in this wiki article http://processors.wiki.ti.com/index.php/Pragmas_in_C%2B%2B .  You would change all of your current CODE_SECTION pragmas to using this CSPRAGMA macro instead.  Plus, you have to move them out of the header file to just before the affected function.  I hope this is practical.  It is the only suggestion I have.

    Thanks and regards,

    -George

  • Hi George,

    There are about 750 functions to do this with so I would not change it on a whim. The library developer suggested that if the C-library is built seperately with the pragmas as they are then they can be ignored for the includes the main project in C++. The immediate library seems to be OK with this, but I may get complaints when I start the top level project with an .out file that requires actual bonefide linkage, I'm not sure.

    Thanks for your help.

     

    Dan.

  • You should just be able to leave the library as it is (that is, compiled as C code) and when you want to use those functions in your C++ program, make sure to wrap the #include in an 'extern "C"' like this:

    extern "C" {
    #include "library.h"
    }
  • Thanks Archaelogist, I shall give it a whirl.

    Thanks for everyone's help!

     

    Dan.