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.

TMS320F280039C: Passing paths in linker command file

Part Number: TMS320F280039C

Tool/software:

Hello TI, 

I have a project with a linker command file.
I want in this file to include files from outside of my project, but in the same workspace.

I've tried the following syntax:

${CCS_WORKSPACE_DIR}\${DifferentProject}\my_file

DifferentProject is a variable defined by me in:
Project Properties -> Build -> Variables

When building the project, I get the error that it cannot find the file "$".
I've tried eliminating the $ and doing only CCS_WORKSPACE_DIR\DifferentProject\my_file, but I got the same error.

I've also tried Project Properties -> C2000 Linker -> File Search Path -> Add <dir> to library search path -> I added the path to my file here.
I called my_file in my linker command file and it still does not recognize it.

What is the proper syntax to call files in my linker command file?

A workaround is calling the entire path to my file C:/Workspace/.../my_file

But I'll need this project to work on different workspaces and computers if imported as well so I'd like to be able to use environment variables such as CCS_WORKSPACE_DIR.

  • Hi, 

    Please see the following: 

    Could you try using ${PROJECT_ROOT}/../your_file  ? 

    Best Regards,

    Ben Collier

  • Hi Ben,

    Unfortunately this does not work on my end.

    Please see the following:




    All of the commented lines have been tried as alternatives.

    The entire path works C:\0_0_NEW_WORKSPACES\Workspace_02\F580a_boot\Debug\boot.o(codestart).

    If this works for you, please show me the way you wrote this in linker (cmd) file.

  • Hi,

    Is there a reason that you cannot simply include the codestart file in each one of the projects sot hat you can use the ${PROJECT_ROOT}? 

    That is typically what we do in our examples.

    Best Regards,

    Ben Collier

  • Hi Ben,

    codestart is not a file, but a memory section from an executable of a different project.

    I've added the executable to my project, but ${PROJECT_ROOT}/boot.o(codestart) gives the same error.

    Seems that the linker (cmd) file is not able to recognize Environment variables of the project.

    If ${PROJECT_ROOT} works on your end and in your examples, could you tell me an example which utilizes this approach?

  • Please allow me some time to get back to you on this.

  • You will not be able to use CCS/Eclipse variables inside linker command files.

    I will bring this thread to the attention of the compiler experts for further comment.

  • It is not possible to refer to CCS build variables from within C source, linker command files, etc.  

    I've also tried Project Properties -> C2000 Linker -> File Search Path -> Add <dir> to library search path -> I added the path to my file here.
    I called my_file in my linker command file and it still does not recognize it.

    That was close.  Please add the directory to the library search path.  When you do it that way, you can refer to CCS build variables.  Presume one of those directories contains an object file named my_file.obj.  This entry in a linker command file is how to refer to it ...

    "--library=my_file.obj"

    The option --library says that file is not in the current directory, and to look for it in the directories named with the --search_path option.  For the details, please search the C28x assembly tools manual for the sub-chapter titled Alter the Library Search Algorithm.

    Thanks and regards,

    -George

  • We access CCS defined defines in our LCFs as follows:

    Then, in some LCF:

    #if defined(LCF_DEBUG)
      #define _MYLIB_FILENAME_ mylib_debug.lib
    #elif defined(LCF_RELEASE)
      #define _MYLIB_FILENAME_ mylib.lib

    #else

    // missing --define in the LINKER defined symbols
    // in CSS, this section is found in project properties -> C2000 Linker -> advanced Options -> Command File Preprocesing

    #error "Please define debug or release for your linker command file"
    #endif