Part Number: F28M35H52C
Tool/software: TI C/C++ Compiler
Hi,
I know how to show expanded macro in C, for example in Visual Studio, using
#define STRINGIFY(s) XSTRINGIFY(s)
#define XSTRINGIFY(s) #s
#pragma message ("AVAIL_TIME =" STRINGIFY(AVAIL_TIME))
First question: what is an equivalent of #pragma message in CCS compiler for ARM?
Second question, I am interested in how to show a calculated value of a macro.
Precompiler definitely calculates macro values in order to do #if(a>b) statement (example works in Visual Studio):
#define STRINGIFY(s) XSTRINGIFY(s)
#define XSTRINGIFY(s) #s
#define ONE_BYTE_Tx_Time 11
#define NUM_OF_BYTES 16
#define BUSY_TIME 132
#define TOTAL_TIME 300
#define AVAIL_TIME (TOTAL_TIME-BUSY_TIME)
#define RESP_TIME (ONE_BYTE_Tx_Time * NUM_OF_BYTES)
#pragma message ("AVAIL_TIME =" STRINGIFY(AVAIL_TIME))
#pragma message ("RESP_TIME =" STRINGIFY(RESP_TIME))
#if (AVAIL_TIME <= RESP_TIME)
#error "not enough time"
#endif
The output during compilation is:
AVAIL_TIME =(300-132)
RESP_TIME =(11 * 16)
fatal error C1189: #error : "not enough time"
So, precompiler had calculated two integers, compared them and outputted an error.
The CCS can expand and evaluate value of macro by hovering mouse over the macro unfortunately only during debug.
My question is: is it possible to show actual RESULT of macro calculation during compilation?, i.e.
AVAIL_TIME = 168 // which is (300-132)
RESP_TIME = 176 // which is (11 * 16)
The formulas expansion can be rather complicated, so it is useful to see result during compilation, without loading (takes few minutes!) and running of the code:
AVAIL_TIME_in_SysTicks =(((75000000/1000000) * (1000000/2500)) - 2 * ((((75000000/1000000) * ((1000000000/900000) + 1)*(10 + 0x00000000/0x00000008) + 2)/1000) * 16))
Thanks, Igor