This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Logging

Hi all,

I'm a little blown away by the complexity of logging for this application (its highly likely I'm missing a few key elements to my understanding).

I'm under the impression that by default, the device logs to LTE Link Monitor. I can't seem to get that to happen whatsoever, although my modem is offline if that is important. Furthermore, I've tried following some resources regarding RTT logging with Segger, but to no avail. It seems that whenever I run my project through segger ( Build > Build & Debug), I run into `Unknown function at 0xFFFFFFFE`. I've tried disabling all of the VBM exceptions. If I instead run (Build > Build & Run), I get no output at all from anything, and I'm unable to connect the RTT terminal using the window on the right.

For some samples, my code:

#include <zephyr.h>
#include <logging/log.h>

LOG_MODULE_REGISTER(main);

void main(void)
{
	while (1) {
            LOG_INF("looped loginf");
            k_sleep(K_MSEC(150));
	}
}



My prj.conf

CONFIG_SERIAL=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_MAIN_STACK_SIZE=4096

CONFIG_STDOUT_CONSOLE=y

#CONFIG_GPIO=y

#debug
CONFIG_DEBUG=y
CONFIG_LOG=y

# Segger RTT
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n

Is there a comprehensive guide I can follow somewhere to just connect printk to RTT and get logging working?

Overall, I'm trying to upskill and familiarize myself with one of our contractor's work, and logging + trial and error goes a huge way for me in understanding whats going on Slight smile

Thanks in advance, team.

  • Hi,

     

    Which board are you configuring your project for? I used nrf9160dk_nrf9160ns for my test.

     

    Nevera said:
    I'm pretty sure I'm entirely missing a whole bunch of stuff in here. I'm not sure where this merged.hex file comes from, or what I'm supposed to do in "Target -> Download File". The prompt opened is expecting me to give it a hex file, but I have no idea where from.

     When building for the non-secure region (nrf9160dk_nrf9160ns), you will trigger a multi-image build, as the secure region will be populated with the "spm" (secure partition manager), and non-secure with your actual example.

    Its important that you configure your project to be non-secure if you're communicating with the modem, as it can only work in non-secure mode.

    Once you have build your project, in case its a multi-build, a merged.hex is available in my-build-folder/zephyr/merged.hex. This will then include all images in the multi-image build (if used) 

     

    Nevera said:
    I followed a bunch of guides a while back, and I have no idea what I've removed/added/changed.

     In your project, there a build folder, typically named "build_whateverboardname". Try deleting this folder, and re-importing your project in SES NordicEdition, to ensure you're starting from scratch.

     

    Kind regards,

    Håkon

  • It seems that reimporting my project created a new Project in Segger called "Project zephyr/merged.hex". Now everything runs flawlessly. It appears that you were right, and that was the issue Slight smile
    Thanks!

Related