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

logging "deferred" crashes but "in place" works

I've taken the basic examples/peripheral/blinky code and tried to add the logging module to it. For some reason the only time I can get the application to run and log correctly is when I use "in-place" logging. When trying to use 'deferred' logging, the first log line will be printed out and then the application seems to hang/stop running.

I've ensured to enable NRF_LOG_DEFERRED in the sdk_config.h. I'm also calling NRF_LOG_PROCESS() (also tried NRF_LOG_FLUSH()) after logging but still no luck.

I've attached my main.c and sdk_config.h. When "deferred" logging is enabled, only the first line is printed "Starting application". After that the application hangs (no more prints, no more LED toggling).

/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-eaf67782a6e8423a872977aba769132b/sdk_5F00_config.h/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-eaf67782a6e8423a872977aba769132b/main.c

Any idea why this could be happening? I've tried defining DEBUG to get more information but am not seeing anything (no crashes, errors, etc.) only the application hanging.

Parents
  • Hi,

    I don't see anything in the code you wrote. The main thing when using deferred logging is to remember to call NRF_LOG_PROCESS() or NRF_LOG_FLUSH() to process the log buffers which you have already done. Are you using Segger embedded studio? In that case, do you use the default flash_placement.xml configuration and is the INITIALIZE_USER_SECTIONS flag still defined in your project settings. 

    Blinky example from SDK 16 with logging over RTT:

    blinky_logging.zip

  • Hi,

    Thanks for your reply. I found a fix for this but I don't really understand it. I found a solution here for another problem I was debugging, by modifying the linker script blinky_gcc_nrf52.ld to change the RAM ORIGIN address from 0x20000000 to 0x20000010. Once doing this the deferred logging works as expected. My MEMORY section of linker script looks like this now:

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xce000
      RAM (rwx) :  ORIGIN = 0x20000010, LENGTH = 0x3FFF0
    }

    For more context I am using this board: https://www.adafruit.com/product/4062 which specifies this memory map.

    I'm not understanding where the MBR comes into play here and how making this change in the linker script fixed my problem. Could you please provide some insight in this?

    Thank you!

    btw the exact example I'm using is the pca10056/armgcc blinky example from the 16.0 nRF52 SDK and added the logging module to enable logging over UART. I'm just using a text editor and the 'arm-non-eabi-gcc' command line compiler.

Reply
  • Hi,

    Thanks for your reply. I found a fix for this but I don't really understand it. I found a solution here for another problem I was debugging, by modifying the linker script blinky_gcc_nrf52.ld to change the RAM ORIGIN address from 0x20000000 to 0x20000010. Once doing this the deferred logging works as expected. My MEMORY section of linker script looks like this now:

    MEMORY
    {
      FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xce000
      RAM (rwx) :  ORIGIN = 0x20000010, LENGTH = 0x3FFF0
    }

    For more context I am using this board: https://www.adafruit.com/product/4062 which specifies this memory map.

    I'm not understanding where the MBR comes into play here and how making this change in the linker script fixed my problem. Could you please provide some insight in this?

    Thank you!

    btw the exact example I'm using is the pca10056/armgcc blinky example from the 16.0 nRF52 SDK and added the logging module to enable logging over UART. I'm just using a text editor and the 'arm-non-eabi-gcc' command line compiler.

Children
Related