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.

Compiler/TMS320F28377D: C2000 Code Generation Tools v18.1.1.LTS CLA math library problem

Part Number: TMS320F28377D

Tool/software: TI C/C++ Compiler

Hi,

we used compiler v16.9.6.LTS until now. But today I tried to use the new compiler v18.1.1..LTS with same project and I get following linker error:

undefined first referenced
symbol in file
--------- ----------------
__cla_CLAsincos_sp .\debug\Project_100.0TL3\CPU2/objs/cla_tasks.obj

What is the problem with CLAsincos function and new compiler?

  • Please look at the linker map file from the build that works.  Search for the symbol __cla_CLAsincos_sp.  Note the address for it.  Then look earlier in the map file for that address.  You will eventually find the object file associated with that address.  Note you are unlikely to find that exact address, though you might.  It is more likely you will find it falls between two addresses.  Once you find it, I suspect you will see that it the symbol __cla_CLAsincos_sp comes from a library you forgot to include in the new build.

    Thanks and regards,

    -George

  • Hi George,

    thank you for your answer. Both map files (old and new) contains CLAsincos.obj and includes cla1_math_library_datarom_fpu32.lib. But the old file doesn't have some __cla_CLAsincos_sp symbols. The new one have "UNDEFED __cla_CLAsincos_sp". Please see attached map files.

    MapFiles.zip

  • I presumed the symbol __cla_CLAsincos_sp appears in the old build.  But it doesn't. 

    So that I can figure out where that symbol comes from ..  Please use compiler version 18.1.1.LTS to submit a test case based on the source file cla_tasks.c as described in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • Hi,

    here ist the preprocessed file. We use following compiler and linker options:

    Compiler:

    --c99 \
    --keep_asm \
    --quiet \
    --asm_listing \
    --c_src_interlist \
    --optimizer_interlist \
    --include_path"$(DIR_CC)/include" \
    $(COMPILER_SEARCH_PATH) \
    --asm_directory"$(LST_PATH)" \
    --obj_directory"$(OBJ_PATH)" \
    --list_directory"$(LST_PATH)" \
    --large_memory_model \
    --silicon_version=28 \
    --float_support=fpu32 \
    --tmu_support=tmu0 \
    --fp_mode=relaxed \
    --cla_support=cla1 \
    --unified_memory \
    --symdebug:dwarf \
    --opt_level=2 \
    --opt_for_speed \
    --define=WORK_WITH_LOADER=$(WORK_WITH_LOADER) \
    --define=ALWAYS_THIRDHARMONIC \
    --define=MCU_VERSION=28377 \
    --define=SW_VERSION=$(SW_VERSION) \
    --define=SW_VERSION_STR=$(SW_VERSION_STR) \
    --define=CPU2 \
    --preproc_with_comment \
    --preproc_with_compile \
    --rpt_threshold=20

    Linker:

    --run_linker \
    -stack0x3F8 \
    --quiet \
    --rom_model \
    --warn_sections \
    --reread_libs \
    --map_file"abc.map" \
    --output_file"abc.out" \
    --search_path"./source/include" \
    --search_path"./source/Mcu/TI/DSP2837xD" \
    --library"./source/lib/rts2800_fpu32_fast_supplement.lib" \
    --xml_link_info="abc.xml" \
    --library"$(DIR_CC)/lib/rts2800_fpu32.lib" \
    --library"./source/_Devices/100.0TL3/Cla/cla1_math_library_datarom_fpu32.lib" \
    --library"./source/_Devices/100.0TL3/Cla/F2837xRevB_c2bootROM_CLADataROMSymbols_fpu32.lib"
    --diag_suppress=16002

    cla_tasks.pp.txt
    /*******************************************************************************
    *                           KACO new energy GmbH
    *           (c) Gottfried-Leibniz-Str. 1, D-74172 Neckarsulm, Germany
    ********************************************************************************
    * Project       Powador xxTL1 controller
    ****************************************************************************//**
    * \brief        CLA task file
    *
    * This file contains the tasks for the CLA coprocessor.
    ********************************************************************************
    * \file         cla_tasks.c
    ********************************************************************************
    * \todo
    *******************************************************************************/
    
    /***********
    * Pragmas *
    ***********/
    
    
    /***********
    * Includes *
    ***********/
    // Include shared variables (with types supported by CLA)
    //###########################################################################
    //
    // FILE:   F2837xD_Cla_defines.h
    //
    // TITLE:  #defines used in CLA examples
    //
    //###########################################################################
    // $TI Release: F2837xD Support Library v170 $
    // $Release Date: Mon Sep 21 16:52:10 CDT 2015 $
    // $Copyright: Copyright (C) 2013-2015 Texas Instruments Incorporated -
    //             http://www.ti.com/ ALL RIGHTS RESERVED $
    //###########################################################################
    
    
    
    // MCTL Register
    //==========================
    
    // MMEMCFG Register
    //==========================
    
    // MIER Interrupt Enable Register
    //==========================
    
    // Peripheral Interrupt Source Select define for DMAnCLASourceSelect Register
    //===========================================================================
    
    
    
    
    
    
    
    
    
    
    
    //---------------------------------------------------------------------------
    // Useful CLA Operation Macros:
    //================================
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    //===========================================================================
    // End of file.
    //===========================================================================
    //###########################################################################
    //
    // FILE:   F2837xD_Cla_typedefs.h
    //
    // TITLE:  Variable type definitions
    //
    //###########################################################################
    // $TI Release: F2837xD Support Library v170 $
    // $Release Date: Mon Sep 21 16:52:10 CDT 2015 $
    // $Copyright: Copyright (C) 2013-2015 Texas Instruments Incorporated -
    //             http://www.ti.com/ ALL RIGHTS RESERVED $
    //###########################################################################
    
    
    
    // Macros to manipulate pre-processor to generate a header file name
    // at compile time that is based on the test name and can be used as
    // an argument to #include
    
    
    // Suppress warnings casting CLA pointers
    #pragma diag_suppress 70,770,232
    
    //---------------------------------------------------------------------------
    // For Portability, User Is Recommended To Use Following Data Type Size
    // Definitions For 16-bit and 32-Bit Signed/Unsigned Integers:
    //
    // CLA does not support 64-bit types
    // This definition is only to allow inclusion of the standard header files
    // which do use 64-bit types
    //
    
    typedef short           						int16;
    typedef long            						int32;
    typedef unsigned char   						Uint8;
    typedef unsigned short  						Uint16;
    typedef unsigned long   						Uint32;
    typedef float           						float32;
    typedef long double     						float64;
    typedef struct { Uint32 low32; Uint32 high32; } Uint64;
    typedef struct { int32  low32; int32  high32; } int64;
    
    /*
     * These types are also defined in DSP/BIOS 5.x's <std.h> and the
     * SYS/BIOS 6.x's <xdc/std.h> files.  We need to protect their
     * definition with the #ifndef/#define guard to avoid the duplicate
     * definition warning.
     *
     * SYS/BIOS requires that the <xdc/std.h> file be included before
     * any other .h files.
     */
    
    struct MSTF_SHADOW_BITS {     // bits description
        Uint16  LVF:1;          // 0    Latched Overflow Flag
        Uint16  LUF:1;          // 1    Latched Underflow Flag
        Uint16  NF:1;           // 2    Negative Float Flag
        Uint16  ZF:1;           // 3    Zero Float Flag
        Uint16  rsvd1:2;        // 5:4  Reserved
        Uint16  TF:1;           // 6    Test Flag
        Uint16  rsvd2:2;        // 8:7  Reserved
        Uint16  RNDF32:1;       // 9    Rounding Mode
        Uint16  rsvd3:1;        // 10   Reserved
        Uint16  MEALLOW:1;      // 11   MEALLOW Status
        Uint16  RPCL:4;         // 15:12    Return PC: Low Portion
        Uint16  RPCH:8;         // 23:16    Return PC: High Portion
        Uint16  rsvd4:8;        // 31:24    Reserved
    };
    extern __cregister volatile unsigned int MSTF;
    
    
    
    
    //#############################################################################
    // 
    // FILE: CLAmath.h
    // 
    // DESCRIPTION: CLA Math Library Prototypes
    //
    // Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/
    // ALL RIGHTS RESERVED
    //#############################################################################
    //$TI Release: CLA Math Library V4.02.00.00 $
    //$Release Date: Oct 3, 2016 $
    //#############################################################################
    
    
    //###########################################################################
    //
    // If building with a C++ compiler, make all of the definitions in this header
    // have a C binding.
    //
    //###########################################################################
    //###########################################################################
    //
    // Macro Definitions
    //
    //###########################################################################
    
    
    //###########################################################################
    //
    // Structures, variables and typedefs.
    //
    //###########################################################################
    
    //CLASinCosTable Variables
    extern float CLAsincosTable[];
    extern float CLAsinTable[];
    extern float *CLAsincosTable_Sin0;
    extern float CLAcosTable[];
    extern float *CLAsincosTable_Cos0;
    extern float *CLAsinTableEnd;
    extern float *CLAcosTableEnd;
    extern float *CLAsincosTableEnd;
    extern float CLAsincosTable_TABLE_SIZE;
    extern float CLAsincosTable_TABLE_SIZEDivTwoPi;
    extern float CLAsincosTable_TwoPiDivTABLE_SIZE;
    extern float CLAsincosTable_TABLE_MASK;
    extern float CLAsincosTable_Coef0;
    extern float CLAsincosTable_Coef1;
    extern float CLAsincosTable_Coef1_pos;
    extern float CLAsincosTable_Coef2;
    extern float CLAsincosTable_Coef3;
    extern float CLAsincosTable_Coef3_neg;
    
    //CLAatanTable Variables
    extern float CLAatan2HalfPITable[];
    extern float CLAatan2Table[];
    extern float *CLAatan2TableEnd;
    extern float *CLAINV2PI;
    
    //CLAacosineTable Variables
    extern float CLAacosinHalfPITable[];
    extern float CLAacosinTable[];
    extern float *CLAacosinTableEnd;
    
    //CLAasineTable Variables
    extern float CLAasinHalfPITable[];
    extern float CLAasinTable[];
    extern float *CLAasinTableEnd;
    
    //CLAexpTable Variables
    extern float CLAINV1,CLAINV2,CLAINV3,CLAINV4;
    extern float CLAINV5,CLAINV6,CLAINV7,CLALOG10;
    extern float CLAExpTable[];
    extern float *CLAExpTableEnd;
    
    //CLAlnTable Variables
    extern float CLALNV2,CLALNVe,CLALNV10,CLABIAS;
    extern long CLALN_TABLE_MASK1,CLALN_TABLE_MASK2;
    extern float CLALnTable[];
    extern float *CLALnTableEnd;
    
    //Linker Defined variables
    extern unsigned int _cla_scratchpad_start;
    extern unsigned int _cla_scratchpad_end;
    
    //###########################################################################
    //
    // Function Prototypes
    //
    //###########################################################################
    extern float CLAacos( float fVal );
    extern float CLAacos_spc( float fVal );
    extern float CLAasin( float fVal );
    extern float CLAatan( float fVal );
    extern float CLAatan2( float fVal1, float fVal2 );
    extern float CLAatan2PU( float fVal1, float fVal2 );
    extern float CLAcos( float fAngleRad);
    extern float CLAcosPU( float fAngleRadPU ); 
    extern float CLAdiv( float fNum, float fDen);
    extern float CLAexp( float fVal); 
    extern float CLAexp10( float fVal); 
    extern float CLAexp2( float fNum, float fDen );
    extern float CLAisqrt( float fVal ); 
    extern float CLAln( float fVal); 
    extern float CLAlog10( float fVal); 
    extern float CLAsin( float fAngleRad ); 
    extern float CLAsinPU( float fAngleRadPU ); 
    extern float CLAsqrt( float fVal);
    extern void CLAsincos(float fAngleRad, float *y_sin, float *y_cos);
    extern float CLAexpN(float fVal, float N);
    extern float CLAlogN(float fVal, float N);
    //###########################################################################
    //
    //End of the C bindings section for C++ compilers.
    //
    //###########################################################################
    
    
    static float Phi;
    static float sin;
    static float cos;
    
    interrupt void Cla1Task1(void)
    {
        Phi += 0.1;
    
        if (Phi >= (2*3.14))
        {
            Phi = 0;
        }
    
        CLAsincos(Phi, &sin, &cos);
    }
    
    /**
     * \fn interrupt void Cla1Task2(void)
     *
     * \brief        Function for CLA task 2 - Control task
     *
     */
    interrupt void Cla1Task2(void)
    {
    
    }
    
    /**
     * \fn interrupt void Cla1Task3(void)
     *
     * \brief        Function for CLA task 3.
     */
    interrupt void Cla1Task3(void)
    {
    //      __mdebugstop();
    
    }
    
    /**
     * \fn interrupt void Cla1Task4(void)
     *
     * \brief        Function for CLA task 4.
     */
    interrupt void Cla1Task4(void)
    {
            // Nothing to do
    }
    
    /**
     * \fn interrupt void Cla1Task5(void)
     *
     * \brief        Function for CLA task 5.
     */
    interrupt void Cla1Task5(void)
    {
        // Nothing to do
    }
    
    /**
     * \fn interrupt void Cla1Task6(void)
     *
     * \brief        Function for CLA task 6.
     */
    interrupt void Cla1Task6(void)
    {
    
    }
    
    /**
     * \fn interrupt void Cla1Task7(void)
     *
     * \brief        Function for CLA task 7.
     */
    interrupt void Cla1Task7(void)
    {
    
    }
    
    /**
     * \fn interrupt void Cla1Task8(void)
     *
     * \brief        Function for CLA task 8.
     * initialize all cla vars
     */
    interrupt void Cla1Task8(void)
    {
        //__mdebugstop();   // Das Ist Breakpoint f�r Debugger
    
        // Set rounding mode (spruge6b page 30)
        //the MMPYF32, MADDF32 and MSUBF32 instructions will round to the nearest even value
        __asm(" MSETFLG RNDF32=1") ;
    
    
        //__mdebugstop();   // Das Ist Breakpoint f�r Debugger
    }
    
    
    /*
    * EOF
    */
    

    Best regards

    Gennadi

  • Thank you for the test case.  When I build it, I see the compiler generate the symbol name __cla_CLAsincos_sp.  I don't know why it does that.  So, I filed CODEGEN-4496 in the SDOWP system to have this investigated.  You are welcome to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George