NCS 2.0.2: TFM+PSA+MBEDTLS bootloop

Hi,

I want to use a setup as desctibed in the title, but I constantly get a bootloop.

I have a nrf9160dk >=0.14 (it has the ext flash at least) and I took the tfm_ipc sample and slowly modified it, to get to my target application that I need to have. This includes the crypto stuff, but also things like enabling mcuboot and using the ext flash as a secondary partition (for this use, I have already modified my SDK according to : https://github.com/nrfconnect/sdk-nrf/pull/8363 )

I want to use MBEDTLS from the ns image with the PSA api and C3xx drivers for hardware accelerated cryptography. 

To save space, I want everything that is not needed in my application disabled, PSA wise. I now encounter a bootloop though and cannot enter in my application main(). I cannot testwise enable every PSA option, because then it doesn't fit into the FLASH. My hunch is, that one driver might need to be enabled, but I have no clue which.

Right now my prj.conf looks as follows, and I have attached my example program:

CONFIG_BUILD_WITH_TFM=y
CONFIG_TFM_PROFILE_TYPE_NOT_SET=y
CONFIG_TFM_IPC=y
CONFIG_REBOOT=y

# The Zephyr CMSIS emulation assumes that ticks are ms, currently
### CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000

CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=4096

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

# Log
CONFIG_USE_SEGGER_RTT=n
CONFIG_RTT_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_LOG=n
CONFIG_CONSOLE=n
CONFIG_LOG_BACKEND_UART=n
CONFIG_LOG_BACKEND_RTT=n
CONFIG_CONSOLE_HANDLER=n
CONFIG_BOOT_BANNER=n
CONFIG_STDOUT_CONSOLE=n

# Kernel config
CONFIG_MAIN_THREAD_PRIORITY=0
CONFIG_SYSTEM_WORKQUEUE_PRIORITY=-1
CONFIG_POLL=n

CONFIG_COMPILER_OPT="-Og"

CONFIG_TFM_LOG_LEVEL_SILENCE=y
CONFIG_TFM_PARTITION_AUDIT_LOG=n

CONFIG_TFM_BL2=n
## CONFIG_PM_PARTITION_SIZE_BL2=0x0

CONFIG_MBEDTLS_LIBRARY_NRF_SECURITY=y
CONFIG_MBEDTLS_USE_PSA_CRYPTO=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y

CONFIG_TFM_PROFILE_TYPE_NOT_SET=y
CONFIG_TFM_PROFILE_TYPE_MINIMAL=n
CONFIG_TFM_PROFILE_TYPE_SMALL=n
CONFIG_TFM_PROFILE_TYPE_MEDIUM=n
CONFIG_TFM_PROFILE_TYPE_LARGE=n

CONFIG_NRF_SECURITY=y
CONFIG_NRF_SECURITY_ADVANCED=y
CONFIG_PSA_CRYPTO_DRIVER_CC3XX=y

CONFIG_PSA_WANT_ALG_CBC_NO_PADDING=n
CONFIG_PSA_WANT_ALG_CBC_PKCS7=n
CONFIG_PSA_WANT_ALG_CFB=n
CONFIG_PSA_WANT_ALG_OFB=n

CONFIG_PSA_WANT_ALG_CTR=y
CONFIG_PSA_CRYPTO_DRIVER_ALG_CTR_CC3XX=y

CONFIG_PSA_WANT_ALG_ECB_NO_PADDING=y
CONFIG_PSA_CRYPTO_DRIVER_ALG_ECB_NO_PADDING_CC3XX=y

CONFIG_PSA_WANT_ALG_CMAC=n
CONFIG_PSA_WANT_ALG_HMAC=n
CONFIG_PSA_WANT_ALG_CCM=n
CONFIG_PSA_WANT_ALG_GCM=n
CONFIG_PSA_WANT_ALG_CHACHA20_POLY1305=n

CONFIG_PSA_WANT_ALG_ECDH=n
CONFIG_PSA_WANT_ALG_ECDSA=n

CONFIG_PSA_WANT_ALG_DETERMINISTIC_ECDSA=n
CONFIG_PSA_WANT_ECC_BRAINPOOL_P_R1_256=n
CONFIG_PSA_WANT_ECC_BRAINPOOL_P_R1_384=n
CONFIG_PSA_WANT_ECC_BRAINPOOL_P_R1_512=n
CONFIG_PSA_WANT_ECC_MONTGOMERY_255=n
CONFIG_PSA_WANT_ECC_MONTGOMERY_448=n
CONFIG_PSA_WANT_ECC_SECP_K1_192=n
CONFIG_PSA_WANT_ECC_SECP_K1_256=n
CONFIG_PSA_WANT_ECC_SECP_R1_192=n

CONFIG_PSA_WANT_ECC_SECP_R1_224=n
CONFIG_PSA_CRYPTO_DRIVER_ECC_SECP_R1_224_CC3XX=y

CONFIG_PSA_WANT_ECC_SECP_R1_256=n
CONFIG_PSA_WANT_ECC_SECP_R1_384=n
CONFIG_PSA_WANT_ECC_SECP_R1_521=n
CONFIG_PSA_WANT_ALG_RSA_OAEP=n
CONFIG_PSA_WANT_ALG_RSA_PKCS1V15_CRYPT=n
CONFIG_PSA_WANT_ALG_RSA_PSS=n

CONFIG_PSA_WANT_ALG_SHA_224=y
CONFIG_PSA_CRYPTO_DRIVER_ALG_SHA_224_CC3XX=y
CONFIG_PSA_WANT_ALG_SHA_256=y
CONFIG_PSA_CRYPTO_DRIVER_ALG_SHA_256_CC3XX=y
 
CONFIG_PSA_WANT_ALG_SHA_512=y
CONFIG_PSA_CRYPTO_DRIVER_ALG_SHA_512_OBERON=y

CONFIG_PSA_WANT_ALG_SHA_1=n
CONFIG_PSA_WANT_ALG_SHA_384=n

tfm_ipc_modified.zip

Parents
  • It sounds to me that you have an assert somewhere and the code continously assert, reset and start over. To get more information about the assert you can add the following to the prj.conf of the application and child images you are working on:

    --- Add to prj.conf:

    # add asserts
    CONFIG_ASSERT=y
    CONFIG_ASSERT_VERBOSE=y
    CONFIG_ASSERT_NO_COND_INFO=n
    CONFIG_ASSERT_NO_MSG_INFO=n
    CONFIG_RESET_ON_FATAL_ERROR=n
    CONFIG_THREAD_NAME=y
    CONFIG_ARM_MPU=y

    To get information about the assert you will need to enable logging over rtt or serial interface.

    Best regards,
    Kenneth

Reply
  • It sounds to me that you have an assert somewhere and the code continously assert, reset and start over. To get more information about the assert you can add the following to the prj.conf of the application and child images you are working on:

    --- Add to prj.conf:

    # add asserts
    CONFIG_ASSERT=y
    CONFIG_ASSERT_VERBOSE=y
    CONFIG_ASSERT_NO_COND_INFO=n
    CONFIG_ASSERT_NO_MSG_INFO=n
    CONFIG_RESET_ON_FATAL_ERROR=n
    CONFIG_THREAD_NAME=y
    CONFIG_ARM_MPU=y

    To get information about the assert you will need to enable logging over rtt or serial interface.

    Best regards,
    Kenneth

Children
Related