2025-03-30 2:39 PM
Is there a way to see how CubeIDE is expanding/pre-processing this code?
typedef struct {
int16_t x;
int16_t y;
int16_t z;
} TouchPoint;
#define TS_Point(_x, _y, _z) { .x = _x, .y = _y, .z = _z }
TouchPoint Touch_FT6236_GetPoint(uint8_t n) {
Touch_FT6236_ReadData();
if ((touches == 0) || (n > 1)) {
return ((TouchPoint)TS_Point(0, 0, 0));
} else {
return ((TouchPoint)TS_Point(touchX[n], touchY[n], 1));
}
}
Its compiling, but I'm getting weird values.
Solved! Go to Solution.
2025-03-31 2:33 AM - edited 2025-03-31 2:34 AM
@matt-crc wrote:Is there a way to see how CubeIDE is expanding/pre-processing this code?.
Note that CubeIDE itself does do the expanding/processing - it's done by the preprocessor during compilation.
But the option you require is here:
@matt-crc wrote:I'm getting weird values.
So what are you expecting to get?
And what do you actually get?
2025-03-30 11:01 PM
Best - according to my experience - use MENU Window->Show View->Include Browser
2025-03-31 2:33 AM - edited 2025-03-31 2:34 AM
@matt-crc wrote:Is there a way to see how CubeIDE is expanding/pre-processing this code?.
Note that CubeIDE itself does do the expanding/processing - it's done by the preprocessor during compilation.
But the option you require is here:
@matt-crc wrote:I'm getting weird values.
So what are you expecting to get?
And what do you actually get?
2025-03-31 2:36 AM
@mbarg.1 wrote:use MENU Window->Show View->Include Browser
That doesn't show preprocessor output - does it?
2025-03-31 4:22 AM
I originally tried that, but didn't find the pre-processor output.... Eventually, i figured out that the *.o object files contained the expanded C code. (not obvious)
I think that option only displays the include hierarchy.
2025-03-31 5:19 AM
@matt-crc wrote:I originally tried that, but didn't find the pre-processor output.... Eventually, i figured out that the *.o object files contained the expanded C code. (not obvious)
The standard command line tells the compile to call its output file .o
So, when the generated output is the preprocessor output, it goes into the .o file.
Indeed, it makes sense once you know - but it's not obvious before you've found out!
There's also the -save-temps option to do the compile and keep the preprocessor output:
https://gcc.gnu.org/onlinedocs/gcc/Developer-Options.html#index-save-temps
@matt-crc wrote:I think that option only displays the include hierarchy.
It also shows call/caller hierarchy
But, indeed, not preprocessor output.