cancel
Showing results for 
Search instead for 
Did you mean: 

How to show text (on the display) depending on the build configuration in CubeIDE (compiler switch)?

Math
Associate

I would like to show some texts on the display when running the "debug" build configuration, but not when code is compiled for the "release".

How to?

TouchGFX (4.23.1) generates the code and STM32CubeIDE (1.14.1) builds and flashes the project.

1 ACCEPTED SOLUTION

Accepted Solutions
hellohello
ST Employee

Hello,

 

Basically, whenever you have a touchgfx_printf("Whatever"); that you want to only show when debugging, you have to wrap it in the define like this :

#ifdef DEBUG
    touchgfx_printf("Whatever");
#endif

 

Regards, 

View solution in original post

3 REPLIES 3
Karl Yamashita
Lead II

Check for the Preprocessor DEBUG symbol

 

#ifdef DEBUG
	// write to display
#endif

 

Math
Associate

Ok, thanks, perhaps I've to learn a bit more about the concept.

That means I've to do that in my own .c files an cannot do it directly inside the touchGFX designer?

hellohello
ST Employee

Hello,

 

Basically, whenever you have a touchgfx_printf("Whatever"); that you want to only show when debugging, you have to wrap it in the define like this :

#ifdef DEBUG
    touchgfx_printf("Whatever");
#endif

 

Regards,