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-CC1352P: Adding obj file to project

Part Number: LAUNCHXL-CC1352P

Tool/software: Code Composer Studio

How do I link an external object file into a CCS project? I do not have the source code for the file. I have tried to include the obj file in the project folder, and included the obj file in the libraries included in the Project Properties->Arm Linker->File Search Path. I get an unresolved symbols error or an unrecognized file error. 

  • Samyukta Ramnath1 said:
    I have tried to include the obj file in the project folder, and included the obj file in the libraries included in the Project Properties->Arm Linker->File Search Path.

    Adding the object file physically to the project folder should be sufficient to force it into the build. However, for the linker to link it in successfully, it needs to be in an object format that is compatible with the other object files in the project. Do you know which toolchain was used to generate the object file? 

    For unresolved symbol errors please check this page: 
    http://software-dl.ti.com/ccs/esd/documents/sdto_ccs_build-errors.html#error-unresolved-symbols-remain

  • Hi AartiG,

    Thanks for your response!

    That's right, I probably used gcc to compile the obj file, whereas I am using the TI toolchain to compile the rest of the project. This leads to my next question - if I want to generate the object file (the source code for which is only a function, no main C function), how do I do that within a CSS project? The build fails because there's no main.

    Also, does this mean that if I have an object file that was compiled with a different (and unknown) compiler, that I won't be able to integrate it with the rest of my code using CCS? Can I use another tool such as cmake for this purpose?

    Thanks for the link you sent. It mentions that this error is common in new blank projects, but I have modified an existing example project for my purposes, so that I have everything that I need for the code to work on the CC1352P1.

    Warm regards,

    Samyukta

  • Samyukta Ramnath1 said:
    if I want to generate the object file (the source code for which is only a function, no main C function), how do I do that within a CSS project?

    If the source file (.c) is added to the project, you can right-click on the file in the Project Explorer view and choose Build Selected File.

  • Hi AartiG,

    Thank you for your help on compiling just the function object file.

    I built the function source file separately to get the object file within the same compiler as the rest of the project, and it got included within the Debug_TI folder. I then removed the source code folder, and wrote a main function that included the header file for the function and referenced the function, got another unresolved symbols error - "unresolved symbols remain - resetISR". By 'adding the object file physically to the project folder', do you mean just place it amongst the other source files (such as main.c)? In that case, is it enough if the function header file is also at the same level, and the main.c file includes that header? Do I need to enable any linker/compiler settings?

    Here is my linker output : 

    "/Applications/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.4.LTS/bin/armcl" -mv7M4 --code_state=16 -me -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi -z -m"Main_Blinky.map" --heap_size=0 --stack_size=256 -i"/Applications/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.4.LTS/lib" -i"/Applications/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.4.LTS/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="Main_Blinky_linkInfo.xml" --rom_model -o "Main_Blinky.out" "../add_2num.obj" "./main.obj" "../cc13x2r1f3.cmd"  -llibc.a 

    I see the main.obj and the add_2num.obj (this is the object file which I want to include) referenced in the linker, which is good, but I'm still getting the unresolved symbols error.

    Warm regards,

    Samyukta

  • Hello AartiG, 

    Thank you, with your help, I was able to include the object file that was built with the TI compiler into my CCS project. 

    However, the question remains whether I will be able to use an object file from an unknown source in my CCS project. Will I have to migrate away from CCS, or is there some way I can do this?

    Warm regards,

    Samyukta

  • Hi Samyukta,

    Samyukta Ramnath1 said:
    Thank you, with your help, I was able to include the object file that was built with the TI compiler into my CCS project. 

    Glad to hear you got that working.

    Samyukta Ramnath1 said:
    However, the question remains whether I will be able to use an object file from an unknown source in my CCS project. Will I have to migrate away from CCS, or is there some way I can do this?

    That depends on the toolchain used to generate the object file. The GCC ARM compiler produces ELF object files which are the same format as TI generated object files, so these object files can be combined together by the linker. However you may also need to ensure that certain compiler options match up (like silicon version, floating point support, etc).

    A generally useful article is A Brief History of TI Object File Formats.