__ASSERT is not dumping proper information

Hi,

  I am using nRF SDK 1.9.1. Want to add a few ASSERT to check corner cases.

When I add the following code in main.c

                     __ASSERT(buf == NULL,"Test ","Test");

The module resets with the following generic information


 os: r3/a4: 0x0001deed r12/ip: 0x00000000 r14/lr: 0x00010795[0m
 os: xpsr: 0x41000000[0m
 os: Faulting instruction address (r15/pc): 0x0002655c[0m
 os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0[0m
 os: Current thread: 0x20001670 (ble_write_thread_id)[0m
<err> fatal_error: Resetting system[0m

As you can see above the ASSERT does not seem to dump the right data and make the whole assertion meaningless.

Any suggestion to make ASSERT work will be really helpful

Parents
  • The Zephyr ASSERT implementation has a set of different macros to configure the output, beside enabling/disabling the feature. Maybe this is turned off in your case. You could take a look at the header file ./ncs/v1.9.1/zephyr/include/sys/__assert.h to see how the macros are used.

    You can also use the PC register value from the output to see where the fault occurred. That would be something like:

    arm-none-eabi-addr2line -a -f -p -e build/zephyr/zephyr.elf <PC_HEX_VALUE>
Reply
  • The Zephyr ASSERT implementation has a set of different macros to configure the output, beside enabling/disabling the feature. Maybe this is turned off in your case. You could take a look at the header file ./ncs/v1.9.1/zephyr/include/sys/__assert.h to see how the macros are used.

    You can also use the PC register value from the output to see where the fault occurred. That would be something like:

    arm-none-eabi-addr2line -a -f -p -e build/zephyr/zephyr.elf <PC_HEX_VALUE>
Children
No Data
Related