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.

AM2754-Q1: C7x Mathlib

Part Number: AM2754-Q1
Other Parts Discussed in Thread: MATHLIB

Hi,

 

Is a C++ compiler required to use the C7x Math Library(Mathlib)? 

 

Thanks and Best regards

 

  • Hi,
    You need TI CGT C7000 compiler fro the library: https://www.ti.com/tool/C7000-CGT . 

    Thanks,

    Shreyansh

  • “Of course, I am using TI’s CGT C7000 compiler.
    When I compile in pure C (C99 mode), I get a compilation error.”

  • Hi IChung,
    I am sorry, I don't fully understand the issue. Can you please share the error you are getting and compiler flags you are using? Are you building for Host Emulation/PC or EVM?

    Thanks,
    Shreyansh

  • In the included header file MATHLIB_type.h, the following structure definition appears at line 153:

    typedef struct {
       bool callCheckParams = false;
       bool callInit                   = true; 
       __SE_TEMPLATE_v1 se0Params; 
       __SE_TEMPLATE_v1 se1Params; 
       __SA_TEMPLATE_v1 sa0Params; 
         size_t blockSize = 0; 
    } MATHLIB_SESA1DSequential_t;

    As far as I know, providing default initializers for structure members is not allowed in C, and is only valid in C++ (C++11 and later).
    Because of this, a compilation error occurs when building with a C compiler.

    Therefore, I would like to ask:

    Is the Mathlib library intended to be compiled with a C++ compiler rather than a C compiler?

  • Hi IChung,

    typedef struct {
       bool callCheckParams = false;
       bool callInit                   = true; 
       __SE_TEMPLATE_v1 se0Params; 
       __SE_TEMPLATE_v1 se1Params; 
       __SA_TEMPLATE_v1 sa0Params; 
         size_t blockSize = 0; 
    } MATHLIB_SESA1DSequential_t;

    As far as I know, providing default initializers for structure members is not allowed in C,

    That's correct and is one of the reasons why the library is written in C++. However, as long as you are compiling the library for a target, all you need is the TI CGT C7000 compiler, it can compile both C and C++ files.

    Refer to the compiler doc: www.ti.com/.../spruig8g.pdf

    Thanks,
    Shreyansh