Skip to main content
Associate
June 10, 2024
Solved

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

  • June 10, 2024
  • 3 replies
  • 1161 views

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.
    Best answer by hellohello

    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
    Principal
    June 10, 2024

    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
    June 11, 2024

    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
    June 11, 2024

    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,