I'm using CCSv5. I want a conditional compilation in xxxx.cfg file such as #ifdef.
I tried to do so but I failed. Is there way to do it?
Thx in advance.
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.
I'm using CCSv5. I want a conditional compilation in xxxx.cfg file such as #ifdef.
I tried to do so but I failed. Is there way to do it?
Thx in advance.
CFG script are written in JavaScript (with some added functionality), so the only conditional statements are the ones available in JavaScript (if-else, etc.). What do you want to use as a condition for if-else statements?
When compiling my source code applying a pre-defined symbol such as --define=ENV1 or ENV2 in CCSv5 GUI, I'd like to apply ENV1 or ENV2 to xxx.cfg file simultaneously.
At this moment, I am using one variable (ENV1) and if-else statement at xxx.cfg file as the followings;
var ENV1 = 0;
if (ENV1) { platformInstance0.codeMemory = "CORE4_L2"; } else { platformInstance0.codeMemory = "CORE5_L2"; }
I should change two parts, pre-defined symbol in GUI and ENV1 variable in xxx.cfg for the conditional compilation, I hope to change one part only though.
Is there any efficient way to overcome this?
The CFG script cannot read defines from your C command line, however you can turn the logic around and define ENV1 in your config script, and then make it available as a #define for your C source.
You can add the following to your CFG script:
Program.global.ENV1 = 1;
and then in your C file you have to include <xdc/cfg/global.h>, which will make ENV1 visible. Here is more about Program.global: http://rtsc.eclipse.org/cdoc-tip/xdc/cfg/Program.html#global
I want to compile not sources that reference config values but config values that reference C source reversely.
I understand that, but there is no mechanism for config scripts to read #defines that you will pass to C sources.