I'm trying to build some of your samples using nRF Connect/VSCode, but when I try to build a non-secure build for the Thingy91 (thingy91_nrf9160_ns), it changes to secure build (with the message "Changed board to secure thingy91_nrf9160 (NOT NS)").
I run on a Mac M1/OSX-11.7, VSCode 1.74.2, nRF SDK 2.0.2.
I've tried other build configurations/boards (e.g. Nordic nRF9160_DK, Sparkfun nRF9160 etc), and they build a _ns build without problems, but the Thingy91 and also a custom nRF9160 board refuses, and switches to secure build with the same message.
I can try e.g. to build the hello_world sample, and also tried to switch to SDK 1.9.0 or 2.2.0, but same result; nRF9160_DK_ns builds fine, but Thingy91_ns does not.
I've read a few tutorials and (think) I know the details behind TF-M and secure vs non-secure build.
I've seen similar questions in the forum earlier, but unable to find the actual cause of the switch away from ns-builds.
Any hints would be appreciated!
Attached is (some of) the build output:
* Executing task: nRF Connect: Build [pristine]: hello_world/build_T (active)
Building hello_world
west build --build-dir /Users/alfe/Documents/NRF_side/hello_world/build_T /Users/alfe/Documents/NRF_side/hello_world --pristine --board thingy91_nrf9160_ns -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONF_FILE:STRING="/Users/alfe/Documents/NRF_side/hello_world/prj.conf"
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /Users/alfe/Documents/NRF_side/hello_world
-- Found Python3: /opt/nordic/ncs/toolchains/v2.0.2/bin/python3.9 (found suitable exact version "3.9.6") found components: Interpreter
-- Cache files will be written to: /Users/alfe/Library/Caches/zephyr
-- Zephyr version: 3.0.99 (/opt/nordic/ncs/v2.0.2/zephyr)
-- Found west (found suitable version "0.13.1", minimum required is "0.7.1")
-- Board: thingy91_nrf9160_ns
-- Found host-tools: zephyr 0.14.1 (/opt/nordic/ncs/toolchains/v2.0.2/opt/zephyr-sdk)
-- Found dtc: /opt/nordic/ncs/toolchains/v2.0.2/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
-- Found toolchain: zephyr 0.14.1 (/opt/nordic/ncs/toolchains/v2.0.2/opt/zephyr-sdk)
-- Found BOARD.dts: /opt/nordic/ncs/v2.0.2/nrf/boards/arm/thingy91_nrf9160/thingy91_nrf9160_ns.dts
-- Generated zephyr.dts: /Users/alfe/Documents/NRF_side/hello_world/build_T/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /Users/alfe/Documents/NRF_side/hello_world/build_T/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /Users/alfe/Documents/NRF_side/hello_world/build_T/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: /Users/alfe/Documents/NRF_side/hello_world/build_T/zephyr/dts.cmake
Parsing /opt/nordic/ncs/v2.0.2/zephyr/Kconfig
Loaded configuration '/opt/nordic/ncs/v2.0.2/nrf/boards/arm/thingy91_nrf9160/thingy91_nrf9160_ns_defconfig'
Merged configuration '/Users/alfe/Documents/NRF_side/hello_world/prj.conf'
Configuration saved to '/Users/alfe/Documents/NRF_side/hello_world/build_T/zephyr/.config'
Kconfig header saved to '/Users/alfe/Documents/NRF_side/hello_world/build_T/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/nordic/ncs/toolchains/v2.0.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
Changed board to secure thingy91_nrf9160 (NOT NS)
=== child image spm - begin ===
loading initial cache file /Users/alfe/Documents/NRF_side/hello_world/build_T/spm/child_image_preload.cmake
Loading Zephyr default modules (Zephyr base).
-- Application: /opt/nordic/ncs/v2.0.2/nrf/samples/spm
-- Found Python3: /opt/nordic/ncs/toolchains/v2.0.2/bin/python3.9 (found suitable exact version "3.9.6") found components: Interpreter
-- Cache files will be written to: /Users/alfe/Library/Caches/zephyr
-- Zephyr version: 3.0.99 (/opt/nordic/ncs/v2.0.2/zephyr)
-- Found west (found suitable version "0.13.1", minimum required is "0.7.1")
-- Board: thingy91_nrf9160
-- Found host-tools: zephyr 0.14.1 (/opt/nordic/ncs/toolchains/v2.0.2/opt/zephyr-sdk)
-- Found dtc: /opt/nordic/ncs/toolchains/v2.0.2/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
-- Found toolchain: zephyr 0.14.1 (/opt/nordic/ncs/toolchains/v2.0.2/opt/zephyr-sdk)
-- Found BOARD.dts: /opt/nordic/ncs/v2.0.2/nrf/boards/arm/thingy91_nrf9160/thingy91_nrf9160.dts
-- Generated zephyr.dts: /Users/alfe/Documents/NRF_side/hello_world/build_T/spm/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /Users/alfe/Documents/NRF_side/hello_world/build_T/spm/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /Users/alfe/Documents/NRF_side/hello_world/build_T/spm/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: /Users/alfe/Documents/NRF_side/hello_world/build_T/spm/zephyr/dts.cmake
Parsing /opt/nordic/ncs/v2.0.2/zephyr/Kconfig
Loaded configuration '/opt/nordic/ncs/v2.0.2/nrf/boards/arm/thingy91_nrf9160/thingy91_nrf9160_defconfig'
Merged configuration '/opt/nordic/ncs/v2.0.2/nrf/samples/spm/prj.conf'
Merged configuration '/opt/nordic/ncs/v2.0.2/nrf/subsys/partition_manager/partition_manager_enabled.conf'
Merged configuration '/Users/alfe/Documents/NRF_side/hello_world/build_T/spm/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to '/Users/alfe/Documents/NRF_side/hello_world/build_T/spm/zephyr/.config'
Kconfig header saved to '/Users/alfe/Documents/NRF_side/hello_world/build_T/spm/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/nordic/ncs/toolchains/v2.0.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
CMake Warning at /opt/nordic/ncs/v2.0.2/zephyr/CMakeLists.txt:1803 (message):
__ASSERT() statements are globally ENABLED
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/alfe/Documents/NRF_side/hello_world/build_T/spm
=== child image spm - end ===
-- Found Python3: /opt/nordic/ncs/toolchains/v2.0.2/bin/python3.9 (found version "3.9.6") found components: Interpreter
Changed board to secure thingy91_nrf9160 (NOT NS)
=== child image mcuboot - begin ===
loading initial cache file /Users/alfe/Documents/NRF_side/hello_world/build_T/mcuboot/child_image_preload.cmake
Loading Zephyr default modules (Zephyr base).
-- Application: /opt/nordic/ncs/v2.0.2/bootloader/mcuboot/boot/zephyr
-- Found Python3: /opt/nordic/ncs/toolchains/v2.0.2/bin/python3.9 (found suitable exact version "3.9.6") found components: Interpreter
-- Cache files will be written to: /Users/alfe/Library/Caches/zephyr
-- Zephyr version: 3.0.99 (/opt/nordic/ncs/v2.0.2/zephyr)
-- Found west (found suitable version "0.13.1", minimum required is "0.7.1")
-- Board: thingy91_nrf9160
-- Found host-tools: zephyr 0.14.1 (/opt/nordic/ncs/toolchains/v2.0.2/opt/zephyr-sdk)
-- Found dtc: /opt/nordic/ncs/toolchains/v2.0.2/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
-- Found toolchain: zephyr 0.14.1 (/opt/nordic/ncs/toolchains/v2.0.2/opt/zephyr-sdk)
-- Found BOARD.dts: /opt/nordic/ncs/v2.0.2/nrf/boards/arm/thingy91_nrf9160/thingy91_nrf9160.dts
-- Found devicetree overlay: /opt/nordic/ncs/v2.0.2/bootloader/mcuboot/boot/zephyr/dts.overlay
-- Generated zephyr.dts: /Users/alfe/Documents/NRF_side/hello_world/build_T/mcuboot/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /Users/alfe/Documents/NRF_side/hello_world/build_T/mcuboot/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /Users/alfe/Documents/NRF_side/hello_world/build_T/mcuboot/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: /Users/alfe/Documents/NRF_side/hello_world/build_T/mcuboot/zephyr/dts.cmake
Parsing /opt/nordic/ncs/v2.0.2/bootloader/mcuboot/boot/zephyr/Kconfig
Loaded configuration '/opt/nordic/ncs/v2.0.2/nrf/boards/arm/thingy91_nrf9160/thingy91_nrf9160_defconfig'
Merged configuration '/opt/nordic/ncs/v2.0.2/bootloader/mcuboot/boot/zephyr/prj.conf'
Merged configuration '/opt/nordic/ncs/v2.0.2/bootloader/mcuboot/boot/zephyr/boards/thingy91_nrf9160.conf'
Merged configuration '/opt/nordic/ncs/v2.0.2/nrf/subsys/partition_manager/partition_manager_enabled.conf'
Merged configuration '/Users/alfe/Documents/NRF_side/hello_world/build_T/mcuboot/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to '/Users/alfe/Documents/NRF_side/hello_world/build_T/mcuboot/zephyr/.config'
Kconfig header saved to '/Users/alfe/Documents/NRF_side/hello_world/build_T/mcuboot/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/nordic/ncs/toolchains/v2.0.2/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
MCUBoot bootloader key file: /opt/nordic/ncs/v2.0.2/bootloader/mcuboot/root-rsa-2048.pem
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/alfe/Documents/NRF_side/hello_world/build_T/mcuboot
=== child image mcuboot - end ===
CMake Warning at /opt/nordic/ncs/v2.0.2/nrf/modules/mcuboot/CMakeLists.txt:281 (message):
---------------------------------------------------------
--- WARNING: Using default MCUBoot key, it should not ---
--- be used for production. ---
---------------------------------------------------------
-- Found partition manager static configuration: /opt/nordic/ncs/v2.0.2/nrf/boards/arm/thingy91_nrf9160/thingy91_pm_static_spm.yml
Partition 'mcuboot' is not included in the dynamic resolving since it is statically defined.
Partition 'mcuboot_pad' is not included in the dynamic resolving since it is statically defined.
Partition 'mcuboot_primary' is not included in the dynamic resolving since it is statically defined.
Partition 'mcuboot_primary_app' is not included in the dynamic resolving since it is statically defined.
Partition 'mcuboot_secondary' is not included in the dynamic resolving since it is statically defined.
Partition 'spm' is not included in the dynamic resolving since it is statically defined.
Dropping partition 'nrf_modem_lib_trace' since its size is 0.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/alfe/Documents/NRF_side/hello_world/build_T
-- west build: building application
[1/199] Preparing syscall dependency handling
[2/199] Creating directories for 'spm_subimage'
[3/199] Generating misc/generated/syscalls_subdirs.trigger
[4/199] Creating directories for 'mcuboot_subimage'
[5/199] Generating include/generated/version.h
-- Zephyr version: 3.0.99 (/opt/nordic/ncs/v2.0.2/zephyr), build: v3.0.99-ncs1-1
[6/199] No download step for 'mcuboot_subimage'
[7/199] No download step for 'spm_subimage'
[8/199] No update step for 'spm_subimage'
[9/199] No update step for 'mcuboot_subimage'
[10/199] No patch step for 'spm_subimage'
[11/199] No patch step for 'mcuboot_subimage'
[12/199] No configure step for 'spm_subimage'
[12/199] Performing build step for 'spm_subimage'
[1/268] Preparing syscall dependency handling
[2/268] Generating include/generated/version.h
-- Zephyr version: 3.0.99 (/opt/nordic/ncs/v2.0.2/zephyr), build: v3.0.99-ncs1-1
[3/268] Generating misc/generated/syscalls_subdirs.trigger
[4/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/psa_crypto_slot_management.c.obj
[5/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/psa_crypto.c.obj
[6/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/psa_crypto_aead.c.obj
[7/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/psa_crypto_cipher.c.obj
[8/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/psa_crypto_client.c.obj
[9/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/psa_crypto_hash.c.obj
[10/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/psa_crypto_ecp.c.obj
[11/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/psa_crypto_mac.c.obj
[12/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/psa_crypto_rsa.c.obj
[13/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/psa_crypto_storage.c.obj
[14/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/psa_crypto_driver_wrappers.c.obj
[15/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/pkcs12.c.obj
[16/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/pkwrite.c.obj
[17/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/random_ext.c.obj
[18/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/pem.c.obj
[19/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/pkcs5.c.obj
[20/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/pkparse.c.obj
[21/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/dhm.c.obj
[22/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/cipher.c.obj
[23/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/cipher_wrap.c.obj
[24/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/md.c.obj
[25/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/pk.c.obj
[26/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/pk_wrap.c.obj
[27/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/sha1.c.obj
[28/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/sha256.c.obj
[29/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/sha512.c.obj
[30/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/ripemd160.c.obj
[31/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/md5.c.obj
[32/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/aesni.c.obj
[33/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/aria.c.obj
[34/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/camellia.c.obj
[35/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/des.c.obj
[36/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/cmac.c.obj
[37/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/ccm.c.obj
[38/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/chachapoly.c.obj
[39/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/ecdh.c.obj
[40/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/ecdsa.c.obj
[41/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/gcm.c.obj
[42/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/ecp_curves.c.obj
[43/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/hkdf.c.obj
[44/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/ecp.c.obj
[45/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/hmac_drbg.c.obj
[46/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/rsa.c.obj
[47/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/rsa_alt_helpers.c.obj
[48/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/chacha20.c.obj
[49/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/poly1305.c.obj
[50/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/legacy/aes.c.obj
[51/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/opt/nordic/ncs/v2.0.2/mbedtls/library/ecjpake.c.obj
[52/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/legacy/aes_oberon.c.obj
[53/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedcrypto.dir/legacy/ecjpake_oberon.c.obj
[54/268] Building C object modules/nrfxlib/nrfxlib/nrf_security/src/CMakeFiles/mbedx509.dir/opt/nordic/ncs/v
...