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.

Portable projects / command line build - environment variables details

Other Parts Discussed in Thread: CCSTUDIO

 

I am running CCVS 4,1,3

I am building several projects in a single workspace, sharing includes files and header files.

I have read the portable projects documents and command line documents, and have a somewhat workable system, but I still have a couple questions:

I have created "linked resource" variables and used these to specify the location of source files.

However, these variables do NOT seem to work when specifying include directories. 

Is this correct?

Are linked resource variables related to Windows Environment variables?

To have portable includes directories, I created "Managed Build" variables and used these to specify the location of includes directories.

NOTE:  I use the exact same names for the Managed Build variables I used for the linked resource variables.

Does this make sense?

Are Managed Build Variables related to Windows Environment variables?

How are managed Build variables related to linked resource variables?

With this scheme I can use the CCS command line interface to create a new workspace and use the -ccs.definePathVariable option to specify the location of linked resource variables (which also are managed build variables).  Both sets of variables seem to get set!

This command line operation seems to works fine with version 4.1.3, but not with version 4.1.0. 

Is there a difference between these two CCS versions on how they handle comand line parameters?

Are there command line options for explicitely setting "Linked resource" and Managed Build" variables?

  • Larry Harmon said:

    I have created "linked resource" variables and used these to specify the location of source files.

    However, these variables do NOT seem to work when specifying include directories. 

    Is this correct?

    Yes, you should use managed build variables / macros instead

    Larry Harmon said:
    Are linked resource variables related to Windows Environment variables?

    No, they are separate and primarily used for linked files

    Larry Harmon said:

    NOTE:  I use the exact same names for the Managed Build variables I used for the linked resource variables.

    Does this make sense?

    I think it is ok but I would avoid doing that to avoid confusion

    Larry Harmon said:
    Are Managed Build Variables related to Windows Environment variables?

    You can reference windows environment variables like you would a managed build variable. And any managed build variable would override a windows environment variable in CCS

    Larry Harmon said:
    How are managed Build variables related to linked resource variables?

    They are separate. Linked resource variables are primarily used for specifying a path so a variable can be used by the project instead of a full path.

    See slide 18 of: http://processors.wiki.ti.com/images/0/09/CCSv4_Tips_%26_Tricks.pdf

    Larry Harmon said:
    Is there a difference between these two CCS versions on how they handle comand line parameters?

    It is quite possible that an enhancement was added by 4.1.3. There have been a lot of changes made between those two versions.

    Larry Harmon said:
    Are there command line options for explicitely setting "Linked resource" and Managed Build" variables?

    No

    Note that I like to specify variables on a per project basis than globally ("Managed Build").:

    Slide 23 and 24: http://processors.wiki.ti.com/images/0/09/CCSv4_Tips_%26_Tricks.pdf

     

  • A followup question:  How does the macros.ini file play into all this this?

     

  • Larry Harmon said:

    A followup question:  How does the macros.ini file play into all this this?

    Basically it is used to auto add a linked resource variable when importing an existing CCSv4 project. For example, say you have a project with linked resources and you want to give it to someone else. So you make it portable by using linked resource variables to avoid absolute paths in the project files. But the person you give this project to needs to have that linked resource variable in his environment, otherwise CCS can't resolve the paths to the linked resources. So before you hand the project off, you can create a macros.ini file that defines the variable and stick the file in the root of your project. Then when the other person imports the project into his/her workspace, CCS will see that there is a macros.ini file and automatically add any definitions in there to that person's linked resource variables list (instead of the person doing it manually)

  • I work with Larry Harmon and I have additional question on macros.ini file.  Two of the six projects has macros.ini file.The macros.ini file defines the linked resource variable SW_ROOT for both of this project.

    The content of macros.ini file for both this project is.

    SW_ROOT = ../..

     I have created "linked resource" variables

    set  SW_ROOT=C:\EnhancedAlarmDBDBoard\harmonl_EALARM.P1.0.0\EALARM_SRC\Src\Src

    but when I try to build the two project that has macros.ini file it seems that the "linked resource" variables created is not used, instead the "linked resource" variables is taken from macros.ini file and the build fails, since it is not able to find the source file needed which are pointed by SW_ROOT.

    Q. Does the "linked resource" defined in macros.ini file has higher president than the "linked resource" variables created in the script file? It appears to me that the SW_ROOT "linked resources" used for pointing the source file defined in the script file has lower priority than the "linked resource" path specified in macros.ini file. It fails to find the source file when I run the script to build the project.

    Q. Can you confirm that this is the case?

    Larry is using CCS version 4.1.3 and I am using CCS version 4.1.0. I have his workspace and his script file with minor changes to point to my path in a script. In his case it works.

    Q. Could this be differnce between the CCS version 4.1.3 and CCS version 4.1.0.

    Thanks for your assistance in this.

    Al Modi

  • Ashok Modi said:

     I have created "linked resource" variables

    set  SW_ROOT=C:\EnhancedAlarmDBDBoard\harmonl_EALARM.P1.0.0\EALARM_SRC\Src\Src

    How did you specify this variable? Because it sounds like you set an environment variable instead since you are using the 'set' keyword.

    Ashok Modi said:
    but when I try to build the two project that has macros.ini file it seems that the "linked resource" variables created is not used, instead the "linked resource" variables is taken from macros.ini file and the build fails, since it is not able to find the source file needed which are pointed by SW_ROOT.

    Look at your list of Linked Resources variables in CCSv4 and look for SW_ROOT. Is it set correctly?

    Ashok Modi said:
    Larry is using CCS version 4.1.3 and I am using CCS version 4.1.0. I have his workspace and his script file with minor changes to point to my path in a script. In his case it works.

    First off, what "script" are you referring to? Are you talking about a batch file that calls the headless project commands?

    Ashok Modi said:
    Q. Could this be differnce between the CCS version 4.1.3 and CCS version 4.1.0.

    As I mentioned before, it can certainly be the case. Many enhancements have been added since 4.1.3. hence it is always recommended to be on the latest version.

  • How did you specify this variable? Because it sounds like you set an environment variable instead since you are using the 'set' keyword.

    The script file I refer to is the .cmd file that sets the SW_ROOT using the set key word. .

    Same script file first imports the project and than builds it the project import seems to be working correctly. The build for two project fails is as follows.

    REM build projects -----------------------------------------------------------------


    %CCS_CMD% -data %CCS_WORK% -application com.ti.ccstudio.apps.projectBuild -ccs.projects driverlib -ccs.configuration Release
    %CCS_CMD% -data %CCS_WORK% -application com.ti.ccstudio.apps.projectBuild -ccs.projects usblib -ccs.configuration Release

    In order for me to over right SW_ROOT should I change the above two build line as follows?

    %CCS_CMD% -data %CCS_WORK% -application com.ti.ccstudio.apps.projectBuild -ccs.projects driverlib -ccs.configuration Release -ccs.definePathVariable SW_ROOT C:\EnhancedAlarmDBDBoard/harmonl_EALARM.P1.0.0/EALARM_SRC/Src/Src
    %CCS_CMD% -data %CCS_WORK% -application com.ti.ccstudio.apps.projectBuild -ccs.projects usblib -ccs.configuration Release -ccs.definePathVariable SW_ROOT C:\EnhancedAlarmDBDBoard/harmonl_EALARM.P1.0.0/EALARM_SRC/Src/Src.

    Q. Is this what I need to do?

    Thanks.

    Al Modi

  • Where did you see -ccs.definePathVariable as a valid option for project build?

  • Ashok Modi said:
    The script file I refer to is the .cmd file that sets the SW_ROOT using the set key word. .

    You are setting an environment variable. This is different that setting a linked resource variable. Set your linked resource variable from here:

    http://processors.wiki.ti.com/index.php/Portable_Projects#Linking_Files

     

  • Hello Ki-Soo,

    Where did you see -ccs.definePathVariable as a valid option for project build?

    My mistake you are right this option is not supported for project build, but this option is valid for Create a Project, Create Standard Make Project and Import a CCSv4 Project. Am I right on this?

    In order to over write the SW_ROOT linked resource in macros.ini file, I need to use -ccs.definePathVariable SW_ROOT C:\EnhancedAlarmDBDBoard/harmonl_EALARM.P1.0.0/EALARM_SRC/Src/Src when I create a workspace and than import porject into work space.  I beleive in my script file I need to do following to over write the SW_ROOT  "link resource" defined in macros.ini file. See below the portion of the content of the script file..

    set CCS_CMD=jre\bin\java -jar startup.jar

    REM Create workspace and import projects ------------------------------------------

    %CCS_CMD% -data %CCS_WORK% -application com.ti.ccstudio.apps.projectImport -ccs.location "C:\EnhancedAlarmDBDBoard\harmonl_EALARM.P1.0.0\EALARM_SRC\Src\Src\Alpha" -ccs.copyIntoWorkspace -ccs.definePathVariable MODULE_ARM9_VIEW_ROOT C:\EnhancedAlarmDBDBoard\harmonl_EALARM.P1.0.0\MODULE\ARM9CMNSdk\Inc -ccs.definePathVariable EALARM_VIEW_ROOT C:\EnhancedAlarmDBDBoard/harmonl_EALARM.P1.0.0/EALARM_SRC/Src/Src -ccs.definePathVariable VIEW_ROOT C:\EnhancedAlarmDBDBoard/harmonl_EALARM.P1.0.0/EALARM_SRC/Src/Src -ccs.definePathVariable SW_ROOT C:\EnhancedAlarmDBDBoard/harmonl_EALARM.P1.0.0/EALARM_SRC/Src/Src

    Q.1 defining the -ccs.definePathVariable SW_ROOT C:\EnhancedAlarmDBDBoard/harmonl_EALARM.P1.0.0/EALARM_SRC/Src/Src when creating the work space and importing the project should allow me to over write the "link resourse" SW_ROOT defined in macros.ini file. Correct?

    I will try this.

    I am not very clear on your following statement. Please pardon my ignorance.

    "You are setting an environment variable. This is different that setting a linked resource variable. Set your linked resource variable from here".

    Q.2 Can you please explain how CCS uses the environment vartiable and linked resources?

    Thanks for all your support and help.

    With Best Regards,

    Al Modi

  • We are trying to setup CCS projects to build in any location and to build from an automated build system (build from command line)

    As I understand it our projects need linked resource variables to point to source files and mandged build variables to point to include file directories.

    I understand how to import a project and modify these variables with the CCS user interface.

    What I don't understand is how to set / override both types of  these variables from the command line so that our automated build system can build the code an any directory.

    My best guess is that I can override Linked Environment variables on the command line using the definePathVariable option when importing the project.

    And I think I can set an environment variable to specify managed build variables, again from a command line.

    True?

  • Larry, Ashok, 

    You should not have to modify linker resource macros in the GUI if your projects are setup correctly. The idea is that macros.ini defines how to setup linked resource. Macros.ini is then processed during project import to automatically configure them. It sounds like you are trying to re-use a macro that has been created for stellarisware. You may need to create your own. Also, the main requirement is that relative directory structure layout is preserved on different machines and your build machine. i.e. if you wanted to take a stellarisware as an example. You need to make a copy of entire stellarisware install to a different directory. Then when a stellarisware project is imported SW_ROOT is defined and source files are properly discovered. 

    Thus I would suggest that you first setup your projects in a way where you can make a copy, import it and build it with CCS through GUI without having to modify linked resources. After that your build machine will need to 

    import the project then build desired configurations. You should not need to re-define macros. I would also suggest that in your build.cmd file you use a temporary workspace which is deleted prior to importing/building projects. The actual build artifacts will stay in your projects directory, workspace will just contain CCS created data to store options. 

    In newer versions of CCS (definitely 4.1.3) linked resource variables defined in macros.ini can also be used in compiler options to specify include paths. This is a relatively new addition. 

    Martin