nRF9151 TF-M Boot Hang When Enabling NVS for Onomondo SoftSIM

Hardware:

nRF9151 DK
Board: nrf9151dk/nrf9151/ns

  • nRF Connect SDK version: 3.2.1
  • Zephyr version: 0.17

Issue Description:

I have a working LWM2M application with TF-M enabled. When I integrate Onomondo SoftSIM library, it requires CONFIG_NVS=y to be enabled. However, as soon as I enable NVS, the device hangs during boot and never reaches main().

Broken Configuration (with NVS):

CONFIG_BUILD_WITH_TFM=y
CONFIG_LWM2M_CLIENT_UTILS=y
CONFIG_NVS=y
CONFIG_PM_PARTITION_SIZE_NVS_STORAGE=0x8000
CONFIG_SOFTSIM=y

Partition Layout:

The partition layout appears correct with no overlaps. NVS is in non-secure region:

nvs_storage:
  address: 0xe8000
  end_address: 0xf0000
  region: flash_primary
  size: 0x8000

tfm_its:
  address: 0xf8000
  size: 0x2000

tfm_otp_nv_counters:
  address: 0xfa000
  size: 0x2000

tfm_nonsecure:
  address: 0x18000
  end_address: 0x78000
  size: 0x60000

Questions:

  1. Is this a known SPU (System Protection Unit) permissions issue where NVS tries to access flash before TF-M configures the regions as non-secure?
  2. How can I configure TF-M to allow the NVS flash region (0xe8000-0xf0000) to be accessible from non-secure code during early boot?
  3. Is there a recommended initialization order or additional TF-M configuration needed when combining TF-M + NVS on nRF9151?

Any guidance would be greatly appreciated.

Related