This article shows how you can reference CCS build variables within symbol definitions in C source code and within project options.
This can be useful when you want to
- define a variable in the source code and place it at a specific location in memory (generally useful for specifying version numbers, code revisions, etc) and
- have the CCS build use that variable/string as part of the output file name
## Write your C code
Here is an example C code that places variables nv_data (float) and nv1_data (string) into specific memory locations using #pragma DATA_SECTION. This is just a template meant to be used as a reference.
Refer to the [Compiler Users Guide](https://www.ti.com/tool/TI-CGT#technicaldocuments) if you are not familiar with the pragma.
**Note:** the syntax for the string macro is a bit different (a reference on that is available [here](https://gcc.gnu.org/onlinedocs/gcc-4.8.5/cpp/Stringification.html)).
#define xstr(s) str(s)
#define str(s) #s
#pragma DATA_SECTION(nv_data, ".infoD")
#pragma RETAIN(nv_data)
const float nv_data[] = {MYVERSION};
#pragma DATA_SECTION(nv1_data, ".infoC")
#pragma RETAIN(nv1_data)
const char nv1_data[] = {xstr(MYVERSION_STRING)};
## Create CCS build variables
Go to **Project Properties->Build->Variables** tab and click on **Add** to create build variables with the desired values.

## Define compiler symbols that reference the variables
Go to **Project properties->Compiler->Predefined Symbols**, and define the the symbols used in the C code under the --define option. The syntax to reference a build variable VAR is ${VAR}.

## Reference the variable in build options
To reference the variable in build options, for example, the output file name, go to **Project Properties->Linker->Basic Options** and specify the output file name as shown below.
