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
Parents
  • Hello Torbjørn,

    I see what part of the issue might be. I am able to see all the printk statements (as well as log statements I believe) using the Segger RTT Client program. But they are not showing consistently in either the NRF Terminal window within Visual Studio, or the Terminal window within the Ozone debugger. I was occasionally able to see some statements, then nothing. Resetting the processor within the debugger doesn't help, nor does exiting and re-downloading the image. It appears to be very random when it works in those terminal windows, which is rarely.

    Thanks,

    Pam

  • Hi Pam

    I must admit I don't have a lot of experience using the RTT interface in the nRF Terminal or Ozone, but I was able to get it working without obvious issues. 

    I made a small modification to one of the Bluetooth examples to print to the RTT log every second, and can see it appear consistently. 

    Which operating system and version are you running on your PC? 

    Do you know which version of the JLink DLL you are using? 

    Best regards
    Torbjørn

  • 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.

Reply Children
No Data
Related