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.

CCS/LAUNCHXL-F28069M: l"_atan2" redefined: first defined in symbol "_atan2" redefined: first defined in PM_Sensorles C/C++ Problem

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: DRV8301, CONTROLSUITE

Tool/software: Code Composer Studio

Hi ,

we made a macro file for sine cosine encoder .When we are using "atan2f " function we are getting an error  as follows

"Description Resource Path Location Type
symbol "_atan2" redefined: first defined in symbol "_atan2" redefined: first defined in PM_Sensorless C/C++ Problem"

then we changed the "atan2f "to "atan2" the program is building successfully .What can be the problem??

here is the code :

/*
 * sincos_f.h
 *
 *  Created on: May 27, 2017
 *      Author: Indra
 */

#ifndef SINCOS_F_H_
#define SINCOS_F_H_
#include"math.h"
#include<stdlib.h>

typedef struct {
    float  sin;  //input sine
    float cos;  //input cosine
    float atan;
    float angle_const;
    float mechTheta; // parameter
    float ElecTheta; // output electrical angle
    float Direction; // output
    float OldElecTheta; //

}sincos_f;

typedef sincos_f  *psin_cos_f;


#define sin_cos_default_vf  {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}

#define SCEN_MACROF(v)                                              \
                v.angle_const =57.2975;                             \
                v.atan = atan2f(v.sin, v.cos);                      \
                v.mechTheta = (v.atan * v.angle_const);             \
                v.ElecTheta = (v.mechTheta +180.0)*5;            \
                if(v.OldElecTheta > v.ElecTheta)                    \
                {                                                   \
                    v.Direction = 1;                                \
                }                                                   \
                else v.Direction = 0;                               \
              //  v.ElecTheta = (v.ElecTheta/1800);



#endif /* SINCOS_F_H_ */

thank you

  • SHAMEER N said:
    symbol "_atan2" redefined: first defined in symbol "_atan2" redefined: first defined in PM_Sensorless C/C++ Problem"

    Based upon a similar error in the thread CCS5.5 symbol "redefined" when only one file linked suspect a conflict between libraries.

    Can you show the complete output from the CCS build Console when the error occurs, so that can see the exact linker command line.

  • **** Build of configuration DRV8301_F2806x_RAM for project PM_Sensorless ****

    "D:\\ti\\ccsv7\\utils\\bin\\gmake" -k all
    'Building file: ../PM_Sensorless.c'
    'Invoking: C2000 Compiler'
    "D:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/bin/cl2000" --silicon_version=28 -g --define="_DEBUG" --define="DRV8301" --define="LARGE_MODEL" --define="FLOATING_MATH" --include_path="D:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/include" --include_path="D:/ti/controlSUITE/development_kits/~SupportFiles/F2806x_headers" --include_path="D:/ti/controlSUITE/device_support/f2806x/v110/F2806x_common/include" --include_path="D:/ti/controlSUITE/device_support/f2806x/v110/F2806x_headers/include" --include_path="D:/ti/controlSUITE/libs/app_libs/motor_control/math_blocks/v3.1" --include_path="D:/ti/controlSUITE/libs/math/IQmath/v15c/include" --include_path="D:/ti/controlSUITE/libs/math/FPUfastRTS/V100/include" --quiet --diag_warning=225 --large_memory_model --cla_support=cla0 --float_support=fpu32 --preproc_with_compile --preproc_dependency="PM_Sensorless.d" "../PM_Sensorless.c"
    'Finished building: ../PM_Sensorless.c'
    ' '
    'Building target: PM_Sensorless_DRV8301_F2806x.out'
    'Invoking: C2000 Linker'
    "D:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/bin/cl2000" --silicon_version=28 -g --define="_DEBUG" --define="DRV8301" --define="LARGE_MODEL" --define="FLOATING_MATH" --quiet --diag_warning=225 --large_memory_model --cla_support=cla0 --float_support=fpu32 -z -m"PM_Sensorless_DRV8301_F2806x.map" --stack_size=0x380 --warn_sections -i"D:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/lib" -i"D:/ti/controlSUITE/libs/math/FPUfastRTS/V100/lib" -i"D:/ti/controlSUITE/libs/math/IQmath/v15c/lib" -i"C:/Users/shameer/Desktop/new1/new1" -i"D:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/include" --reread_libs --xml_link_info="PM_Sensorless_DRV8301_F2806x_linkInfo.xml" --rom_model -o "PM_Sensorless_DRV8301_F2806x.out" "../rts2800_fpu32_fast_supplement.lib" -lrts2800_fpu32.lib "../IQmath_fpu32.lib" "./DLOG4CHC.obj" "./DRV8301_SPI.obj" "./F2806x_CodeStartBranch.obj" "./F2806x_GlobalVariableDefs.obj" "./F2806x_usDelay.obj" "./PM_Sensorless-DevInit_F2806x.obj" "./PM_Sensorless.obj" "./filterfloat.obj" "../F2806x_Headers_nonBIOS.cmd" "../F2806x_RAM_PM_Sensorless.CMD"

    >> Compilation failure
    makefile:144: recipe for target 'PM_Sensorless_DRV8301_F2806x.out' failed
    error: symbol "_atan2" redefined: first defined in
    "../rts2800_fpu32_fast_supplement.lib<atan2_f32.obj>"; redefined in
    "D:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/lib/rts2800_fpu32.lib<e_
    atan2f.obj>"
    error: errors encountered during linking; "PM_Sensorless_DRV8301_F2806x.out"
    not built
    gmake: *** [PM_Sensorless_DRV8301_F2806x.out] Error 1
    gmake: Target 'all' not remade because of errors.

    **** Build Finished ****
  • SHAMEER N said:
    'Building target: PM_Sensorless_DRV8301_F2806x.out'
    'Invoking: C2000 Linker'
    "D:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/bin/cl2000" --silicon_version=28 -g --define="_DEBUG" --define="DRV8301" --define="LARGE_MODEL" --define="FLOATING_MATH" --quiet --diag_warning=225 --large_memory_model --cla_support=cla0 --float_support=fpu32 -z -m"PM_Sensorless_DRV8301_F2806x.map" --stack_size=0x380 --warn_sections -i"D:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/lib" -i"D:/ti/controlSUITE/libs/math/FPUfastRTS/V100/lib" -i"D:/ti/controlSUITE/libs/math/IQmath/v15c/lib" -i"C:/Users/shameer/Desktop/new1/new1" -i"D:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/include" --reread_libs --xml_link_info="PM_Sensorless_DRV8301_F2806x_linkInfo.xml" --rom_model -o "PM_Sensorless_DRV8301_F2806x.out" "../rts2800_fpu32_fast_supplement.lib" -lrts2800_fpu32.lib "../IQmath_fpu32.lib" "./DLOG4CHC.obj" "./DRV8301_SPI.obj" "./F2806x_CodeStartBranch.obj" "./F2806x_GlobalVariableDefs.obj" "./F2806x_usDelay.obj" "./PM_Sensorless-DevInit_F2806x.obj" "./PM_Sensorless.obj" "./filterfloat.obj" "../F2806x_Headers_nonBIOS.cmd" "../F2806x_RAM_PM_Sensorless.CMD"

    That linker command shows:

    a) The --reread_libs option used, which allows the linker to make multiple reads of the libraries to resolve references.

    b) The linker set to use the rts2800_fpu32.lib run time library rather, than making an automatic selection.

    Based on other forum threads think this combination of options may be triggering the problem.

    On the assumption that your project is based upon the modified controlSUITE PM Sensorless example for a DRV8301-HC-C2-KIT can you try:

    1) In the Project Properties under Build -> C2000 Linker -> File Search Path untick the "Reread libraries; resolve backward references (--reread_libs, -X)" option:

    2) In the Project Properties under General change the Runtime Support Library option to "<automatic>":

    If the above suggested changes don't resolve the error, can you zip up and attach your complete project?

  • Chester Gillon,The suggested changes solved the problem,thank you very much
  • the compiler showing warning while building.please find the attached zip file .