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.

Issue using c67xfastMath.lib along with math.h

Other Parts Discussed in Thread: MATHLIB, OMAP-L138

Hello,

I am trying to use math functions from both math.h and c67xfastMath.lib in a file.  I have had no problem with other C-files in my project if I only use functions
from either "math.h" or "c67xfastMath.lib"  however in this one particular file I need functions from both libraries.

I am getting the following compile/linker error:

----------------------------------------------------

"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/C6000 Code Generation Tools 7.3.5/bin/cl6x" -mv6740 --symdebug:none -O3 --include_path="C:/c67xmathlib_2_01_00_00/inc" --include_path="C:/Program Files/Texas Instruments/ccsv4/tools/compiler/C6000 Code Generation Tools 7.3.5/include" --include_path="C:/Documents and Settings/WBarie/My Documents/workspace/basic_drive/Debug" --include_path="C:/Program Files/Texas Instruments/bios_5_41_10_36/packages/ti/bios/include" --include_path="C:/Program Files/Texas Instruments/bios_5_41_10_36/packages/ti/rtdx/include/c6000" --diag_warning=225 --abi=coffabi --optimizer_interlist --opt_for_speed=5 -k --asm_listing --preproc_with_compile --preproc_dependency="autotune.pp" --c64p_dma_l1d_workaround  "../autotune.c"
'Finished building: ../autotune.c'
' '
'Building target: basic_drive.out'
'Invoking: Linker'
"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/C6000 Code Generation Tools 7.3.5/bin/cl6x" -mv6740 --symdebug:none -O3 --diag_warning=225 --abi=coffabi --optimizer_interlist --opt_for_speed=5 -k --asm_listing -z -m"basic_drive.map" --warn_sections -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/C6000 Code Generation Tools 7.3.5/lib" -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/C6000 Code Generation Tools 7.3.5/include" -i"C:/Program Files/Texas Instruments/bios_5_41_10_36/packages/ti/rtdx/lib/c6000" -i"C:/Program Files/Texas Instruments/bios_5_41_10_36/packages/ti/bios/lib" --reread_libs --rom_model -o "basic_drive.out" -l"./basic_drivecfg.cmd"  "./state.obj" "./reset.obj" "./ramp.obj" "./pwm.obj" "./protection.obj" "./precharge.obj" "./pi_loop.obj" "./param.obj" "./overload.obj" "./mtrctl.obj" "./meter.obj" "./main.obj" "./io_led.obj" "./io_dac.obj" "./io_blvds_bus.obj" "./io_arm.obj" "./init.obj" "./info.obj" "./filter.obj" "./fault.obj" "./edma.obj" "./controlfbk.obj" "./control.obj" "./basic_drivecfg_c.obj" "./basic_drivecfg.obj" "./autotune.obj" -l"C:\c67xmathlib_2_01_00_00\lib\c67xfastMath.lib" -l"libc.a" "../c67xfastMath.lib" "../vfd.cmd"
<Linking>
error: symbol "_sqrtf" redefined: first defined in "C:/Program Files/Texas
   Instruments/ccsv4/tools/compiler/C6000 Code Generation Tools
   7.3.5/lib/rts6740.lib<sqrtf.obj>"; redefined in
   "C:\c67xmathlib_2_01_00_00\lib\c67xfastMath.lib<sqrtsp.obj>"
error: errors encountered during linking; "basic_drive.out" not built

>> Compilation failure
gmake: *** [basic_drive.out] Error 1
gmake: Target `all' not remade because of errors.

----------------------------------------------------

I understand that the fast math library is a subset of the normal math library but in this case it appears that the fast math library
and the normal math library are not working together properly.  

Following SPRU100a section 2.3.2, I have added "c67xfastMath.lib" to my CCS project.

I have also added "c67xfastMath.lib" to the "Build Properties/C6000 Linker/" "Include library file" box and inserted it as the first item.

In Build Properties/C6000 Compiler/Include options I have also included "c67xfastMath.lib" as the first item in the list.

I only have problems with one particular C-file that needs to use fast math functions "sqrtsp" and "sinsp" as well as normal math functions such\
as "acosf".

I have tried various combinations of adding the fast math include and removing the include from various project settings inside Code Composer
but end up with either this exact issue or some similar linker issue

More background:

CCS ver 4.2.5.0005

C6000 Codegen tools 7.3.5

Can someone please provide help in resolving this issue?

Walt B.

  • Walter,

    I wonder if your linker settings are causing this issue as you are linking the C67x fastMath.lib twice according to your build log (on either side of -libc.a) which is the library that desides which rts library is to be used.In your build log look for

    -l"C:\c67xmathlib_2_01_00_00\lib\c67xfastMath.lib" -l"libc.a" "../c67xfastMath.lib" "../vfd.cmd"

    To make sure you are using the right order, set the link order under Build Properties->CCS Build-> Link order. Put the .cmd file and -libc.a in the end(or lower priority)

    If this doesn`t resolve your issue, you have a linker options that can help. under C6000 linker->Search libraries in priority order.( Option --scan_priority.). this is not required if you have provided the link order because symbols are searched in libraries from left to right from order specified on command line.

    Regards,

    Rahul

    PS: I am assuming that you are using a C67x device rather than a C674x device. If you are using a C674x device there is an updated version available on ti.com under the name MATHLIB. I recommend upgrading to the new library.

    http://www.ti.com/tool/mathlib

  • Thanks for the response.

    I am using a C6748 device inside an OMAP-L138 so I converted over to the MATHLIB library.  In the process of deleting the c67xfastMath.lib components from my CCS project and adding the new MATHLIB the linking issue went away.   I made sure that under C6000 linker -> File Search path that the MATHLIB library was first in the list just as I had done with the c67xfastMath library.   I never could find why the c67xfastMath.lib was being included twice but deleting it and then changing the configuration to use MATHLIB fixed the issue.

    Walt B.