What Kconfig (prj.conf) options should I use for enabling logging via RTT only (no UART).

Hi, I'm developing for a custom project board which only has the SWD pins exposed, which I'm using for (1) programming and (2) RTT logging during development.

Once the device goes into production, I intend to disable RTT logging (2). We have NO USE ANYWHERE AT ALL for UART or UART Async Drivers in our product.

Currently, this is what I have in my prj.conf. I have posted a screenshot (instead of a code block) so you can see the warnings (yellow swiggles) that VS Code is showing me.

 

I'm also getting the following build time warning:

My code is running as expected and RTT logs are working. But I'm a little confused on what some of these options are doing, because some of them seem similar to me (CONFIG_SERIAL vs CONFIG_CONSOLE for example), and couldn't understand much by looking them up on the Kconfig Search platform

Question: Can you please tell me if I'm setting these incorrectly or redundantly or what I should do to avoid this warning?

My requirements again: I only want logging via RTT during development and I want to turn them off during production (only logging API usedno printk statements anywhere).

My concerns: I don't want UART to be unintentionally turned on in development or in production, and have no need for the UART Async drivers or API.

Parents
  • Hi,

    It should be sufficient to set CONFIG_SERIAL to '=n'. This will disable the UART serial drivers. To ensure the UART drivers can't be enabled, you can disable the uart0 node in your device tree, either in your board file or with a board overlay.

    When the UART console is enabled, printk()/printf() input will be relayed over UART, provided that CONFIG_SERIAL is enabled. Similar to how the LOG_* macros work when logging over UART is enabled.

    &uart0 {
    	status = "disabled";
    };
    

    Best regards,

    Vidar

  • Hi Vidar, thanks for you time, and sorry for the delayed response. What about CONFIG_CONSOLE? Should I remove it ? I'm also a little shaky on whether to keep CONFIG_RTT_CONSOLE and CONFIG_LOG_BACKEND_RTT, or both?

Reply Children
Related