Skip to main content
Associate
Solved

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

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.

    This topic has been closed for replies.
    hellohelloBest answer
    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, 

    3 replies

    Karl Yamashita
    Super User

    Check for the Preprocessor DEBUG symbol

     

    #ifdef DEBUG
    	// write to display
    #endif

     

    If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
    MathAuthor
    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?

    hellohelloBest answer
    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,