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.

Undefined Symbols CCSv5.1

Guru 15580 points
Other Parts Discussed in Thread: OMAP-L138

Gents,

I am back to a "rookie-level" problem that has had me baffled for a couple of days. I, for some reason, cannot seem to provide the proper path information to the linker so that it can find my .lib file. I am trying to compile/link a simple ARM initialization routine that uses some of the BSL files fro Logic PD. I added a link to the library file in my project directory so that the .lib file (arm_bsl.lib) shows up in the project explorer window. The program compiles with no errors, but I keep getting the following "undefined symbols" (note the leading underscores).

 

<Linking>

 

 undefined                 first referenced

  symbol                       in file     

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

 _EVMOMAPL138_pinmuxConfig ./main.obj      

 _GPIO_setDir              ./main.obj      

 _GPIO_setOutput           ./main.obj      

 _I2C_init                 ./main.obj      

 _USTIMER_delay            ./main.obj      

 _USTIMER_init             ./main.obj      

 _config_pll0              ./amx_init.obj  

 

error: unresolved symbols remain

 

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

>> Compilation failure

gmake: *** [ARM_init_simple.out] Error 1

gmake: Target `all' not remade because of errors.

 

**** Build Finished ****

However, if I then delete the link to arm_bsl.lib in a second project that references the same BSL code/library, I get undefined symbols with no leading underscore.

 

<Linking>

 

 undefined      first referenced        

  symbol            in file             

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

 SPIFLASH_erase ./spiflash_utilities.obj

 SPIFLASH_init  ./spiflash_utilities.obj

 SPIFLASH_read  ./spiflash_utilities.obj

 SPIFLASH_write ./spiflash_utilities.obj

 USTIMER_delay  ./spiflash_utilities.obj

 USTIMER_init   ./main.obj              

 UTIL_printMem  ./spiflash_utilities.obj

 config_pll0    ./amx_init.obj          

 

error: unresolved symbols remain

 

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

>> Compilation failure

gmake: *** [ARM_spiflash.out] Error 1

gmake: Target `all' not remade because of errors.

 

**** Build Finished ****

I have tried both a link to the .lib file, as well as adding a copy of the .lib file to my project, but neither get rid of the link error. 

Can anyone suggest a way to find out what I am doing wrong? 

Thx,

MikeH

 

 

 

 

  • MikeH said:
    I added a link to the library file in my project directory so that the .lib file (arm_bsl.lib) shows up in the project explorer window. The program compiles with no errors, but I keep getting the following "undefined symbols" (note the leading underscores).

    Can you copy and paste the complete build output from the build console? Is the arm_bsl.lib listed as an input to the link command?

    Instead of adding or linking the file to the project, have you tried adding the lib to the --library linker option (under Project Build Properties->Linker->File Search Path)?

    MikeH said:

    However, if I then delete the link to arm_bsl.lib in a second project that references the same BSL code/library, I get undefined symbols with no leading underscore.

    The difference in underscore symbols vs no underscore is likely because one project is set for COFF ABI while the other is EABI. This article has more details on symbol naming in COFF vs EABI:
    http://processors.wiki.ti.com/index.php/C6000_EABI_Migration#COFF_Underscore_Name_Mangling

  • Hi Aarti,

    AartiG said:
    Can you copy and paste the complete build output from the build console?

    Here 'tis.

     

    **** Build of configuration Debug for project ARM_init_simple ****

     

    C:\ccs\ccsv5\utils\bin\gmake -k all 

    'Building target: ARM_init_simple.out'

    'Invoking: TMS470 Linker'

    "C:/ccs/ccsv5/tools/compiler/tms470/bin/cl470" -mv6 -g --diag_warning=225 --abi=ti_arm9_abi --code_state=32 -z -m"ARM_init_simple.map" --warn_sections -i"C:/ccs/ccsv5/tools/compiler/tms470/lib" -i"C:/Users/Mike/git/AMX/ARM_BSL/Debug" -i"C:/Users/Mike/git/AMX/ARM_init_simple" -i"C:/Users/Mike/TI Workspaces/AMX/ARM_init_simple" -i"C:/ccs/ccsv5/tools/compiler/tms470/include" --reread_libs --rom_model -o "ARM_init_simple.out"  "./main.obj" "./amx_init.obj" -l"libc.a" -l"C:\Users\Mike\git\AMX\ARM_BSL\Debug\arm_bsl.lib" "../arm_bsl.lib" "../linker_arm.cmd" 

    <Linking>

     

     undefined                 first referenced

      symbol                       in file     

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

     _EVMOMAPL138_pinmuxConfig ./main.obj      

     _GPIO_setDir              ./main.obj      

     _GPIO_setOutput           ./main.obj      

     _I2C_init                 ./main.obj      

     _USTIMER_delay            ./main.obj      

     _USTIMER_init             ./main.obj      

     _config_pll0              ./amx_init.obj  

     

    error: unresolved symbols remain

     

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

    >> Compilation failure

    gmake: *** [ARM_init_simple.out] Error 1

    gmake: Target `all' not remade because of errors.

     

    **** Build Finished ****

     

    AartiG said:
    Is the arm_bsl.lib listed as an input to the link command?

    I added it to this link attempt (see above) in the CCS Properties->TMS470 Linker->Files Search Path->Include library files as input ("${workspace_loc:/ARM_BSL/Debug/arm_bsl.lib}") . Still get the same link errors.

    AartiG said:
    Instead of adding or linking the file to the project, have you tried adding the lib to the --library linker option (under Project Build Properties->Linker->File Search Path)?

    Yes ("${workspace_loc:/ARM_BSL/Debug}"). Same errors.

    AartiG said:
    The difference in underscore symbols vs no underscore is likely because one project is set for COFF ABI while the other is EABI. This article has more details on symbol naming in COFF vs EABI:

    Thanks. Would this have any effect on the errors I am seeing?

    Any other thoughts?

    Thx,

    MikeH

     

     

     

  • Mike,

    The build command looks ok. The next step would be confirm that the arm_bsl.lib does indeed define those symbols. There is a utility in the codegen tools folder called ofd470 (in \ccsv5\tools\compiler\tms470\bin), which you can run on the .lib file from a command line. Open a command prompt, go to the directory where the arm_bsl.lib file is located, and type:

    ofd470 -g arm_bls.lib > arm_bsl.ofd

    You may need to specify the full path to ofd470.exe.

    Open the .ofd output file and confirm that those symbols exist. Let us know what you find.

     

  • Aarti,

    AartiG said:
    The next step would be confirm that the arm_bsl.lib does indeed define those symbols

    I had actually already done this using a Hex editor/viewer. Here's is what I found for GPIO_setDir.

    ...so this leads me to believe that the symbols are there. Also, I use this same .lib file in the other project that I mentioned.

    FYI, I created this project using CCSv5.1. Not sure if this makes any difference, but thought I would mention it.

    Thx,

    MikeH

  • Mike,

    Can you compare the build options of the other working project with this one (or post them here for us to look at)? I still suspect that it may have something to do with COFF/EABI since when you remove the lib from the working project, the undefined symbols are listed without the leading underscore, whereas the non-working project lists them with the underscores.

    Was this library ever rebuilt and if so, do you know what options were used?

    Are you able to share your project, by any chance, so we can reproduce the issue and look into it? If you do, you would need to make sure to include all the necessary files. See this article for techniques on exporting projects: http://processors.wiki.ti.com/index.php/Project_Sharing

  • Aarti,

    AartiG said:
    Can you compare the build options of the other working project with this one (or post them here for us to look at)?

    See below:

    Working Project (library)

    =============================================================

    -mv5e -g 

    --include_path="C:/Users/Mike/TI Workspaces/AMX_9-21-11/DSP_BSL/inc" 

    --include_path="C:/ccs/ccsv5/tools/compiler/tms470/include" 

    --diag_warning=225 -me 

    --abi=eabi 

    --code_state=32

     

    Non-working Project

    ==============================================================

    -mv6 -g 

    --include_path="C:/ccs/ccsv5/tools/compiler/tms470/include" 

    --include_path="C:/Users/Mike/TI Workspaces/AMX_9-21-11/ARM_init_simple" 

    --include_path="C:/Users/Mike/TI Workspaces/AMX_9-21-11/DSP_BSL/inc" 

    --include_path="C:/Users/Mike/TI Workspaces/AMX_9-21-11/ARM_BSL" 

    --diag_warning=225 

    --abi=ti_arm9_abi 

    --code_state=32

     

     

  • Aarti,

    Sorry. The build setting above for the non-working project were set for an ARM11 processor. I changed them to ARM9 for my OMAP-L138 chip. The resulting build settings are show below. 

     

     

     

    Working Project

    =============================================================

    -mv5e -g 

    --include_path="C:/Users/Mike/TI Workspaces/AMX_9-21-11/DSP_BSL/inc" 

    --include_path="C:/ccs/ccsv5/tools/compiler/tms470/include" 

    --diag_warning=225 -me 

    --abi=eabi 

    --code_state=32

     

    Non-working Project

    ==============================================================

    -mv5e -g 

    --include_path="C:/ccs/ccsv5/tools/compiler/tms470/include" 

    --include_path="C:/Users/Mike/TI Workspaces/AMX_9-21-11/ARM_init_simple" 

    --include_path="C:/Users/Mike/TI Workspaces/AMX_9-21-11/DSP_BSL/inc" 

    --include_path="C:/Users/Mike/TI Workspaces/AMX_9-21-11/ARM_BSL" 

    --diag_warning=225 -me 

    --abi=eabi 

    --code_state=32

    And the leading underscores are now gone in the error message.

     

     

    **** Build of configuration Debug for project ARM_init_simple ****

     

    C:\ccs\ccsv5\utils\bin\gmake -k all 

    'Building target: ARM_init_simple.out'

    'Invoking: TMS470 Linker'

    "C:/ccs/ccsv5/tools/compiler/tms470/bin/cl470" -mv5e -g --diag_warning=225 -me --abi=eabi --code_state=32 -z -m"ARM_init_simple.map" --warn_sections -i"C:/ccs/ccsv5/tools/compiler/tms470/lib" -i"C:/ccs/ccsv5/tools/compiler/tms470/include" --reread_libs --rom_model -o "ARM_init_simple.out"  "./main.obj" "./leds.obj" "./lcd.obj" "./gpio.obj" "./globals.obj" "./amx_init.obj" -l"C:\Users\Mike\TI Workspaces\AMX_9-21-11\ARM_BSL\Debug\arm_bsl.lib" -l"libc.a" 

    <Linking>

    warning: creating ".stack" section with default size of 0x800; use the -stack

       option to change the default size

     

     undefined                first referenced

      symbol                      in file     

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

     EVMOMAPL138_pinmuxConfig ./gpio.obj      

     GPIO_getInput            ./gpio.obj      

     GPIO_setDir              ./gpio.obj      

     GPIO_setOutput           ./leds.obj      

     I2C_init                 ./main.obj      

     USTIMER_delay            ./main.obj      

     USTIMER_init             ./main.obj      

     config_pll0              ./amx_init.obj  

     

    error: unresolved symbols remain

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

     

    >> Compilation failure

    gmake: *** [ARM_init_simple.out] Error 1

    gmake: Target `all' not remade because of errors.

     

    **** Build Finished ****

    However, I still need to resolve the unresolved symbols.......???

    Thx,

    MikeH

     

     

     

  • Aarti,

    I changed the compiler version on my library project to v4.9.0 (was v4.6.4?), recompiled the library, the built & compiled the non-working project and the missing symbols were resolved! Interesting that a compiler version difference would cause this to occur....?

    I guess I will move on to other issues now. Thanks for taking a look.

    MikeH