app_error_fault_handler line and PC zero when NDEBUG

I was trying to debug an issue with a release build on our firmware. I modified app_error_fault_handler inverting the NDEBUG logic so that the error code, line number and PC were printed.

However, I don't get the line number of PC:

<error> app: ERROR 12 [NRF_ERROR_DATA_SIZE] at :0
PC at: 0x00000000
<error> app: End of error report

I assume this is due to optimisation somewhere, is it possible to modify the project to include the line and PC in a release build?

Working with SES and nRF SDK 17.1.0, removed my copy of app_error_fault_handler and reverted to app_error.weak.c's implementation, same behaviour.

Parents
  • Hello,

    You are right, to reduce the memory footprint, we do not include the file paths and PC values in the release configuration. If you want this, you can simply build the release project again with the DEBUG flag set.

    Adding DEBUG flag to a release configuration:

    When the DEBUG flag is set, the APP_ERROR_CHECK() macro will pass the linker symbols __LINE__ and __FILE__ to the app error handler as you can see here (from app_error.h):

    Best regards,

    Vidar

Reply
  • Hello,

    You are right, to reduce the memory footprint, we do not include the file paths and PC values in the release configuration. If you want this, you can simply build the release project again with the DEBUG flag set.

    Adding DEBUG flag to a release configuration:

    When the DEBUG flag is set, the APP_ERROR_CHECK() macro will pass the linker symbols __LINE__ and __FILE__ to the app error handler as you can see here (from app_error.h):

    Best regards,

    Vidar

Children
Related