nRF9160 SPM problems

Hi!

I need to modify the code of the secure and the non-secure images of my project.

I tried to follow this guide https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/using-a-custom-secure-partition-manager-wtih-your-application but I encountered some issues: I need to use the last version of Toolchain (1.9.1) and with that, it doesn't run.

The second solution that I tried is to create two different projects, one in the secure domain (like here https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/spm/README.html)  and one in the non-secure domain (I used my main project that works fine). To do that I suppose that there is the need to include this command "CONFIG_SPM=n" in the prj.conf file but when I build that I receive the following errors:

/opt/nordic/ncs/v1.9.1/nrf/lib/nrf_modem_lib/shmem_sanity.c:9:10: fatal error: pm_config.h: No such file or directory
    9 | #include <pm_config.h>
      |          ^~~~~
compilation terminated.
[151/188] Building C object zephyr/boards/arm/nrf9160dk_nrf9160/CMakeFiles/boards_arm_nrf9160dk_nrf9160.dir/nrf52840_reset.c.obj
[152/188] Building C object zephyr/subsys/net/CMakeFiles/subsys__net.dir/buf.c.obj
[153/188] Building C object zephyr/kernel/CMakeFiles/kernel.dir/init.c.obj
[154/188] Linking C static library zephyr/soc/arm/common/cortex_m/libsoc_armcommon_cortex_m.a
[155/188] Building C object modules/nrf/lib/at_cmd_parser/CMakeFiles/.._nrflib_at_cmd_parser.dir/at_params.c.obj
[156/188] Building C object modules/nrf/lib/at_cmd_parser/CMakeFiles/.._nrflib_at_cmd_parser.dir/at_cmd_parser.c.obj
[157/188] Building C object modules/nrf/lib/nrf_modem_lib/CMakeFiles/.._nrflib_nrf_modem_lib.dir/nrf_modem_os.c.obj
FAILED: modules/nrf/lib/nrf_modem_lib/CMakeFiles/.._nrflib_nrf_modem_lib.dir/nrf_modem_os.c.obj 
ccache /opt/nordic/ncs/v1.9.1/toolchain/bin/arm-none-eabi-gcc -DBUILD_VERSION=v2.7.99-ncs1-1 -DKERNEL -DNRF9160_XXAA -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=0 -D_LINUX_ERRNO_EXTENSIONS_ -D_PROGRAM_START -DZEPHYR=1 -I/opt/nordic/ncs/v1.9.1/zephyr/include -I/Users/lorenzobrancaleoni/Progetti/Progetto_ESP/qrCodeReader/main_project/build/zephyr/include/generated -I/opt/nordic/ncs/v1.9.1/zephyr/soc/arm/nordic_nrf/nrf91 -I/opt/nordic/ncs/v1.9.1/zephyr/lib/libc/newlib/include -I/opt/nordic/ncs/v1.9.1/zephyr/soc/arm/nordic_nrf/common/. -I/opt/nordic/ncs/v1.9.1/zephyr/subsys/net/lib/sockets/. -I/opt/nordic/ncs/v1.9.1/zephyr/subsys/net/lib/tls_credentials/. -I/opt/nordic/ncs/v1.9.1/nrf/include -I/opt/nordic/ncs/v1.9.1/nrf/lib/at_cmd_parser/include -I/opt/nordic/ncs/v1.9.1/modules/lib/cjson -I/opt/nordic/ncs/v1.9.1/nrf/modules/cjson/include -I/opt/nordic/ncs/v1.9.1/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v1.9.1/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v1.9.1/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v1.9.1/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v1.9.1/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v1.9.1/nrfxlib/nrf_modem/include -O0 -imacros /Users/lorenzobrancaleoni/Progetti/Progetto_ESP/qrCodeReader/main_project/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee -imacros /opt/nordic/ncs/v1.9.1/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/Users/lorenzobrancaleoni/Progetti/Progetto_ESP/qrCodeReader/main_project=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v1.9.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v1.9.1=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -MD -MT modules/nrf/lib/nrf_modem_lib/CMakeFiles/..nrflibnrf_modem_lib.dir/nrf_modem_os.c.obj -MF modules/nrf/lib/nrf_modem_lib/CMakeFiles/..nrflibnrf_modem_lib.dir/nrf_modem_os.c.obj.d -o modules/nrf/lib/nrf_modem_lib/CMakeFiles/..nrflib_nrf_modem_lib.dir/nrf_modem_os.c.obj -c /opt/nordic/ncs/v1.9.1/nrf/lib/nrf_modem_lib/nrf_modem_os.c
/opt/nordic/ncs/v1.9.1/nrf/lib/nrf_modem_lib/nrf_modem_os.c:18:10: fatal error: pm_config.h: No such file or directory
   18 | #include <pm_config.h>
      |          ^~~~~
compilation terminated.
[158/188] Building C object modules/nrf/lib/nrf_modem_lib/CMakeFiles/.._nrflib_nrf_modem_lib.dir/nrf_modem_lib.c.obj
FAILED: modules/nrf/lib/nrf_modem_lib/CMakeFiles/.._nrflib_nrf_modem_lib.dir/nrf_modem_lib.c.obj 
ccache /opt/nordic/ncs/v1.9.1/toolchain/bin/arm-none-eabi-gcc -DBUILD_VERSION=v2.7.99-ncs1-1 -DKERNEL -DNRF9160_XXAA -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=0 -D_LINUX_ERRNO_EXTENSIONS_ -D_PROGRAM_START -DZEPHYR=1 -I/opt/nordic/ncs/v1.9.1/zephyr/include -I/Users/lorenzobrancaleoni/Progetti/Progetto_ESP/qrCodeReader/main_project/build/zephyr/include/generated -I/opt/nordic/ncs/v1.9.1/zephyr/soc/arm/nordic_nrf/nrf91 -I/opt/nordic/ncs/v1.9.1/zephyr/lib/libc/newlib/include -I/opt/nordic/ncs/v1.9.1/zephyr/soc/arm/nordic_nrf/common/. -I/opt/nordic/ncs/v1.9.1/zephyr/subsys/net/lib/sockets/. -I/opt/nordic/ncs/v1.9.1/zephyr/subsys/net/lib/tls_credentials/. -I/opt/nordic/ncs/v1.9.1/nrf/include -I/opt/nordic/ncs/v1.9.1/nrf/lib/at_cmd_parser/include -I/opt/nordic/ncs/v1.9.1/modules/lib/cjson -I/opt/nordic/ncs/v1.9.1/nrf/modules/cjson/include -I/opt/nordic/ncs/v1.9.1/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v1.9.1/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v1.9.1/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v1.9.1/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v1.9.1/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v1.9.1/nrfxlib/nrf_modem/include -O0 -imacros /Users/lorenzobrancaleoni/Progetti/Progetto_ESP/qrCodeReader/main_project/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee -imacros /opt/nordic/ncs/v1.9.1/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/Users/lorenzobrancaleoni/Progetti/Progetto_ESP/qrCodeReader/main_project=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v1.9.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v1.9.1=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -MD -MT modules/nrf/lib/nrf_modem_lib/CMakeFiles/..nrflibnrf_modem_lib.dir/nrf_modem_lib.c.obj -MF modules/nrf/lib/nrf_modem_lib/CMakeFiles/..nrflibnrf_modem_lib.dir/nrf_modem_lib.c.obj.d -o modules/nrf/lib/nrf_modem_lib/CMakeFiles/..nrflib_nrf_modem_lib.dir/nrf_modem_lib.c.obj -c /opt/nordic/ncs/v1.9.1/nrf/lib/nrf_modem_lib/nrf_modem_lib.c
/opt/nordic/ncs/v1.9.1/nrf/lib/nrf_modem_lib/nrf_modem_lib.c:14:10: fatal error: pm_config.h: No such file or directory
   14 | #include <pm_config.h>
      |          ^~~~~
compilation terminated.
[159/188] Building C object modules/nrf/lib/at_monitor/CMakeFiles/.._nrflib_at_monitor.dir/at_monitor.c.obj
[160/188] Building C object modules/nrf/lib/at_host/CMakeFiles/.._nrflib_at_host.dir/at_host.c.obj
[161/188] Building C object zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c.obj
FAILED: zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c.obj 
ccache /opt/nordic/ncs/v1.9.1/toolchain/bin/arm-none-eabi-gcc -DBUILD_VERSION=v2.7.99-ncs1-1 -DKERNEL -DNRF9160_XXAA -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=0 -D_LINUX_ERRNO_EXTENSIONS_ -D_PROGRAM_START -DZEPHYR_SUPERVISOR_ -D_ZEPHYR=1 -I/opt/nordic/ncs/v1.9.1/zephyr/include -I/Users/lorenzobrancaleoni/Progetti/Progetto_ESP/qrCodeReader/main_project/build/zephyr/include/generated -I/opt/nordic/ncs/v1.9.1/zephyr/soc/arm/nordic_nrf/nrf91 -I/opt/nordic/ncs/v1.9.1/zephyr/lib/libc/newlib/include -I/opt/nordic/ncs/v1.9.1/zephyr/soc/arm/nordic_nrf/common/. -I/opt/nordic/ncs/v1.9.1/zephyr/subsys/net/lib/sockets/. -I/opt/nordic/ncs/v1.9.1/zephyr/subsys/net/lib/tls_credentials/. -I/opt/nordic/ncs/v1.9.1/nrf/include -I/opt/nordic/ncs/v1.9.1/nrf/lib/at_cmd_parser/include -I/opt/nordic/ncs/v1.9.1/modules/lib/cjson -I/opt/nordic/ncs/v1.9.1/nrf/modules/cjson/include -I/opt/nordic/ncs/v1.9.1/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v1.9.1/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v1.9.1/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v1.9.1/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v1.9.1/zephyr/modules/hal_nordic/nrfx/. -I/opt/nordic/ncs/v1.9.1/nrfxlib/nrf_modem/include -O0 -imacros /Users/lorenzobrancaleoni/Progetti/Progetto_ESP/qrCodeReader/main_project/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee -imacros /opt/nordic/ncs/v1.9.1/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/Users/lorenzobrancaleoni/Progetti/Progetto_ESP/qrCodeReader/main_project=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v1.9.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v1.9.1=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -MD -MT zephyr/drivers/serial/CMakeFiles/driversserial.dir/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c.obj -MF zephyr/drivers/serial/CMakeFiles/driversserial.dir/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c.obj.d -o zephyr/drivers/serial/CMakeFiles/drivers_serial.dir/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c.obj -c /opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c
In file included from /opt/nordic/ncs/v1.9.1/zephyr/include/arch/arm/aarch32/arch.h:20,
                 from /opt/nordic/ncs/v1.9.1/zephyr/include/arch/cpu.h:19,
                 from /opt/nordic/ncs/v1.9.1/zephyr/include/kernel_includes.h:33,
                 from /opt/nordic/ncs/v1.9.1/zephyr/include/kernel.h:17,
                 from /opt/nordic/ncs/v1.9.1/zephyr/include/init.h:11,
                 from /opt/nordic/ncs/v1.9.1/zephyr/include/device.h:29,
                 from /opt/nordic/ncs/v1.9.1/zephyr/include/drivers/uart.h:26,
                 from /opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:7:
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:305:40: error: 'DT_N_INST_0_nordic_nrf_sw_lpuart_BUS_P_label' undeclared here (not in a function)
  305 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                                        ^~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:3022:24: note: in definition of macro 'DT_CAT'
 3022 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2390:31: note: in expansion of macro 'DT_PROP'
 2390 | #define DT_BUS_LABEL(node_id) DT_PROP(DT_BUS(node_id), label)
      |                               ^~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2383:25: note: in expansion of macro 'DT_CAT'
 2383 | #define DT_BUS(node_id) DT_CAT(node_id, _BUS)
      |                         ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2390:39: note: in expansion of macro 'DT_BUS'
 2390 | #define DT_BUS_LABEL(node_id) DT_PROP(DT_BUS(node_id), label)
      |                                       ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2771:33: note: in expansion of macro 'DT_BUS_LABEL'
 2771 | #define DT_INST_BUS_LABEL(inst) DT_BUS_LABEL(DT_DRV_INST(inst))
      |                                 ^~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/sys/util_internal.h:98:26: note: in expansion of macro 'UTIL_PRIMITIVE_CAT'
   98 | #define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, _VA_ARGS_)
      |                          ^~~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:305:31: note: in expansion of macro 'UTIL_CAT'
  305 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                               ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2434:27: note: in expansion of macro 'DT_INST'
 2434 | #define DT_DRV_INST(inst) DT_INST(inst, DT_DRV_COMPAT)
      |                           ^~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2771:46: note: in expansion of macro 'DT_DRV_INST'
 2771 | #define DT_INST_BUS_LABEL(inst) DT_BUS_LABEL(DT_DRV_INST(inst))
      |                                              ^~~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:989:15: note: in expansion of macro 'DT_INST_BUS_LABEL'
  989 |  .uart_name = DT_INST_BUS_LABEL(0),
      |               ^~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:305:40: error: 'DT_N_INST_0_nordic_nrf_sw_lpuart_P_req_pin' undeclared here (not in a function); did you mean 'DT_N_INST_0_nordic_nrf_uarte'?
  305 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                                        ^~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:3022:24: note: in definition of macro 'DT_CAT'
 3022 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2491:34: note: in expansion of macro 'DT_PROP'
 2491 | #define DT_INST_PROP(inst, prop) DT_PROP(DT_DRV_INST(inst), prop)
      |                                  ^~~
/opt/nordic/ncs/v1.9.1/zephyr/include/sys/util_internal.h:98:26: note: in expansion of macro 'UTIL_PRIMITIVE_CAT'
   98 | #define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, _VA_ARGS_)
      |                          ^~~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:305:31: note: in expansion of macro 'UTIL_CAT'
  305 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                               ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2434:27: note: in expansion of macro 'DT_INST'
 2434 | #define DT_DRV_INST(inst) DT_INST(inst, DT_DRV_COMPAT)
      |                           ^~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2491:42: note: in expansion of macro 'DT_DRV_INST'
 2491 | #define DT_INST_PROP(inst, prop) DT_PROP(DT_DRV_INST(inst), prop)
      |                                          ^~~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:984:10: note: in expansion of macro 'DT_INST_PROP'
  984 |   .pin = DT_INST_PROP(0, pin_prop) & 0x1F, \
      |          ^~~~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:990:9: note: in expansion of macro 'LPUART_PIN_CFG_INITIALIZER'
  990 |  .req = LPUART_PIN_CFG_INITIALIZER(req_pin),
      |         ^~~~~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:305:40: error: 'DT_N_INST_0_nordic_nrf_sw_lpuart_P_rdy_pin' undeclared here (not in a function)
  305 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                                        ^~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:3022:24: note: in definition of macro 'DT_CAT'
 3022 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2491:34: note: in expansion of macro 'DT_PROP'
 2491 | #define DT_INST_PROP(inst, prop) DT_PROP(DT_DRV_INST(inst), prop)
      |                                  ^~~
/opt/nordic/ncs/v1.9.1/zephyr/include/sys/util_internal.h:98:26: note: in expansion of macro 'UTIL_PRIMITIVE_CAT'
   98 | #define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, _VA_ARGS_)
      |                          ^~~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:305:31: note: in expansion of macro 'UTIL_CAT'
  305 | #define DT_INST(inst, compat) UTIL_CAT(DT_N_INST, DT_DASH(inst, compat))
      |                               ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2434:27: note: in expansion of macro 'DT_INST'
 2434 | #define DT_DRV_INST(inst) DT_INST(inst, DT_DRV_COMPAT)
      |                           ^~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:2491:42: note: in expansion of macro 'DT_DRV_INST'
 2491 | #define DT_INST_PROP(inst, prop) DT_PROP(DT_DRV_INST(inst), prop)
      |                                          ^~~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:984:10: note: in expansion of macro 'DT_INST_PROP'
  984 |   .pin = DT_INST_PROP(0, pin_prop) & 0x1F, \
      |          ^~~~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:991:9: note: in expansion of macro 'LPUART_PIN_CFG_INITIALIZER'
  991 |  .rdy = LPUART_PIN_CFG_INITIALIZER(rdy_pin)
      |         ^~~~~~~~~~
In file included from /opt/nordic/ncs/v1.9.1/zephyr/include/toolchain.h:50,
                 from /opt/nordic/ncs/v1.9.1/zephyr/include/init.h:10,
                 from /opt/nordic/ncs/v1.9.1/zephyr/include/device.h:29,
                 from /opt/nordic/ncs/v1.9.1/zephyr/include/drivers/uart.h:26,
                 from /opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:7:
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:177:36: error: 'DT_N_NODELABEL_lpuart_PARENT_IRQ_IDX_0_VAL_priority' undeclared here (not in a function)
  177 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                                    ^~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/toolchain/gcc.h:61:51: note: in definition of macro 'BUILD_ASSERT'
   61 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
      |                                                   ^~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:1847:2: note: in expansion of macro 'DT_CAT'
 1847 |  DT_CAT(node_id, IRQ_IDX##idx##VAL##cell)
      |  ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:1874:31: note: in expansion of macro 'DT_IRQ_BY_IDX'
 1874 | #define DT_IRQ(node_id, cell) DT_IRQ_BY_IDX(node_id, 0, cell)
      |                               ^~~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:1029:14: note: in expansion of macro 'DT_IRQ'
 1029 | BUILD_ASSERT(DT_IRQ(DT_PARENT(DT_NODELABEL(lpuart)), priority) ==
      |              ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/sys/util_internal.h:98:26: note: in expansion of macro 'UTIL_PRIMITIVE_CAT'
   98 | #define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, _VA_ARGS_)
      |                          ^~~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:326:28: note: in expansion of macro 'UTIL_CAT'
  326 | #define DT_PARENT(node_id) UTIL_CAT(node_id, _PARENT)
      |                            ^~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:1029:21: note: in expansion of macro 'DT_PARENT'
 1029 | BUILD_ASSERT(DT_IRQ(DT_PARENT(DT_NODELABEL(lpuart)), priority) ==
      |                     ^~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:177:29: note: in expansion of macro 'DT_CAT'
  177 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                             ^~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:1029:31: note: in expansion of macro 'DT_NODELABEL'
 1029 | BUILD_ASSERT(DT_IRQ(DT_PARENT(DT_NODELABEL(lpuart)), priority) ==
      |                               ^~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:177:36: error: expression in static assertion is not an integer
  177 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                                    ^~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/toolchain/gcc.h:61:51: note: in definition of macro 'BUILD_ASSERT'
   61 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
      |                                                   ^~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:1847:2: note: in expansion of macro 'DT_CAT'
 1847 |  DT_CAT(node_id, IRQ_IDX##idx##VAL##cell)
      |  ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:1874:31: note: in expansion of macro 'DT_IRQ_BY_IDX'
 1874 | #define DT_IRQ(node_id, cell) DT_IRQ_BY_IDX(node_id, 0, cell)
      |                               ^~~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:1029:14: note: in expansion of macro 'DT_IRQ'
 1029 | BUILD_ASSERT(DT_IRQ(DT_PARENT(DT_NODELABEL(lpuart)), priority) ==
      |              ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/sys/util_internal.h:98:26: note: in expansion of macro 'UTIL_PRIMITIVE_CAT'
   98 | #define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, _VA_ARGS_)
      |                          ^~~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:326:28: note: in expansion of macro 'UTIL_CAT'
  326 | #define DT_PARENT(node_id) UTIL_CAT(node_id, _PARENT)
      |                            ^~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:1029:21: note: in expansion of macro 'DT_PARENT'
 1029 | BUILD_ASSERT(DT_IRQ(DT_PARENT(DT_NODELABEL(lpuart)), priority) ==
      |                     ^~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:177:29: note: in expansion of macro 'DT_CAT'
  177 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                             ^~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:1029:31: note: in expansion of macro 'DT_NODELABEL'
 1029 | BUILD_ASSERT(DT_IRQ(DT_PARENT(DT_NODELABEL(lpuart)), priority) ==
      |                               ^~~~~~
In file included from /opt/nordic/ncs/v1.9.1/zephyr/include/drivers/uart.h:26,
                 from /opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:7:
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:177:36: error: 'DT_N_NODELABEL_lpuart_FULL_NAME' undeclared here (not in a function)
  177 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                                    ^~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/device.h:903:11: note: in definition of macro 'Z_DEVICE_DEFINE'
  903 |   .name = drv_name,     \
      |           ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/sys/util_internal.h:64:53: note: in expansion of macro '__DEBRACKET'
   64 | #define __GET_ARG2_DEBRACKET(ignore_this, val, ...) __DEBRACKET val
      |                                                     ^~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/sys/util_internal.h:59:2: note: in expansion of macro '__GET_ARG2_DEBRACKET'
   59 |  __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code)
      |  ^~~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/sys/util_internal.h:54:2: note: in expansion of macro '__COND_CODE'
   54 |  __COND_CODE(_XXXX##_flag, _if_1_code, _else_code)
      |  ^~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/sys/util_macro.h:157:2: note: in expansion of macro 'Z_COND_CODE_1'
  157 |  Z_COND_CODE_1(_flag, _if_1_code, _else_code)
      |  ^~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:649:2: note: in expansion of macro 'COND_CODE_1'
  649 |  COND_CODE_1(DT_NODE_HAS_PROP(node_id, prop), \
      |  ^~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/device.h:203:2: note: in expansion of macro 'DT_PROP_OR'
  203 |  DT_PROP_OR(node_id, label, DT_NODE_FULL_NAME(node_id))
      |  ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:475:36: note: in expansion of macro 'DT_CAT'
  475 | #define DT_NODE_FULL_NAME(node_id) DT_CAT(node_id, _FULL_NAME)
      |                                    ^~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/device.h:203:29: note: in expansion of macro 'DT_NODE_FULL_NAME'
  203 |  DT_PROP_OR(node_id, label, DT_NODE_FULL_NAME(node_id))
      |                             ^~~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/device.h:253:4: note: in expansion of macro 'DEVICE_DT_NAME'
  253 |    DEVICE_DT_NAME(node_id), init_fn,  \
      |    ^~~~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:1033:1: note: in expansion of macro 'DEVICE_DT_DEFINE'
 1033 | DEVICE_DT_DEFINE(DT_NODELABEL(lpuart), lpuart_init, NULL,
      | ^~~~~~
/opt/nordic/ncs/v1.9.1/zephyr/include/devicetree.h:177:29: note: in expansion of macro 'DT_CAT'
  177 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                             ^~~~
/opt/nordic/ncs/v1.9.1/nrf/drivers/serial/uart_nrf_sw_lpuart.c:1033:18: note: in expansion of macro 'DT_NODELABEL'
 1033 | DEVICE_DT_DEFINE(DT_NODELABEL(lpuart), lpuart_init, NULL,
      |                  ^~~~~~
[162/188] Building C object modules/nrf/lib/lte_link_control/CMakeFiles/.._nrflib_lte_link_control.dir/lte_lc_helpers.c.obj
[163/188] Building C object modules/nrf/lib/lte_link_control/CMakeFiles/.._nrflib_lte_link_control.dir/lte_lc.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /opt/nordic/ncs/v1.9.1/toolchain/bin/cmake --build /Users/lorenzobrancaleoni/Progetti/Progetto_ESP/qrCodeReader/main_project/build



What should I do? Thank's

Parents
  • Hi Gioele, 

    Sorry for the late response. We will try to update the example in this guide https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/using-a-custom-secure-partition-manager-wtih-your-application

    For now, the easiest way of doing this is to directly modify the SPM sample to add your secure code in. 

    The way it works is that the SPM image will run in the secure domain (built for nrf9169dk_nrf9160 board) and the SPM image will make the jump to the unsecure domain which your unsecure application is configured (built for nrf9169dk_nrf9160_ns board).

    You can configure and put any of your secure function inside the SPM firmware. And can follow what Heidi wrote about how you can share between the secure and nonsecure domain. 

    Note that when you build an application with nrf9169dk_nrf9160_ns the SPM image will be added automatically as the child image. So you don't need to add CONFIG_SPM into the prj.conf. You also don't need to create an extra project as secure project (nrf9169dk_nrf9160) because it's the SPM. When you flash both the SPM and the unsecure will be flashed. 

    The issue we have now with the guide is that the custom SPM folder doesn't work as in the guide. But you can of course modify the original SPM sample directly. Just keep a back up of the original SPM sample so you can revert later if needed. 

    I would suggest to start with something very simple , for example blinky example to blink LED. And then add a function in the secure SPM sample and try sharing that function/variable between the 2 domain, the unsecure blinky and the secure SPM sample. 

Reply
  • Hi Gioele, 

    Sorry for the late response. We will try to update the example in this guide https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/using-a-custom-secure-partition-manager-wtih-your-application

    For now, the easiest way of doing this is to directly modify the SPM sample to add your secure code in. 

    The way it works is that the SPM image will run in the secure domain (built for nrf9169dk_nrf9160 board) and the SPM image will make the jump to the unsecure domain which your unsecure application is configured (built for nrf9169dk_nrf9160_ns board).

    You can configure and put any of your secure function inside the SPM firmware. And can follow what Heidi wrote about how you can share between the secure and nonsecure domain. 

    Note that when you build an application with nrf9169dk_nrf9160_ns the SPM image will be added automatically as the child image. So you don't need to add CONFIG_SPM into the prj.conf. You also don't need to create an extra project as secure project (nrf9169dk_nrf9160) because it's the SPM. When you flash both the SPM and the unsecure will be flashed. 

    The issue we have now with the guide is that the custom SPM folder doesn't work as in the guide. But you can of course modify the original SPM sample directly. Just keep a back up of the original SPM sample so you can revert later if needed. 

    I would suggest to start with something very simple , for example blinky example to blink LED. And then add a function in the secure SPM sample and try sharing that function/variable between the 2 domain, the unsecure blinky and the secure SPM sample. 

Children
No Data
Related