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.

BIOS 5 config as a library

I want to create a project in CCS 4 that compiles to a library, and contains a BIOS 5 .tcf configuration. I then want to link this library against several different applications. Is there a recommended procedure for doing this? It seems like it should work but I am getting a seemingly endless succession of linker errors, more getting added every time I fix one.

 

What I've done so far:

- Create new project 'testlib', which generates a library. Add a BIOS 5 config to it and customize the config. Add testlib.h, which contains so far only #include "testlibcfg.h".

- Create new project 'testapp', which generates an Executable, and depends on testlib. Add main.c to it, which is only #include "testlib.h" and a hello world.

- Add the testlib.lib and testlibcfg.cmd to the "Include library file or command file as input" section of the application project's build properties.

 

 

The current set of errors is:

Severity and Description Path Resource Location Creation Time Id

errors encountered during linking; "testapp.out" not built testapp line 0 1276718825768 2332

symbol "__stack" redefined: first defined in "C:\Program Files\Texas Instruments\ccsv4\tools\compiler\c6000\lib\rts6740.lib<boot.obj>"; redefined in "C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/bios/lib/bios.a674<boot.o674>" testapp line 0 1276718825768 2330

symbol "_c_int00" redefined: first defined in "C:\Program Files\Texas Instruments\ccsv4\tools\compiler\c6000\lib\rts6740.lib<boot.obj>"; redefined in "C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/bios/lib/bios.a674<boot.o674>" testapp line 0 1276718825768 2331

symbol "_RTDX_Buffer_End" redefined: first defined in "C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/rtdx/lib/c6000/rtdx64xplus.lib<rtdx_ buf.o64P>"; redefined in "C:\\Documents and Settings\\jamesj\\My Documents\\ccs-workspace\\testlib\\Debug\\testlib.lib<testlibcfg.obj>" testapp line 0 1276718825768 2328

symbol "_RTDX_Buffer_Start" redefined: first defined in "C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/rtdx/lib/c6000/rtdx64xplus.lib<rtdx_ buf.o64P>"; redefined in "C:\\Documents and Settings\\jamesj\\My Documents\\ccs-workspace\\testlib\\Debug\\testlib.lib<testlibcfg.obj>" testapp line 0 1276718825768 2327

symbol "_RTDX_Buffer" redefined: first defined in "C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/rtdx/lib/c6000/rtdx64xplus.lib<rtdx_ buf.o64P>"; redefined in "C:\\Documents and Settings\\jamesj\\My Documents\\ccs-workspace\\testlib\\Debug\\testlib.lib<testlibcfg.obj>" testapp line 0 1276718825768 2329

  • So are you just adding the libraries like you would a source file to the project?  I think that's the cause of all these redefinition errors.  For library files you should use the --library option rather than including it as a source file.  In CCS 4 you can do this by right-clicking on the project and selecting Build Properties.  Then under the linker settings click on File Search Path.  You will then have the options to add library files and search paths.  Add all of your libraries through this dialog and remove as part of the project to get rid of the redefinition errors.

  • No, actually I am already using File Search Path as you suggest.

  • Can you paste your build output here?  I don't have any more ideas so I'm hoping I'll think of something based on your build output!

  • hi James,

    BIOS config (tcf) is typically done on the end-application rather than on a library. Reason (primarily) is that it contains Global board-level configuration options (GBL, MEM etc). 

    I can think of 2 ways you might want to solve your problem: -

    (a) use a myLib.tci file - think of this like a Tconf include file - put in stuff related to your lib here (e.g. TSK settings necessary or similar i.e. non global stuff)

    http://processors.wiki.ti.com/index.php/Getting_CPU_Load_on_a_per_task_basis shows a similar style i.e. a lib w/ a helper tci - intent is for app-writer to include that tci in end-app

    (b) if u're trying to lock down relationships (i.e. N obj files together precompiled) consider partial linking - e.g. http://processors.wiki.ti.com/index.php/Managing_Symbols_with_the_Linker#Creating_XDAIS-compliant_libraries_with_localize_and_globalize 

    (also see the linker manual)

    That way u can prebuild a bunch of stuff together then do a final link of incremental stuff.

     

    I think core problem w/ above is that by adding tcf config to a lib you are bringing in board level init (e.g. RTS, boot etc). Try (a) or (b) and u should be good.

    Cheers, Alan

  •  

    **** Build of configuration Debug for project testlib ****

     

    C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake -k all 

    'Building file: ../testlib.tcf'

    'Invoking: TConf Script Compiler'

    "C:/Program Files/Texas Instruments/xdctools_3_16_03_36/tconf" -b -Dconfig.importPath="C:/Program Files/Texas Instruments/bios_5_41_03_17/packages;" "../testlib.tcf"

    'Finished building: ../testlib.tcf'

    ' '

    'Building file: testlibcfg.s??'

    'Invoking: Compiler'

    "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/bin/cl6x" -mv6740 -g --include_path="C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/include" --include_path="C:/Documents and Settings/jamesj/My Documents/ccs-workspace/testlib/Debug" --include_path="C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/bios/include" --include_path="C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/rtdx/include/c6000" --diag_warning=225 --preproc_with_compile --preproc_dependency="testlibcfg.pp"  "testlibcfg.s62"

    'Finished building: testlibcfg.s??'

    ' '

    'Building file: testlibcfg_c.c'

    'Invoking: Compiler'

    "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/bin/cl6x" -mv6740 -g --include_path="C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/include" --include_path="C:/Documents and Settings/jamesj/My Documents/ccs-workspace/testlib/Debug" --include_path="C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/bios/include" --include_path="C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/rtdx/include/c6000" --diag_warning=225 --preproc_with_compile --preproc_dependency="testlibcfg_c.pp"  "testlibcfg_c.c"

    'Finished building: testlibcfg_c.c'

    ' '

    'Building target: testlib.lib'

    'Invoking: Archiver'

    "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/bin/ar6x" r "testlib.lib" "./testlibcfg_c.obj" "./testlibcfg.obj" 

      ==>  new archive 'testlib.lib'

      ==>  building archive 'testlib.lib'

    'Finished building target: testlib.lib'

    ' '

    Build complete for project testlib

    **** Build of configuration Debug for project testapp ****
    C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake -k all 
    'Building file: ../main.c'
    'Invoking: Compiler'
    "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/bin/cl6x" -mv6740 -g --include_path="C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/include" --include_path="C:/Documents and Settings/jamesj/My Documents/ccs-workspace/testlib" --include_path="C:/Documents and Settings/jamesj/My Documents/ccs-workspace/testapp/Debug" --include_path="C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/bios/include" --include_path="C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/rtdx/include/c6000" --diag_warning=225 --preproc_with_compile --preproc_dependency="main.pp"  "../main.c"
    'Finished building: ../main.c'
    ' '
    'Building target: testapp.out'
    'Invoking: Linker'
    "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/bin/cl6x" -mv6740 -g --diag_warning=225 -z -m"testapp.map" --warn_sections -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/lib" -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/include" -i"C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/rtdx/lib/c6000" -i"C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/bios/lib" --reread_libs --rom_model -o "testapp.out"  "./main.obj" -l"libc.a" -l"" -l"" 
    <Linking>
    error: cannot find file "-l"
    warning: creating ".stack" section with default size of 0x400; use the -stack
       option to change the default size
     undefined   first referenced
      symbol         in file     
     ---------   ----------------
     _LOG_printf ./main.obj      
     _trace      ./main.obj      
    error: unresolved symbols remain
    error: errors encountered during linking; "testapp.out" not built
    >> Compilation failure
    C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake: *** [testapp.out] Error 1
    C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake: Target `all' not remade because of errors.
    Build complete for project testapp

  • First, I think Alan's suggestions are great and you should consider switching gears.

    James Jurack said:
    'Invoking: Linker'
    "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/bin/cl6x" -mv6740 -g --diag_warning=225 -z -m"testapp.map" --warn_sections -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/lib" -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/include" -i"C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/rtdx/lib/c6000" -i"C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/bios/lib" --reread_libs --rom_model -o "testapp.out"  "./main.obj" -l"libc.a" -l"" -l"" 
    <Linking>
    error: cannot find file "-l"
    warning: creating ".stack" section with default size of 0x400; use the -stack
       option to change the default size
     undefined   first referenced
      symbol         in file     
     ---------   ----------------
     _LOG_printf ./main.obj      
     _trace      ./main.obj      
    error: unresolved symbols remain
    error: errors encountered during linking; "testapp.out" not built
    >> Compilation failure
    C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake: *** [testapp.out] Error 1
    C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake: Target `all' not remade because of errors.
    Build complete for project testapp

    Looks like there are 2 empty libraries included which I highlighted in red.

    Also, I do not see the BIOS-generated linker command file being utilized by the linker.  Probably because it's a different project that is the BIOS project.  This is quite far from the intended use.  I think Alan's suggestions are the way to go.

  • AC, your suggestions look good and I'll look into those.

     

    Brad: Oops, I had been moving stuff around and messed up the testlib -l statements. That's fixed, and we're back to my other problem:

     

     

     

     

    **** Build of configuration Debug for project testapp ****

     

    C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake -k all 

    'Building file: ../main.c'

    'Invoking: Compiler'

    "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/bin/cl6x" -mv6740 -g --include_path="C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/include" --include_path="C:/Documents and Settings/jamesj/My Documents/ccs-workspace/testlib" --include_path="C:/Documents and Settings/jamesj/My Documents/ccs-workspace/testapp/Debug" --include_path="C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/bios/include" --include_path="C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/rtdx/include/c6000" --diag_warning=225 --preproc_with_compile --preproc_dependency="main.pp"  "../main.c"

    'Finished building: ../main.c'

    ' '

    'Building target: testapp.out'

    'Invoking: Linker'

    "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/bin/cl6x" -mv6740 -g --diag_warning=225 -z -m"testapp.map" --warn_sections -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/lib" -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/c6000/include" -i"C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/rtdx/lib/c6000" -i"C:/Program Files/Texas Instruments/bios_5_41_03_17/packages/ti/bios/lib" --reread_libs --rom_model -o "testapp.out"  "./main.obj" -l"libc.a" -l"C:\Documents and Settings\jamesj\My Documents\ccs-workspace\testlib\Debug\testlibcfg.cmd" -l"C:\Documents and Settings\jamesj\My Documents\ccs-workspace\testlib\Debug\testlib.lib" 

    <Linking>

    error: symbol "_RTDX_Buffer_Start" redefined: first defined in "C:/Program

       Files/Texas

       Instruments/bios_5_41_03_17/packages/ti/rtdx/lib/c6000/rtdx64xplus.lib<rtdx_

       buf.o64P>"; redefined in "C:\\Documents and Settings\\jamesj\\My

       Documents\\ccs-workspace\\testlib\\Debug\\testlib.lib<testlibcfg.obj>"

    error: symbol "_RTDX_Buffer_End" redefined: first defined in "C:/Program

       Files/Texas

       Instruments/bios_5_41_03_17/packages/ti/rtdx/lib/c6000/rtdx64xplus.lib<rtdx_

       buf.o64P>"; redefined in "C:\\Documents and Settings\\jamesj\\My

       Documents\\ccs-workspace\\testlib\\Debug\\testlib.lib<testlibcfg.obj>"

    error: symbol "_RTDX_Buffer" redefined: first defined in "C:/Program

     

       Files/Texas

    >> Compilation failure

       Instruments/bios_5_41_03_17/packages/ti/rtdx/lib/c6000/rtdx64xplus.lib<rtdx_

       buf.o64P>"; redefined in "C:\\Documents and Settings\\jamesj\\My

       Documents\\ccs-workspace\\testlib\\Debug\\testlib.lib<testlibcfg.obj>"

    error: symbol "__stack" redefined: first defined in "C:\Program Files\Texas

       Instruments\ccsv4\tools\compiler\c6000\lib\rts6740.lib<boot.obj>"; redefined

       in "C:/Program Files/Texas

       Instruments/bios_5_41_03_17/packages/ti/bios/lib/bios.a674<boot.o674>"

    error: symbol "_c_int00" redefined: first defined in "C:\Program Files\Texas

       Instruments\ccsv4\tools\compiler\c6000\lib\rts6740.lib<boot.obj>"; redefined

       in "C:/Program Files/Texas

       Instruments/bios_5_41_03_17/packages/ti/bios/lib/bios.a674<boot.o674>"

    error: errors encountered during linking; "testapp.out" not built

    C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake: *** [testapp.out] Error 1

    C:\Program Files\Texas Instruments\ccsv4\utils\gmake\gmake: Target `all' not remade because of errors.

    Build complete for project testapp

     

     

  • I've been looking over your build output for some time but unfortunately I do not see what is causing the redefinition errors.  :(  I think it's time to take AC's suggestions or hope someone else jumps in!