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.

Debugging skips over macros

Other Parts Discussed in Thread: CC2650

Hey! I have a quick question about the Code Composer Studio debugger. I am porting older code from an older processor to the Simplelink CC2650 ble processor. But first, here's my CCS information: 

Code Composer Studio Version: 6.1.3.00034

CC26xx Version 1.20.0.02

TI-RTOS for CC13XX and CC26XX (IDE Client) version 2.20.0.06 

TI-RTOS for CC13XX and CC26XX (Target Content) version 2.20.0.06 

I'm not sure how to get information on the debugger, but my guess is that should be included with the Code Composer Studio version.

I have been attempting to create a conditional assert macro that is different from the driverlib assert included with cc26xxware. I have been able to call the macro correctly and I can build/run the code, however I cannot debug the macros. Every time I go to step into/over several calls to the code stuck in by the macro, code composer studio skips over this entire block. (listed next) Here is my test scenario.

	MY_ASSERT(2 < 7);
	MY_ASSERT(1 == 1);
	MY_ASSERT(OTHER_MACRO_TEST == 200);

My macro's are defined somewhere else, and they aren't really important because I can show you the preprocessor output (generated by checking "preprocess only under Parser Preprocessing Options in project properties; maintain comments (--preproc_with_comment, -ppc)). The .pp file generates this below for that section of code:

	if (2 < 7) { ; } else { while(1){;}; };
	if (1 == 1) { ; } else { while(1){;}; };
	if ((200) == 200) { ; } else { while(1){;}; };

I added the extra semicolons to see if there might be a syntax error somewhere - they shouldn't hurt anything. The first conditional assert should catch the processor infinity, however this whole block is skipped over by the debugger and execution is continued, even without single stepping. Does Code Composer Studio have conditional assert functionality (the preprocessor seems to indicate that things work correctly). Do I need to include some kind of math library to make this conditional work? Is this an issue with the debugger? Am I just being stupid?

Thanks! Let me know if there is any other information I can provide.

  • EDIT: While it began as (2 > 7) ((DUH *facepalm*)), it must have been changed in subsequent trial and error. Switching this back got the desired result of being stuck in a while-loop. However, I still cannot single step through macros. Is this just because CCS does not entirely know what code will be there before compile-time?
  • code2e said:
    However, I still cannot single step through macros.

    The pre-processed code shown has conditional tests which use a constant expression. The compiler is probably removing the code generated from the pre-processed macros, since the resulting code has no side-effects on the program execution and can therefore be eliminated.

  • Is it true that the ti compiler removes the unnecessary code from the macros? This sounds an awful lot like an explanation.