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

Hard fault in SPM module

Hi.

I'm trying to run an application using a custom SPM module in a nRF5340 where I get an error while running it. I'm using nRF Connect SDK. The terminal gives me this output:

[00:01:43.704,071] <err> os: Exception occurred in Secure State
[00:01:43.704,071] <err> os: ***** HARD FAULT *****
[00:01:43.704,071] <err> os: Fault escalation (see below)
[00:01:43.704,071] <err> os: ***** BUS FAULT *****
[00:01:43.704,101] <err> os: Precise data bus error
[00:01:43.704,101] <err> os: BFAR Address: 0x50008158
[00:01:43.704,101] <err> os: r0/a1: 0x0000002b r1/a2: 0x00000000 r2/a3: 0x00000000
[00:01:43.704,101] <err> os: r3/a4: 0xaaaaaaaa r12/ip: 0xaaaaaaaa r14/lr: 0x5f534c42
[00:01:43.704,101] <err> os: xpsr: 0x31534c00
[00:01:43.704,101] <err> os: Faulting instruction address (r15/pc): 0x5f474953
[00:01:43.704,132] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:01:43.704,132] <err> os: Current thread: 0x20008538 (shell_uart)

I've been trying to debug the program, but I found no solution. It just jumps to the exception in a library function call from blst (https://github.com/supranational/blst), which works fine in the non-secure side. While debugging it, I just clarified the error was "Usage fault", but I can't specify what is causing it.
Is there any way to approach to the problem?

Thanks.

Parents Reply
  • Hi.

    Thanks for your response. I tried locking the scheduler but I still get the same error. Debugging the function I managed to find the instruction that leads to the hard fault, but it's a complex macro which won't show while debugging. This is the instruction and it's defined here, if it helps.


    As for the question about what happens on the non-secure side, I don't quite understand what you are referring to. As far as I know, non-secure side waits for the called function to finish before continuing, right?

Children
Related