This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using Secure Services in Non-Secure Application

I keep getting a hard fault when calling spm_request_random_number()

00> E: ***** MPU FAULT *****
00> E:   Instruction Access Violation
00> E: r0/a1:  0x00000000  r1/a2:  0xe000ed00  r2/a3:  0x200287c8
00> E: r3/a4:  0x00000000 r12/ip:  0x200283fc r14/lr:  0x00045add
00> E:  xpsr:  0x61040000
00> E: Faulting instruction address (r15/pc): 0xe6ff23a4
00> E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
00> E: Current thread: 0x20025830 (unknown)
00> E: Resetting system

I'm following the secure_services sample provided in the SDK, and the secure_services header file is not providing me with much insight. Any common pitfalls I could be missing? I'm using NCS 1.7.0 and am using the SPM that's automatically generated when building a non-secure application, no custom SPM.

Parents
  • Hi,

    As a general suggestion, you can compare your project with the secure services sample (nrf\samples\nrf9160\secure_services\). If you don't spot anything obvious, the next step should be to understand where there the issue was. Please see for instance this post on how to use addr2line to see where in the code the error occurred.

  • Thanks for the suggestion. My problem ended up being wrong parameters into the function header. I am generating UUIDs for some messages, and I interpreted the len param as length of the UUID in bits for some reason instead of bytes. I was just a little confused because the fault was occurring around system calls, so I my first instinct was there may be some issues with context switches from the secure to non-secure context since I'd seen others on here have issues with that. Anyway my mistake was dumb and I'll leave this here unless someone else has a similar issue. The secure_services library should work out of the box.

Reply
  • Thanks for the suggestion. My problem ended up being wrong parameters into the function header. I am generating UUIDs for some messages, and I interpreted the len param as length of the UUID in bits for some reason instead of bytes. I was just a little confused because the fault was occurring around system calls, so I my first instinct was there may be some issues with context switches from the secure to non-secure context since I'd seen others on here have issues with that. Anyway my mistake was dumb and I'll leave this here unless someone else has a similar issue. The secure_services library should work out of the box.

Children
No Data
Related