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

Logging assert failures in freeRTOS

I am trying to use the NRF_LOG system with FreeRTOS.     In the case of an ASSERT, I want to be able to:

1) log the location of the assertion

2) flush the logs over RTT

3) reset

The issue I'm seeing is that adding a flush to the ASSERT macro causes the worst case stack usage of all tasks to increase dramatically.  Each stack now requires at lease 1000 bytes because the nrf_log_frontend needs ~300 bytes and nrf_log_backend_rtt_put requires ~700 bytes. 

What method is recommended for avoiding this excessive stack usage?

Is there a way to trigger log flushing from the logger_thread instead of the current thread?