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

No stack trace in app_error_fault_handler

Can anyone tell all the potential reasons for stack corruption? I'm debuging a problem where sometimes there is no stack trace when putting a breakpoint on the first line of the app_error_fault_handler. I'm causing a deliberate crash by putting an APP_ERROR_HANDLER(0) statement in the first line of the main function. Our custom app_error_fault_handler looks like this:

void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
{
    if (m_err_info == NULL)
    {
      m_err_info = (error_info_t *)info;

      nrf_sdh_disable_request();

      ret_code_t err_code = batt_recording_store_err_info(m_err_info);
    }

        // disable wake-on-gpio
    for (int i = 0; i < NUMBER_OF_PINS; ++i)
    {
        if (i != 21) // exclude the reset pin
            nrf_gpio_cfg_default(i);
    }
    
    // disable wake-on-nfc
    //NRF_NFCT->TASKS_DISABLE = 1;

    __sd_nvic_irq_disable();

    while (true)
    {
        nrf_power_system_off();
    }
}

If I comment out the endless loop at the end of the fault handler I get a stack trace, but if I leave it in I don't. Can't really see how it could be a buffer overflow since the APP_ERROR_FAULT_HANDLER is the first statement in main. The optimization is O0.

Can't make sense of this.

Parents Reply Children
Related