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

Program getting stuck on NRF_BREAKPOINT_COND after getting into a template function

So I noticed the program goes into a state where it's stuck on  NRF_BREAKPOINT_COND, which happens after getting into the following writeToLogger() template function. If I comment this function call, it seems to work fine. 

   template<typename T>
    static void writeToLogger(T *data, ...)
    {
        char tmp[40] = {0};
        va_list args;
        va_start(args, data);
        vsprintf (tmp, data, args);
        xStreamBufferSend(nrfLogTaskMsgBuffer, (void*)&tmp, 40, pdFALSE);
    }
    
int main(void)
{
  NrfLogger logger;
  NrfLogger::writeToLogger<char>("Writing to register address %x", 10);
}

Parents Reply Children
  • I was able to compile your project when I comment out below extern linkage in your stream_buffer.h file

    //#if defined( __cplusplus )
    //extern "C" {
    //#endif

    But if i comment this out, then uncommenting writeToLogger calls does not get the functions in stream_buffer.h linked into the executable. 

    Not sure what I am missing here?

    But lets focus back on the actual assert you have.

    Can you give more details on the id and PC value of this assert that you should be able to see in the parameters. Maybe instead of spending our time and energy on me trying to be able to replicate it, we can change focus back to trying to debug the assert from your end itself. We can try to analyze the fault based on the parameters of app_error_fault_handler

  • Now, I'm seeing the following call stack, and the error only occurs after vTaskStartScheduler().



    What exact details do you need on the ID and PC value? I'm not quite sure why is unsigned int pc=0x00 even though PC register itself matches with the call address which isn't the same as the parameter


  • The app_error_fault_handler says that the error is 0x4002 which is an SDK related error. You should be able to get the filename and linenumber from the info variable when casted to assert_info_t.

    It most likely seems to be a manual ASSERT check in integration\nrfx\legacy\nrf_drv_clock.c: 274 (nRF5 SDK17.0.2)

        ASSERT(m_clock_cb.lfclk_requests > 0);
    This happens most likely when you have not initialized the nrf_drv_clock as below before attempting to start the scheduler. Add this line before vTaskStartScheduler

        /* Initialize clock driver for better time accuracy in FREERTOS */
        err_code = nrf_drv_clock_init();
        APP_ERROR_CHECK(err_code);
Related