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

SEGGER_RTT_CONFIG_DEFAULT_MODE blocking app

If SEGGER_RTT_CONFIG_DEFAULT_MODE is "BLOCK", the program won't start without RTT attached - at least for me... is there a possible solution? I mean, technically it makes sense, because the buffer is never flushed without RTT Logger attached, but as we require the blocking logging in the current stage of the project for debugging purposes, we would have to maintain two different firmware versions to use with and without RTT logger attached

Parents
  • found a possible workaround: nrf SDK actually checks if the RTT is attached by a watchdog timer in nrf_log_backend_rtt.c BUT you'll have a race condition if you're doing something like me: LOG_INIT(NULL); NRF_LOG_DEFAULT_BACKENDS_INIT(); NRF_LOG_INFO("%s", versionbuffer); NRF_LOG_FLUSH();

    in this case, the watchdog would only handle 1 message (but expects 10) so the NRF_LOG_FLUSH will block. I simply added 10 empty NRF_LOG_INFO messages before the first flush and it seems to work

Reply
  • found a possible workaround: nrf SDK actually checks if the RTT is attached by a watchdog timer in nrf_log_backend_rtt.c BUT you'll have a race condition if you're doing something like me: LOG_INIT(NULL); NRF_LOG_DEFAULT_BACKENDS_INIT(); NRF_LOG_INFO("%s", versionbuffer); NRF_LOG_FLUSH();

    in this case, the watchdog would only handle 1 message (but expects 10) so the NRF_LOG_FLUSH will block. I simply added 10 empty NRF_LOG_INFO messages before the first flush and it seems to work

Children
No Data
Related