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

TZ_NONSECURE_FUNC_PTR_CREATE SPM error with v1.0.0 for nRF9160

Hello,

I have seen today that the new releases of the v1.0.0 SDK and v1.0.0 modem firmware were release for the nRF9160 DK. I have been able to update the modem firmware but I'm coming across an error with the SDK.

MichaelDs-MacBook-Pro:nrf9160 michaeldavidson$ cd at_client/
MichaelDs-MacBook-Pro:at_client michaeldavidson$ mkdir build && cd build
MichaelDs-MacBook-Pro:build michaeldavidson$ cmake -GNinja -DBOARD=nrf9160_pca10090ns ..
-- Using application from '/Users/michaeldavidson/Downloads/ncs/nrf/samples/nrf9160/at_client'
Zephyr version: 1.14.99
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.6.4", minimum required is "3.4") 
-- Selected BOARD nrf9160_pca10090ns
-- Found west: /usr/local/bin/west (found suitable version "0.5.8", minimum required is "0.5.6")
-- Cache files will be written to: /Users/michaeldavidson/Library/Caches/zephyr
-- Loading /Users/michaeldavidson/Downloads/ncs/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090ns.dts as base
-- Overlaying /Users/michaeldavidson/Downloads/ncs/zephyr/dts/common/common.dts
Parsing Kconfig tree in /Users/michaeldavidson/Downloads/ncs/zephyr/Kconfig
Loading /Users/michaeldavidson/Downloads/ncs/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090ns_defconfig as base
Merging /Users/michaeldavidson/Downloads/ncs/nrf/samples/nrf9160/at_client/prj.conf
Configuration written to '/Users/michaeldavidson/Downloads/ncs/nrf/samples/nrf9160/at_client/build/zephyr/.config'
-- The C compiler identification is GNU 6.3.1
-- The CXX compiler identification is GNU 6.3.1
-- The ASM compiler identification is GNU
-- Found assembler: /Users/michaeldavidson/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc
-- Performing Test toolchain_is_ok
-- Performing Test toolchain_is_ok - Success
Including module: nrf in path: /Users/michaeldavidson/Downloads/ncs/nrf
-- Using application from '/Users/michaeldavidson/Downloads/ncs/nrf/samples/nrf9160/spm'
Zephyr version: 1.14.99
Changed board to secure nrf9160_pca10090 (NOT NS)
-- Loading /Users/michaeldavidson/Downloads/ncs/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090.dts as base
-- Overlaying /Users/michaeldavidson/Downloads/ncs/zephyr/dts/common/common.dts
-- Overlaying /Users/michaeldavidson/Downloads/ncs/nrf/samples/nrf9160/spm/nrf9160_pca10090.overlay
Parsing Kconfig tree in /Users/michaeldavidson/Downloads/ncs/zephyr/Kconfig
Loading /Users/michaeldavidson/Downloads/ncs/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090_defconfig as base
Merging /Users/michaeldavidson/Downloads/ncs/nrf/samples/nrf9160/spm/prj.conf
Configuration written to '/Users/michaeldavidson/Downloads/ncs/nrf/samples/nrf9160/at_client/build/spm/zephyr/.config'
Including module: nrf in path: /Users/michaeldavidson/Downloads/ncs/nrf
Including module: nffs in path: /Users/michaeldavidson/Downloads/ncs/modules/fs/nffs
Including module: segger in path: /Users/michaeldavidson/Downloads/ncs/modules/debug/segger
Including module: mcuboot in path: /Users/michaeldavidson/Downloads/ncs/mcuboot/zephyr
Including module: mcumgr in path: /Users/michaeldavidson/Downloads/ncs/modules/lib/mcumgr
Including module: tinycbor in path: /Users/michaeldavidson/Downloads/ncs/modules/lib/tinycbor
Including module: nrfxlib in path: /Users/michaeldavidson/Downloads/ncs/nrfxlib
Including module: nffs in path: /Users/michaeldavidson/Downloads/ncs/modules/fs/nffs
Including module: segger in path: /Users/michaeldavidson/Downloads/ncs/modules/debug/segger
Including module: mcuboot in path: /Users/michaeldavidson/Downloads/ncs/mcuboot/zephyr
Including module: mcumgr in path: /Users/michaeldavidson/Downloads/ncs/modules/lib/mcumgr
Including module: tinycbor in path: /Users/michaeldavidson/Downloads/ncs/modules/lib/tinycbor
Including module: nrfxlib in path: /Users/michaeldavidson/Downloads/ncs/nrfxlib
CMake Warning at /Users/michaeldavidson/Downloads/ncs/zephyr/CMakeLists.txt:1345 (message):
  

        ------------------------------------------------------------
        --- WARNING:  __ASSERT() statements are globally ENABLED ---
        --- The kernel will run more slowly and use more memory  ---
        ------------------------------------------------------------


Running Partition Manager...
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/michaeldavidson/Downloads/ncs/nrf/samples/nrf9160/at_client/build
MichaelDs-MacBook-Pro:build michaeldavidson$ ninja flash
[1/310] Preparing syscall dependency handling

[2/310] Preparing syscall dependency handling

[60/310] Building C object spm/zephyr/CMakeFiles/spm_...ichaeldavidson/Downloads/ncs/nrf/subsys/spm/spm.c.ob
FAILED: spm/zephyr/CMakeFiles/spm_zephyr.dir/Users/michaeldavidson/Downloads/ncs/nrf/subsys/spm/spm.c.obj 
ccache /Users/michaeldavidson/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc -DBUILD_VERSION=v1.14.99-ncs2 -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DNRF9160_XXAA -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=2 -D__ZEPHYR__=1 -I/Users/michaeldavidson/Downloads/ncs/zephyr/kernel/include -I/Users/michaeldavidson/Downloads/ncs/zephyr/arch/arm/include -I/Users/michaeldavidson/Downloads/ncs/zephyr/include -I/Users/michaeldavidson/Downloads/ncs/zephyr/include/drivers -Ispm/zephyr/include/generated -I/Users/michaeldavidson/Downloads/ncs/zephyr/soc/arm/nordic_nrf/nrf91 -I/Users/michaeldavidson/Downloads/ncs/zephyr/soc/arm/nordic_nrf/include -I/Users/michaeldavidson/Downloads/ncs/zephyr/lib/libc/minimal/include -I/Users/michaeldavidson/Downloads/ncs/zephyr/ext/hal/cmsis/Include -I/Users/michaeldavidson/Downloads/ncs/zephyr/ext/hal/nordic/nrfx -I/Users/michaeldavidson/Downloads/ncs/zephyr/ext/hal/nordic/nrfx/drivers/include -I/Users/michaeldavidson/Downloads/ncs/zephyr/ext/hal/nordic/nrfx/hal -I/Users/michaeldavidson/Downloads/ncs/zephyr/ext/hal/nordic/nrfx/mdk -I/Users/michaeldavidson/Downloads/ncs/zephyr/ext/hal/nordic/. -I/Users/michaeldavidson/Downloads/ncs/nrf/include -I/Users/michaeldavidson/Downloads/ncs/nrfxlib/crypto/nrf_cc310_mbedcrypto/include/mbedtls -Ispm/zephyr/modules/nrfxlib/nrf_security/include -I/Users/michaeldavidson/Downloads/ncs/mbedtls/include -I/Users/michaeldavidson/Downloads/ncs/mbedtls/include/mbedtls -isystem /Users/michaeldavidson/gcc-arm-none-eabi-6-2017-q2-update/bin/../lib/gcc/arm-none-eabi/6.3.1/include -isystem /Users/michaeldavidson/gcc-arm-none-eabi-6-2017-q2-update/bin/../lib/gcc/arm-none-eabi/6.3.1/include-fixed -Os -nostdinc -g -imacros /Users/michaeldavidson/Downloads/ncs/nrf/samples/nrf9160/at_client/build/spm/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -mthumb -mcpu=cortex-m33 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -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 -ffunction-sections -fdata-sections -mabi=aapcs -march=armv8-m.main+dsp -mcmse -std=c99 -MD -MT spm/zephyr/CMakeFiles/spm_zephyr.dir/Users/michaeldavidson/Downloads/ncs/nrf/subsys/spm/spm.c.obj -MF spm/zephyr/CMakeFiles/spm_zephyr.dir/Users/michaeldavidson/Downloads/ncs/nrf/subsys/spm/spm.c.obj.d -o spm/zephyr/CMakeFiles/spm_zephyr.dir/Users/michaeldavidson/Downloads/ncs/nrf/subsys/spm/spm.c.obj   -c /Users/michaeldavidson/Downloads/ncs/nrf/subsys/spm/spm.c
In file included from /Users/michaeldavidson/Downloads/ncs/nrf/subsys/spm/spm.c:20:0:
/Users/michaeldavidson/Downloads/ncs/nrf/subsys/spm/spm.c: In function 'spm_jump':
/Users/michaeldavidson/Downloads/ncs/zephyr/arch/arm/include/cortex_m/tz.h:319:22: error: called object is not a function or function pointer
  ((tz_ns_func_ptr_t)(cmse_nsfptr_create(fptr)))
                      ^
/Users/michaeldavidson/Downloads/ncs/nrf/subsys/spm/spm.c:392:13: note: in expansion of macro 'TZ_NONSECURE_FUNC_PTR_CREATE'
  reset_ns = TZ_NONSECURE_FUNC_PTR_CREATE(vtor_ns[1]);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[65/310] Building C object spm/zephyr/arch/arm/core/c...eFiles/spm_arch__arm__core__cortex_m.dir/prep_c.c.ob
ninja: build stopped: subcommand failed.
MichaelDs-MacBook-Pro:build michaeldavidson$ 

Every time I try to build I get an error from the SPM code about about TZ_NONSECURE_FUNC_PTR_CREATE. This error occurs no matter what the code I try to build, be that my own custom application, SPM itself or any of the example programs.

I had orginally updated my ncs folder with my custom additions but this occurred after I updated. I then renamed that ncs_backup and did a fresh install in a new ncs folder of the repos using the instructions in 'Getting Started' and the same issue occurs.

Parents
  • I had to change toolchain versions when I updated to v1.0.0.  I was getting the same error when using "gcc-arm-none-eabi-8-2018-q4-major" as the toolchain.  The "nRF Connect v3.0.0 -Getting Started Assistant" app was updated at some point, and the toolchain it says to install is now "gcc-arm-none-eabi-7-2018-q2-update".  When I switched to that it started working.  Though all of this is on Linux, the toolchain world may be different for mac.

    I think Arm added handling for a new intrinsic related to the TrustZone stuff.

Reply
  • I had to change toolchain versions when I updated to v1.0.0.  I was getting the same error when using "gcc-arm-none-eabi-8-2018-q4-major" as the toolchain.  The "nRF Connect v3.0.0 -Getting Started Assistant" app was updated at some point, and the toolchain it says to install is now "gcc-arm-none-eabi-7-2018-q2-update".  When I switched to that it started working.  Though all of this is on Linux, the toolchain world may be different for mac.

    I think Arm added handling for a new intrinsic related to the TrustZone stuff.

Children
Related