Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Debugging two custom images in one debug session

I have two custom images that I flash to my chip (nRF52832, SDK v16.0.0, SEGGER Embedded Studio).  Application 1 is located at 0x26000 Application 2 is located at 0x45000.  Application 1 always runs at start up and depending on certain conditions, it will jump to Application 2.

Both application images are generated from the same SES project.  I have two build configurations and each build configuration has its own set of preprocessor definitions that will affect what gets compiled into the applications.  As a side note, I'm using FreeRTOS and have "print" task whose sole responsibility is to print debug messages which show up in the Debug Terminal, I believe this is the JLink RTT output?  I am not using the nRF logging module.  

I modified my build configurations to load the other application to the chip when I start a debugging session.  So if my active project is set to Application 1, when I start debugging it also loads the SoftDevice and Application 2.  When Application 2 is set to active project and start debugging is also loads SoftDevice and Application 1.

Depending on what build configuration is set as active, I only see the print statements in the Debug Terminal for that application despite the fact I can debug/hit breakpoints for both applications.

What do I have to do differently so I can see the printf output from both applications?  

  • This is a custom board that has nothing connected to it other than a JLink Base unit.  Whatever is getting printed to a terminal is through the means of the SWIO pin connected to the JLink unit.

    To be clear, the linked library has 0 dependency on nRF5 SDK/SoftDevice.  It is a native C library that is compiled in SES (using gcc).  It's just calling "printf", it is not calling any sort of NRF_LOG or anything of the sort because it has no idea nRF platform exists.

    The linked library is also not hitting a hardfault because the second I connect my JLink unit when the application is hanging, the chip spits out whatever data is in the buffer used for printf, presumably because the JLink CLK pin clocks that data out, and then the application continues to run from where it left off--it doesn't reset, it isn't stuck in hardfault handler, it resumes.

    If I find some time I'll recreate the projects so you can replicate it on your end.

  • I think what you are seeing is the SES feature. There are settings in the SES where you can set the Debugger to steal the RTT logs and display them to the SES debug terminal instead of any other terminal. I do no think this is related to your solution but the way the SES and RTT viewer are trying to get a lock on the prints.

    kcl74 said:
    If I find some time I'll recreate the projects so you can replicate it on your end.

    Yes please do that, it will be helpful for me to understand more on this issue.

Related