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

The Question of app_error_fault_handler.

Hello Nordic!

I'm developing with nrf52840, s340, and SDK 15.3.0

Sometimes, I got an error in app_error_fault_handler. 

This is information that gives me in app_error_fault_handler.

Received a fault! id: 0x00001001, pc: 0x00061c94, info: 0x00000000

SOFTDEVICE: INVALID MEMORY ACCESS

I know this problem is violate at softdevice section. 

pc location is memset fuction.  I want to know return address sins memset finised.

How to do that ? 

  • Hello, 

    It sounds like your program is either passing an invalid pointer or the wrong number of bytes to memset. I did a quick test here, and it does not seem to be possible unwind the call stack to find the return address. But you may see the memset pattern in RAM if this is caused by a buffer overrun which would help you find the start pointer. The fault is triggered as soon as the app writes into the Softdevice's RAM region.

    Another option is to verify the arguments each time you call memset in your code.  

  • Thank you your answer!

    But I don't understand a litle bit.

    How to find the start pointer?? I don't know the started location.

  • My idea was to inspect the RAM area right above the application's RAM start address to see if there were a memset pattern. The start address would be where the pattern starts. Then you could check if the start address corresponds with one of your global variables. I'm assuming you don't multiple memsets for the same variable.

  • If softdevice ram region is from 0 to 0xFFF and application's ram region is from 0x1000 to 0x2000, 

    Do I need to check out 0x1000 around ? What is meaning checking the global variables ?

    I think if I pass an invalid pointer, I would check softdevice ram region and if I pass the wrong number of bytes, I don't know how to handle.

    Can you give me one example about this problem ? 

  • The MEMACC assert will trigger as soon as the app writes to an address between 0x0 0xFFF so it is no point in inspecting the Softdevice region. Invalid pointers should be caught before you call memset. 

    hongpal said:
    Do I need to check out 0x1000 around ? What is meaning checking the global variables ?

    Yes, you could try to check if there appears to be a pattern (all zeroes for instance) starting at address 0x1000. This could indicate that you have a memset() that crosses the Softdevice boundary. 

    Have you reviewed your code for susceptible calls to memset? One with non-static input for instance.   

Related