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

app_error_handler and IAR 8.22.1

Hi,

I am experiencing problems with the app_error_handler function defined in app_error_handler_iar_c provided with the SDK V15.0.0.

If the function gets called when debugging with IAR, the IAR IDE will hang for ~15 seconds (or even crash), before reappearing in app_error_fault_handler.

Looking at the stack trace, it appears as through app_error_handler has repeatably called itself, before (presumably) running out of stack.

Is anybody else experiencing this problem? Is this a known issue?

Regards

John

Details
----------

My main.c to test this:

-------------------------------->8--------------------------------------------------------
#include "app_error.h"

int main(void)
{
    app_error_handler(100, 100, "blah");
    
    return 0;
}

void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
{
    app_error_save_and_stop(id, pc, info);
}

-------------------------------->8--------------------------------------------------------

The extract from the stack trace provided by IAR:

-------------------------------->8--------------------------------------------------------
app_error_fault_handler

app_error_handler
app_error_handler
app_error_handler

... {30 more}
app_error_handler
app_error_handler
app_error_handler
app_error_handler
app_error_handler
app_error_handler

-------------------------------->8--------------------------------------------------------

Build details:

Preproc defines:
    BOARD_PCA10040
    CONFIG_GPIO_AS_PINRESET
    FLOAT_ABI_HARD
    NRF52
    NRF52832_XXAA
    NRF52_PAN_74
    NRF_SD_BLE_API_VERSION=6
    S132
    SOFTDEVICE_PRESENT
    SWI_DISABLE0
    DEBUG

My development environment:

SW:
      Windows 10, Version 1803.
      IAR 8.22.1
      Nordic SDK 15.0.0
      JLINK software updated to V6.32g

HW:
     PCA10040, V1.1.1

Parents Reply Children
  • Edvin,

    I just use code below, from previous SDK and this works fine. In callstack, while debugging, I still can see the cause of the assert. Also line nr and file name are correct.

    The assembly version of SDK 15.2.0 does not hang, but call stack is gone as can be seen in screenshot of. So while debugging you cannot easily trace back where the assert was by clicking in the callstack  (but it is in error_info_t struct).

    void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name)
    {
        error_info_t error_info =
        {
            .line_num    = line_num,
            .p_file_name = p_file_name,
            .err_code    = error_code,
        };
        app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&error_info));
    
        UNUSED_VARIABLE(error_info);
    }

Related