Actions

EmSys

Difference between revisions of "Create a variable at workspace level"

From EdWiki

m
m
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== To create a variable at workspace level in CCS 6.1.x: ==
+
== Create a variable at workspace level in CCS 6.1.x and above ==
* Go to menu Window->Preferences->Code Composer Studio->Build->Variables
+
 
 +
Path and Build Variables can be set at the project level or workspace level.
 +
 
 +
If set at the workspace level, they will apply to all projects contained in that workspace. So they only have to be set once at the workspace level. This is advantageous for projects checked into source control and to avoid constant checkouts for modifications of the project.
 +
 
 +
If set at the project level, they will apply only to that specific project.
 +
 
 +
'''In CCSv5''', Path variables and Build variables had to be set independently in two different places.
 +
 
 +
'''In CCSv6.0.x''', setting a Path variable will automatically set it as a Build variable as well.
 +
 
 +
'''In CCSv6.1.x''', the interface is further improved such that the variable can be set in one place at the workspace level and it will automatically be propagated as both Path variable and Build variable for all projects in the workspace.
 +
 
 +
► Create a variable at workspace level
 +
 
 +
* Go to the main menu '''Window Preferences Code Composer Studio Build Variables'''
 
* Here you can view, add or edit variables for the workspace
 
* Here you can view, add or edit variables for the workspace
 
* Use the "Add" button to create a new variable
 
* Use the "Add" button to create a new variable
This screenshot shows an example of setting a new variable called TIVAWARE_LOC.
+
This screen shot shows an example of setting a new variable called TIVAWARE_LOC.
  
 
[[image:ccs6_add_build_variable.png|center|Add Build Variable]]
 
[[image:ccs6_add_build_variable.png|center|Add Build Variable]]
 +
 +
[[image:ccs6_build_variable.png|center|Add Build Variable]]
  
 
Once this variable is created, all projects in that workspace will have that variable set as both a Path variable and a Build variable.
 
Once this variable is created, all projects in that workspace will have that variable set as both a Path variable and a Build variable.
Line 12: Line 29:
  
 
* Select any one of the projects in the workspace
 
* Select any one of the projects in the workspace
* Right-click and go to Properties->Resource->Linked Resources
+
* Right-click and go to '''Properties Resource Linked Resources'''
 
* Observe that the variable we set earlier is shown here
 
* Observe that the variable we set earlier is shown here
 +
<br />
 
[[image:ccs6_linked_resources.png|center|Path Variables]]
 
[[image:ccs6_linked_resources.png|center|Path Variables]]
* Right-click and go to Properties->Build->Variables tab, and check the box to "Show system variables"
+
<br />
 +
* Right-click and go to Properties Build Variables tab, and check the box to "Show system variables"
 +
 
 
* Observe that the variable we set earlier is shown here as well
 
* Observe that the variable we set earlier is shown here as well
 +
<br />
 
[[image:cc6_view_build_variables.png|center|View Build Variables]]
 
[[image:cc6_view_build_variables.png|center|View Build Variables]]
 +
<br />
 +
So in summary, if you create a variable at Window → Preferences → Cde Composer Studio → Build → Variables, the variable can be used both when linking source files as well as when specifying paths in compiler/linker options.
  
So in summary, if you create a variable at Window->Preferences->Code Composer Studio->Build->Variables, the variable can be used both when linking source files as well as when specifying paths in compiler/linker options.
+
However, if you create a Build variable at workspace level (from menu Window Preferences → C/C++ → Build → Build Variables) or project level (Properties → Build Variables tab), it cannot be used as a path variable when linking source files. So the more convenient method would be to create variables from the Window → Preferences menu.
  
However, if you create a Build variable at workspace level (from menu Window->Preferences->C/C++->Build->Build Variables) or project level (Properties->Build->Variables tab), it cannot be used as a path variable when linking source files. So the more convenient method would be to create variables from the Window->Preferences menu.
+
<!--
 +
[[File:prev.gif|left|link=EmSys:CCS Build Load Run]]
 +
[[File:home.gif|center|link=EmSys:TM4C123G LaunchPad - Code Composer Studio]]
 +
-->

Latest revision as of 05:06, 4 March 2020

Create a variable at workspace level in CCS 6.1.x and above

Path and Build Variables can be set at the project level or workspace level.

If set at the workspace level, they will apply to all projects contained in that workspace. So they only have to be set once at the workspace level. This is advantageous for projects checked into source control and to avoid constant checkouts for modifications of the project.

If set at the project level, they will apply only to that specific project.

In CCSv5, Path variables and Build variables had to be set independently in two different places.

In CCSv6.0.x, setting a Path variable will automatically set it as a Build variable as well.

In CCSv6.1.x, the interface is further improved such that the variable can be set in one place at the workspace level and it will automatically be propagated as both Path variable and Build variable for all projects in the workspace.

► Create a variable at workspace level

  • Go to the main menu Window → Preferences → Code Composer Studio → Build → Variables
  • Here you can view, add or edit variables for the workspace
  • Use the "Add" button to create a new variable

This screen shot shows an example of setting a new variable called TIVAWARE_LOC.

Add Build Variable
Add Build Variable

Once this variable is created, all projects in that workspace will have that variable set as both a Path variable and a Build variable.

To confirm the variable is set:

  • Select any one of the projects in the workspace
  • Right-click and go to Properties → Resource → Linked Resources
  • Observe that the variable we set earlier is shown here


Path Variables


  • Right-click and go to Properties → Build → Variables tab, and check the box to "Show system variables"
  • Observe that the variable we set earlier is shown here as well


View Build Variables


So in summary, if you create a variable at Window → Preferences → Cde Composer Studio → Build → Variables, the variable can be used both when linking source files as well as when specifying paths in compiler/linker options.

However, if you create a Build variable at workspace level (from menu Window → Preferences → C/C++ → Build → Build Variables) or project level (Properties → Build → Variables tab), it cannot be used as a path variable when linking source files. So the more convenient method would be to create variables from the Window → Preferences menu.