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
  • Hi,

     

    There seems to be two issues that might be related in this thread:

    1. TrustZone defines not working with GCC 6 or GCC 8. We are aware of this, and it is reported internally, but for now; please use GCC 7 (2018-Q2). GCC 8 has had other issues, like linking errors on the windows platform, so it has been ruled out for now.

    2. nrfjprog v10.1.1 has an issue where it does not properly do a sectorerase on nRF9160 in certain corners (which ninja/west calls in the background). This should be fixed with the latest version v10.2.1, available for download here: https://www.nordicsemi.com/?sc_itemid=%7B56868165-9553-444D-AA57-15BDE1BF6B49%7D

     

    Could you see if these two items resolve the issues seen in this thread?

     

    Kind regards,

    Håkon

  • Hi again Håkon,

    Thanks for the information.

    1. This seems to have solved the issue. Funnily enough, I actually had that version of the GCC compiler on my mac in case it was ever needed for this occurance.

    2. I was running the 10.2.1 version of nrfjprog as I updated everything yesterday to get the modem firmware onto the DK.

    I can now report that the FW build and flashes onto the device correctly for me now with the GCC compiler change.

    ***** Booting Zephyr OS v1.14.99-ncs2 *****
    Flash region		Domain		Permissions
    00 0x00000 0x08000 	Secure		rwxl
    01 0x08000 0x10000 	Non-Secure	rwxl
    02 0x10000 0x18000 	Non-Secure	rwxl
    03 0x18000 0x20000 	Non-Secure	rwxl
    04 0x20000 0x28000 	Non-Secure	rwxl
    05 0x28000 0x30000 	Non-Secure	rwxl
    06 0x30000 0x38000 	Non-Secure	rwxl
    07 0x38000 0x40000 	Non-Secure	rwxl
    08 0x40000 0x48000 	Non-Secure	rwxl
    09 0x48000 0x50000 	Non-Secure	rwxl
    10 0x50000 0x58000 	Non-Secure	rwxl
    11 0x58000 0x60000 	Non-Secure	rwxl
    12 0x60000 0x68000 	Non-Secure	rwxl
    13 0x68000 0x70000 	Non-Secure	rwxl
    14 0x70000 0x78000 	Non-Secure	rwxl
    15 0x78000 0x80000 	Non-Secure	rwxl
    16 0x80000 0x88000 	Non-Secure	rwxl
    17 0x88000 0x90000 	Non-Secure	rwxl
    18 0x90000 0x98000 	Non-Secure	rwxl
    19 0x98000 0xa0000 	Non-Secure	rwxl
    20 0xa0000 0xa8000 	Non-Secure	rwxl
    21 0xa8000 0xb0000 	Non-Secure	rwxl
    22 0xb0000 0xb8000 	Non-Secure	rwxl
    23 0xb8000 0xc0000 	Non-Secure	rwxl
    24 0xc0000 0xc8000 	Non-Secure	rwxl
    25 0xc8000 0xd0000 	Non-Secure	rwxl
    26 0xd0000 0xd8000 	Non-Secure	rwxl
    27 0xd8000 0xe0000 	Non-Secure	rwxl
    28 0xe0000 0xe8000 	Non-Secure	rwxl
    29 0xe8000 0xf0000 	Non-Secure	rwxl
    30 0xf0000 0xf8000 	Non-Secure	rwxl
    31 0xf8000 0x100000 	Non-Secure	rwxl
    Non-secure callable region 0 placed in flash region 0 with size 32.
    
    
    SRAM region		Domain		Permissions
    00 0x00000 0x02000	Secure		rwxl
    01 0x02000 0x04000	Secure		rwxl
    02 0x04000 0x06000	Secure		rwxl
    03 0x06000 0x08000	Secure		rwxl
    04 0x08000 0x0a000	Secure		rwxl
    05 0x0a000 0x0c000	Secure		rwxl
    06 0x0c000 0x0e000	Secure		rwxl
    07 0x0e000 0x10000	Secure		rwxl
    08 0x10000 0x12000	Non-Secure	rwxl
    09 0x12000 0x14000	Non-Secure	rwxl
    10 0x14000 0x16000	Non-Secure	rwxl
    11 0x16000 0x18000	Non-Secure	rwxl
    12 0x18000 0x1a000	Non-Secure	rwxl
    13 0x1a000 0x1c000	Non-Secure	rwxl
    14 0x1c000 0x1e000	Non-Secure	rwxl
    15 0x1e000 0x20000	Non-Secure	rwxl
    16 0x20000 0x22000	Non-Secure	rwxl
    17 0x22000 0x24000	Non-Secure	rwxl
    18 0x24000 0x26000	Non-Secure	rwxl
    19 0x26000 0x28000	Non-Secure	rwxl
    20 0x28000 0x2a000	Non-Secure	rwxl
    21 0x2a000 0x2c000	Non-Secure	rwxl
    22 0x2c000 0x2e000	Non-Secure	rwxl
    23 0x2e000 0x30000	Non-Secure	rwxl
    24 0x30000 0x32000	Non-Secure	rwxl
    25 0x32000 0x34000	Non-Secure	rwxl
    26 0x34000 0x36000	Non-Secure	rwxl
    27 0x36000 0x38000	Non-Secure	rwxl
    28 0x38000 0x3a000	Non-Secure	rwxl
    29 0x3a000 0x3c000	Non-Secure	rwxl
    30 0x3c000 0x3e000	Non-Secure	rwxl
    31 0x3e000 0x40000	Non-Secure	rwxl
    
    Peripheral		Domain		Status
    00 NRF_P0		Non-Secure	OK
    01 NRF_CLOCK		Non-Secure	OK
    02 NRF_RTC1		Non-Secure	OK
    03 NRF_NVMC		Non-Secure	OK
    04 NRF_UARTE1		Non-Secure	OK
    05 NRF_UARTE2		Secure		SKIP
    06 NRF_TWIM2		Non-Secure	OK
    07 NRF_SPIM3		Non-Secure	OK
    08 NRF_TIMER0		Non-Secure	OK
    09 NRF_TIMER1		Non-Secure	OK
    10 NRF_TIMER2		Non-Secure	OK
    11 NRF_SAADC		Non-Secure	OK
    12 NRF_PWM0		Non-Secure	OK
    13 NRF_PWM1		Non-Secure	OK
    14 NRF_PWM2		Non-Secure	OK
    15 NRF_PWM3		Non-Secure	OK
    16 NRF_IPC		Non-Secure	OK
    17 NRF_VMC		Non-Secure	OK
    18 NRF_FPU		Non-Secure	OK
    19 NRF_EGU1		Non-Secure	OK
    20 NRF_EGU2		Non-Secure	OK
    21 NRF_GPIOTE1		Non-Secure	OK
    
    SPM: NS image at 0xc000
    SPM: NS MSP at 0x20023b68
    SPM: NS reset vector at 0xe325
    SPM: prepare to jump to Non-Secure image.
    ***** Booting Zephyr OS v1.14.99-ncs2 *****
    The AT host sample started
    AT
    OK
    AT+CGMR
    mfw_nrf9160_1.0.0
    OK

    One question I have Håkon that isn't related to this but has us a little stumped.

    We have built up our first prototype for the nRF9160 but are not able to communicate to it. Both JLink and the nRF Programmer can't seem to detect the core.

    We have run a multi-meter around the board and everything seems to be getting supplied the power it needs as per the OPS guidleines. We have noticed that the NRESET line is 0V. From the OPS we know that there is an internal pull up resistor to VDD on the NRESET pin and from metering the DK we know that there is 2V on the reset button for the pca10090. Is the NRESET pin supplied with voltage from the moment the VDD line is supplied or does the NRESET line only get supplied Voltage after the core have been initialised with FW. Just trying to figure out if we have an issue with VDD being supplied with power as we can't see under the SiP.

  • Hi,

     

    Sorry to hear that your prototype is refusing to communicate!

    The nRESET signal will be kept low until the Power-on-reset (POR) logic internally releases it. This is normally some milliseconds after it has reached a valid voltage threshold, depending on the rise-time of your supply.

    Does the PCB draw any current from the battery?

    Have you checked the voltage level on the ENABLE pin?

     

    Kind regards,

    Håkon

  • Thanks for that information, so there isn't anything weird going on with NRESET, it must be something else on the board.

    We are supplying VDD with a regulated 3V3 battery supply that is within the tolerances of the VDD line.  ( we would like to keep 3V3 if possible as this would allow any device to remain active for longer before the battery supply voltage dips below 3.3V)

    Our prototype PCB draws a small current i.e. a few milliamps (10mA), and both the NRESET and ENABLE lines were my first thought as possible areas of concern. From our examination, the LDO is outputting 3.31V (so pretty good LDO) which the ENABLE Pin is receiving. The NRESET was 0V so I thought something was wrong there but if the internal logic isn't getting initialised this would be 0V.

Reply
  • Thanks for that information, so there isn't anything weird going on with NRESET, it must be something else on the board.

    We are supplying VDD with a regulated 3V3 battery supply that is within the tolerances of the VDD line.  ( we would like to keep 3V3 if possible as this would allow any device to remain active for longer before the battery supply voltage dips below 3.3V)

    Our prototype PCB draws a small current i.e. a few milliamps (10mA), and both the NRESET and ENABLE lines were my first thought as possible areas of concern. From our examination, the LDO is outputting 3.31V (so pretty good LDO) which the ENABLE Pin is receiving. The NRESET was 0V so I thought something was wrong there but if the internal logic isn't getting initialised this would be 0V.

Children
No Data
Related