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.

Linking folders vs linking files

Hi,

   I have gone through many TI examples and I noticed that TI examples use "Link" instead "Add".  This link explained the benefit of linking folders instead of files.

http://processors.wiki.ti.com/index.php/Linking_folders_to_a_project

    I am using CCS 6.1, MCSDK3, EVMK2H. I am building a RTSC project. My question is:

     1: Why TI examples link only the .c files instead of .c and .h files?

     2: If I am linking project folders, is there a way I can only link .c files?

     3: If I have 2 linking folders inside my RTSC project, how do I control which one build first?

     v/r

     Yoyo

  • Yoyo Lee said:
     1: Why TI examples link only the .c files instead of .c and .h files?

    Header files are not required to be linked to the project, as long as their path is provided for the compiler to be able to "find" them (include paths are provided under Project Properties->Build->Compiler->Include Options).

    Yoyo Lee said:
    2: If I am linking project folders, is there a way I can only link .c files?

    All files within a linked folder will be considered to be part of the build by default, but you have the option of excluding certain files from build. Please see:

    Yoyo Lee said:
     3: If I have 2 linking folders inside my RTSC project, how do I control which one build first?

    I believe source files/folders are built in alphabetical order (with source files in the main project folder built before files in sub-folders). The order in which source files are built shouldn't matter as much as the order in which they are linked. Is that what you are asking about? If so, the order in which files are passed to the linker can be controlled from Project Properties->Build->Link Order tab.

  • Hi AartiG,

                  Thank you for response my post. 

                  I got your first response.  I am not sure about 2nd and 3rd answer. 

                  I feel you seem to guide me to a link or something but the website failed to load. Could you attach the link one more time?

                  For the 3rd response, I am a little bit confuse.  Based on your response, if I have two folders(Alfa and Beta) inside my RTSC project directory. Alfa contains main.c and Belta contains library that Alfa will use.  Alfa should build first following alphabetical order.  Even so Alfa need function definition from Belta and Belta has not been build yet, but it's not a issue since Link Order should take care of it.   Do I understand correct?

                 v/r

                 Yoyo

                

  • Yoyo Lee said:
    I feel you seem to guide me to a link or something but the website failed to load. Could you attach the link one more time?

    Sorry about that. I meant to link to this reference about "excluding files from build":
    http://processors.wiki.ti.com/index.php/Projects_and_Build_Handbook_for_CCS#Exclude_files_from_build

    Yoyo Lee said:
    Based on your response, if I have two folders(Alfa and Beta) inside my RTSC project directory. Alfa contains main.c and Belta contains library that Alfa will use.  Alfa should build first following alphabetical order.  Even so Alfa need function definition from Belta and Belta has not been build yet, but it's not a issue since Link Order should take care of it.   Do I understand correct?

    That is correct. Libraries get passed to the linker in the link step and that is when symbols need to get resolved. If you observe the project build steps in the build console, you will notice that the XDCtools run first, then the compiler (to compile all C/C++ source files) and then the linker (to link together object files and libraries).

    If you are interested, more details on the CCS build process is available here: 
    http://processors.wiki.ti.com/index.php/Projects_and_Build_Handbook_for_CCS#Project_Files_and_Build_System_Overview