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

app_error_save_and_stop, where is the error saved?

I am looking at the APP_ERROR_CHECK and find out it finally goes to the app_error_save_and_stop method. I couldn't understand from the code, that where the error info saved and how I can look in those errors?

Thanks,

Parents Reply Children
  • Again, 

    Have you looked at the source code?

  • If you are talking about these codes as following, yes I did, but don't understand. Can u explain? Thanks,

    void app_error_save_and_stop(uint32_t id, uint32_t pc, uint32_t info)
    {
    /* static error variables - in order to prevent removal by optimizers */
    static volatile struct
    {
    uint32_t fault_id;
    uint32_t pc;
    uint32_t error_info;
    assert_info_t * p_assert_info;
    error_info_t * p_error_info;
    ret_code_t err_code;
    uint32_t line_num;
    const uint8_t * p_file_name;
    } m_error_data = {0};

    // The following variable helps Keil keep the call stack visible, in addition, it can be set to
    // 0 in the debugger to continue executing code after the error check.
    volatile bool loop = true;
    UNUSED_VARIABLE(loop);

    m_error_data.fault_id = id;
    m_error_data.pc = pc;
    m_error_data.error_info = info;

    switch (id)
    {
    case NRF_FAULT_ID_SDK_ASSERT:
    m_error_data.p_assert_info = (assert_info_t *)info;
    m_error_data.line_num = m_error_data.p_assert_info->line_num;
    m_error_data.p_file_name = m_error_data.p_assert_info->p_file_name;
    break;

    case NRF_FAULT_ID_SDK_ERROR:
    m_error_data.p_error_info = (error_info_t *)info;
    m_error_data.err_code = m_error_data.p_error_info->err_code;
    m_error_data.line_num = m_error_data.p_error_info->line_num;
    m_error_data.p_file_name = m_error_data.p_error_info->p_file_name;
    break;
    }

    UNUSED_VARIABLE(m_error_data);

    // If printing is disrupted, remove the irq calls, or set the loop variable to 0 in the debugger.
    __disable_irq();

    while(loop);

    __enable_irq();
    }

  • Thanks for the tip. But still you are answering me. I am still not clear. Can't you just give a direct answer?

  • Here:

    static volatile struct
    {
        uint32_t        fault_id;
        uint32_t        pc;
        uint32_t        error_info;
        assert_info_t * p_assert_info;
        error_info_t  * p_error_info;
        ret_code_t      err_code;
        uint32_t        line_num;
        const uint8_t * p_file_name;
    } m_error_data = {0};

Related