printk via RTT will not work, but printf does

Hello there,

I have looked through all of the various other related questions, but still cannot resolve this issue. I am trying to use RTT versus a UART for the console. I have confirmed that the printf operation works, but not printk. I have looked at all the various configuration settings and stepped through the code, and the call branches to "log_printk" versus "vprintk". 

I have the following config statements defined in the project file:

CONFIG_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_PRINTK=y
CONFIG_LOG_PRINTK=n

However in the output config file, the parameter CONFIG_LOG_PRINTK is always set as "y". Can you tell me why I cannot change this printk log parameter, it appears that this is stopping me from using printk to the RTT console.
Thanks,
Pam
  • Hi Torbjørn,

    It seems like the whole behavior is inconsistent. I'm sure part of it is due to me learning the IDE and SDK design, but it also seems to be due to the nature of the configuration control and generation. I am using the latest Windows 11 Pro, and the Segger JLink version 7.58b.

    For example, I changed a bunch of settings in the Kconfig Actions menu, but then when I do a pristine build they are reset back to their original settings. I even try to over-ride some of these settings within the prj.conf file and it doesn't effect the outcome for some of the settings. As a firmware developer with over 30 years of experience, this approach is way too complicated and very difficult to use. I find it is hard to get anything done with this system, any way I can get this mess to work with IAR tools?

    I am currently playing around with trying to get optimization setting changed, but it won't "stick", any suggestions on how to get these config settings to work correctly would be greatly appreciated.

    Thanks,

    Pam

  • Hi Pam

    Pamela Keiles said:
    For example, I changed a bunch of settings in the Kconfig Actions menu, but then when I do a pristine build they are reset back to their original settings. I even try to over-ride some of these settings within the prj.conf file and it doesn't effect the outcome for some of the settings

    Could you try to use the "Save to file" option in the Kconfig configurator rather than the "Save" option? 

    Then the changes you make should be stored in the prj.conf file, which means they will be added permanently to the project configuration, and will remain even if you do a pristine build. The other advantage is that you see immediately how the changes in the GUI get represented in the config file. 

    Pamela Keiles said:
    I find it is hard to get anything done with this system, any way I can get this mess to work with IAR tools?

    The nRF Connect SDK is not supported in IAR unfortunately. It does work with Segger Embedded Studio, which provides a more IAR like experience, but the main focus going forward is the VSCode integration and that is what we recommend. 

    Pamela Keiles said:
    I am currently playing around with trying to get optimization setting changed, but it won't "stick", any suggestions on how to get these config settings to work correctly would be greatly appreciated.

    Which option have you set? Could you try the 'Save to file' option like I mentioned earlier?

    As a general tip to help you get started with the nRF Connect SDK and the associated tools I would recommend going through the nRF Connect SDK tutorial series, and the newly released nRF Connect SDK Fundamentals course on the Nordic Academy. 

    Best regards
    Torbjørn

  • Hi Torbjørn,

    Yes I've gone through all the tutorials and videos, unfortunately they don't help with some of the details for working with all these config items. I will check them again though to be sure, unless you have a specific one to recommend on this subject.

    As for using the "Save to file" option, I didn't see a difference in the zephyr .config file outcome. I just get an error message in the lower corner of Visual Studio stating "No changes to save". So I have no idea where the changes are being saved when I use this editor and why they are not "sticking". Currently I am just trying to change the "thread awareness support" under "Debugging Options", I was trying to get the CONFIG_THREAD_MONITOR define to not be grayed out so I could turn it off, I'm guessing these 2 options are related?

    Thanks and regards,

    Pam

  • Also, I'm thinking the issue with the RTT as the console output might be because I am using the NRF52DK development board and the CONFIG_UART_CONSOLE is set to "y" in the default board configuration file. I just need to over-ride that since I am using the UART on that board another way.

  • I think I have the RTT working now, but only with the Segger RTT Client program. Using the NRF Terminal within Visual Studio doesn't work, but that's okay. It seems like using the Kconfig menu is not a good option most of the time since any changes are erased when a pristine build occurs. In any case, for the moment I have created a custom board for our application and am using the dev board config files as reference. I will submit another case if I have any more issues or questions.

    Thanks for all your help and regards,

    Pam

Related