Decrease rom footprint of TFM

Hi! I am trying to find the optimal configuration of TFM for our project with the nrf9160. I am using NCS 2.6.1. 

I want to be able to use the internal trusted storage and crypto operations preferably.

with this config:

#
# Copyright (c) 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#




# General
CONFIG_FPU=y
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y

CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_TFM_PROFILE_TYPE_NOT_SET=y
CONFIG_TFM_CMAKE_BUILD_TYPE_MINSIZEREL=y
CONFIG_TFM_PARTITION_PLATFORM=y
CONFIG_TFM_PARTITION_CRYPTO=y
# Adds 33000 bytes to flash
CONFIG_TFM_PARTITION_PROTECTED_STORAGE=n
CONFIG_TFM_PARTITION_INTERNAL_TRUSTED_STORAGE=y
CONFIG_TFM_PARTITION_INITIAL_ATTESTATION=n
CONFIG_TFM_SECURE_UART0=n
CONFIG_TFM_SECURE_UART=n
CONFIG_TFM_BL2=n

CONFIG_TFM_LOG_LEVEL_SILENCE=y
CONFIG_TFM_EXCEPTION_INFO_DUMP=y
CONFIG_TFM_ITS_STACK_SIZE=0x400
CONFIG_TFM_CRYPTO_PARTITION_STACK_SIZE=0x400

CONFIG_TFM_CRYPTO_CONC_OPER_NUM=4
CONFIG_TFM_CRYPTO_IOVEC_BUFFER_SIZE=2048
CONFIG_TFM_CRYPTO_ENGINE_BUF_SIZE=2048
CONFIG_ASSERT=n
CONFIG_ASSERT_VERBOSE=n

#Lowers ram by 1KB
#CONFIG_TFM_CRYPTO_RNG_MODULE_ENABLED=n
#Lowers ram by 2KB
#CONFIG_TFM_CRYPTO_BUILTIN_KEYS=n
# does not affect memory
#CONFIG_TFM_PLATFORM_NV_COUNTER_MODULE_DISABLED=y
#CONFIG_TFM_CRYPTO_SINGLE_PART_FUNCS_DISABLED=y

CONFIG_NRF_SECURITY=y
CONFIG_PSA_CRYPTO_DRIVER_CC3XX=y
CONFIG_PSA_CRYPTO_DRIVER_OBERON=n

# Entropy 
CONFIG_ENTROPY_GENERATOR=y
# Enable AES
CONFIG_PSA_WANT_KEY_TYPE_AES=y
CONFIG_PSA_WANT_AES_KEY_SIZE_128=y
# Enable ECB
CONFIG_PSA_WANT_ALG_ECB_NO_PADDING=y

# CTR_DRBG for random
CONFIG_MBEDTLS_CTR_DRBG_C=y
CONFIG_MBEDTLS_HMAC_DRBG_C=n

# Disable EVERYTHING else in crypto
CONFIG_MBEDTLS_ECJPAKE_C=n
CONFIG_PSA_WANT_ALG_JPAKE=n
CONFIG_MBEDTLS_MD_C=n
CONFIG_MBEDTLS_HKDF_C=n
CONFIG_PSA_WANT_ALG_CBC_MAC=n
CONFIG_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR=n
CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY=n
CONFIG_PSA_WANT_KEY_TYPE_HMAC=n
CONFIG_PSA_WANT_KEY_TYPE_DERIVE=n
CONFIG_PSA_WANT_ALG_CBC_NO_PADDING=n
CONFIG_PSA_WANT_ALG_GCM=n
CONFIG_PSA_WANT_ALG_CCM=n
CONFIG_PSA_WANT_ALG_CFB=n
CONFIG_PSA_WANT_ALG_OFB=n
CONFIG_PSA_WANT_ALG_XTS=n
CONFIG_PSA_WANT_ALG_CMAC=n
CONFIG_PSA_WANT_ALG_SHA_1=n
CONFIG_PSA_WANT_ALG_SHA_224=n
CONFIG_PSA_WANT_ALG_SHA_384=n
CONFIG_PSA_WANT_ALG_SHA_512=n
CONFIG_PSA_WANT_ALG_RIPEMD160=n
CONFIG_PSA_WANT_ALG_MD5=n
CONFIG_PSA_WANT_ALG_RSA_PKCS1V15_SIGN=n
CONFIG_PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW=n
CONFIG_PSA_WANT_ALG_RSA_PSS=n
CONFIG_PSA_WANT_ALG_RSA_OAEP=n
CONFIG_PSA_WANT_ALG_RSA_PKCS1V15_CRYPT=n
CONFIG_PSA_WANT_ALG_ECDSA=n
CONFIG_PSA_WANT_ALG_DETERMINISTIC_ECDSA=n
CONFIG_PSA_WANT_ALG_ECDH=n
CONFIG_PSA_WANT_ALG_FFDH=n
CONFIG_PSA_WANT_ALG_STREAM_CIPHER=n
CONFIG_PSA_WANT_KEY_TYPE_RAW_DATA=n
CONFIG_PSA_WANT_ALG_TLS12_PSK_TO_MS=n
CONFIG_PSA_WANT_ALG_TLS12_PRF=n
CONFIG_PSA_WANT_KEY_TYPE_CHACHA20=n
CONFIG_PSA_WANT_ALG_CHACHA20_POLY1305=n
CONFIG_PSA_WANT_KEY_TYPE_RSA_KEY_PAIR=n
CONFIG_PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY=n
CONFIG_PSA_WANT_KEY_TYPE_DH_KEY_PAIR=n
CONFIG_PSA_WANT_KEY_TYPE_DH_PUBLIC_KEY=n

# Disable mbedTLS features
CONFIG_MBEDTLS_CIPHER=n
CONFIG_MBEDTLS_CIPHER_MODE_CBC=n
CONFIG_MBEDTLS_GCM_C=n
CONFIG_MBEDTLS_CCM_C=n
CONFIG_MBEDTLS_CHACHA20_C=n
CONFIG_MBEDTLS_POLY1305_C=n
CONFIG_MBEDTLS_CHACHAPOLY_C=n
CONFIG_MBEDTLS_ECP_C=n
CONFIG_MBEDTLS_ECDH_C=n
CONFIG_MBEDTLS_ECDSA_C=n
CONFIG_MBEDTLS_DHM_C=n
CONFIG_MBEDTLS_RSA_C=n
CONFIG_MBEDTLS_PKCS1_V15=n
CONFIG_MBEDTLS_PKCS1_V21=n


i get this when building the tfm hello world sample: 

[39/43] Linking C executable bin/tfm_s.axf
Memory region         Used Size  Region Size  %age Used
           FLASH:       64360 B      97792 B     65.81%
             RAM:       21684 B        32 KB     66.17%


Rom report:
Memory region         Used Size  Region Size  %age Used
           FLASH:       64360 B      97792 B     65.81%
             RAM:       21684 B        32 KB     66.17%
[43/43] Linking C static library secure_fw/libtfm_s_veneers.a
[1/2] cd 'build && ncs/toolchains/2be090971e/usr/loc....1/zephyr -o build --workspace=ncs/v2.6.1 -d 99 rom
Path                                                                                             Size    %  
==============================================================================================================
Root                                                                                            62368 100.00%
├── (hidden)                                                                                     3224   5.17%
├── (no paths)                                                                                  23032  36.93%
│   ├── CCAsymCryptoMutex                                                                           4   0.01%
│   ├── CCPowerMutex                                                                                4   0.01%
│   ├── CCRndCryptoMutex                                                                            4   0.01%
│   ├── CCSymCryptoMutex                                                                            4   0.01%
│   ├── CC_HalClearInterruptBit                                                                    28   0.04%
│   ├── CC_HalInit                                                                                  4   0.01%
│   ├── CC_HalMaskInterrupt                                                                        12   0.02%
│   ├── CC_HalTerminate                                                                             4   0.01%
│   ├── CC_HalWaitInterrupt                                                                        12   0.02%
│   ├── CC_HalWaitInterruptRND                                                                     12   0.02%
│   ├── CC_LibInit                                                                                192   0.31%
│   ├── CC_PalAbort                                                                                52   0.08%
│   ├── CC_PalDataBufferAttrGet                                                                     6   0.01%
│   ├── CC_PalDmaInit                                                                               4   0.01%
│   ├── CC_PalDmaTerminate                                                                          2   0.00%
│   ├── CC_PalInit                                                                                 92   0.15%
│   ├── CC_PalMemCmpPlat                                                                            4   0.01%
│   ├── CC_PalMemCopyPlat                                                                           4   0.01%
│   ├── CC_PalMemSetPlat                                                                            4   0.01%
│   ├── CC_PalMemSetZeroPlat                                                                        8   0.01%
│   ├── CC_PalMutexCreate                                                                          20   0.03%
│   ├── CC_PalMutexDestroy                                                                         20   0.03%
│   ├── CC_PalMutexLock                                                                            16   0.03%
│   ├── CC_PalMutexUnlock                                                                          20   0.03%
│   ├── CC_PalPowerSaveModeInit                                                                    60   0.10%
│   ├── CC_PalPowerSaveModeSelect                                                                 132   0.21%
│   ├── CC_PalTerminate                                                                            52   0.08%
│   ├── CC_PalTrngParamGet                                                                        276   0.44%
│   ├── CC_PalWaitInterrupt                                                                        24   0.04%
│   ├── CC_PalWaitInterruptRND                                                                     44   0.07%
│   ├── CSWTCH.10                                                                                  28   0.04%
│   ├── CSWTCH.433                                                                                 18   0.03%
│   ├── CSWTCH.45                                                                                  64   0.10%
│   ├── CSWTCH.49                                                                                  12   0.02%
│   ├── CSWTCH.542                                                                                 36   0.06%
│   ├── C_BusFault_Handler                                                                          4   0.01%
│   ├── C_MemManage_Handler                                                                         4   0.01%
│   ├── C_SecureFault_Handler                                                                       4   0.01%
│   ├── C_UsageFault_Handler                                                                        4   0.01%
│   ├── FinishAesDrv                                                                              596   0.96%
│   ├── FinishHashDrv                                                                             114   0.18%
│   ├── HASH_LARVAL_SHA1                                                                           20   0.03%
│   ├── HASH_LARVAL_SHA224                                                                         32   0.05%
│   ├── HASH_LARVAL_SHA256                                                                         32   0.05%
│   ├── InitAes.part.0                                                                            228   0.37%
│   ├── InitHashDrv                                                                                80   0.13%
│   ├── LLF_RND_AdaptiveProportionTest                                                            128   0.21%
│   ├── LLF_RND_GetFastestRosc                                                                     32   0.05%
│   ├── LLF_RND_GetRoscSampleCnt                                                                   52   0.08%
│   ├── LLF_RND_GetTrngSource                                                                      22   0.04%
│   ├── LLF_RND_RepetitionCounterTest                                                             100   0.16%
│   ├── LLF_RND_RunTrngStartupTest                                                                 28   0.04%
│   ├── LLF_RND_TurnOffTrng                                                                        24   0.04%
│   ├── LLF_RND_WaitRngInterrupt                                                                   32   0.05%
│   ├── LoadAesKey                                                                                232   0.37%
│   ├── ProcessAesDrv                                                                             872   1.40%
│   ├── ProcessChacha                                                                             692   1.11%
│   ├── ProcessHashDrv                                                                            556   0.89%
│   ├── RNG_PLAT_SetUserRngParameters                                                             116   0.19%
│   ├── RndStartupTest.constprop.0                                                                152   0.24%
│   ├── SetDataBuffersInfo                                                                        102   0.16%
│   ├── UtilCmacBuildDataForDerivation                                                            192   0.31%
│   ├── __Vectors                                                                                 324   0.52%
│   ├── __libc_init_array                                                                          72   0.12%
│   ├── _exit                                                                                       2   0.00%
│   ├── _global_impure_ptr                                                                          4   0.01%
│   ├── add_pkcs_padding                                                                          146   0.23%
│   ├── asym_mutex                                                                                  8   0.01%
│   ├── block_cipher_df                                                                           460   0.74%
│   ├── cc3xx_aes_crypt                                                                           120   0.19%
│   ├── cc3xx_aes_free                                                                             12   0.02%
│   ├── cc3xx_aes_init                                                                             28   0.04%
│   ├── cc3xx_aes_setkey_dec                                                                       62   0.10%
│   ├── cc3xx_aes_setkey_enc                                                                       60   0.10%
│   ├── cc3xx_chacha20_finish                                                                      16   0.03%
│   ├── cc3xx_chacha20_free                                                                        12   0.02%
│   ├── cc3xx_chacha20_init                                                                        30   0.05%
│   ├── cc3xx_chacha20_set_counter                                                                 28   0.04%
│   ├── cc3xx_chacha20_set_nonce                                                                   48   0.08%
│   ├── cc3xx_chacha20_setkey                                                                      32   0.05%
│   ├── cc3xx_chacha20_update                                                                     750   1.20%
│   ├── cc3xx_cipher_abort                                                                         52   0.08%
│   ├── cc3xx_cipher_decrypt                                                                      568   0.91%
│   ├── cc3xx_cipher_decrypt_setup                                                                340   0.55%
│   ├── cc3xx_cipher_encrypt                                                                      560   0.90%
│   ├── cc3xx_cipher_encrypt_setup                                                                340   0.55%
│   ├── cc3xx_cipher_finish                                                                       356   0.57%
│   ├── cc3xx_cipher_set_iv                                                                       100   0.16%
│   ├── cc3xx_cipher_update                                                                       460   0.74%
│   ├── cc3xx_hash_abort                                                                           22   0.04%
│   ├── cc3xx_hash_clone                                                                           28   0.04%
│   ├── cc3xx_hash_compute                                                                        504   0.81%
│   ├── cc3xx_hash_finish                                                                         222   0.36%
│   ├── cc3xx_hash_setup                                                                           80   0.13%
│   ├── cc3xx_hash_update                                                                         316   0.51%
│   ├── cc3xx_mac_abort                                                                            18   0.03%
│   ├── cc3xx_mac_compute                                                                         332   0.53%
│   ├── cc3xx_mac_sign_finish                                                                     288   0.46%
│   ├── cc3xx_mac_sign_setup                                                                        4   0.01%
│   ├── cc3xx_mac_update                                                                          260   0.42%
│   ├── cc3xx_mac_verify_finish                                                                   188   0.30%
│   ├── cc3xx_mac_verify_setup                                                                      4   0.01%
│   ├── cc_mbedtls_aes_crypt_ecb                                                                   78   0.13%
│   ├── cc_mbedtls_aes_free                                                                        12   0.02%
│   ├── cc_mbedtls_aes_init                                                                        32   0.05%
│   ├── cc_mbedtls_aes_setkey_enc                                                                  50   0.08%
│   ├── cc_mbedtls_ctr_drbg_free                                                                   52   0.08%
│   ├── cc_mbedtls_ctr_drbg_init                                                                   44   0.07%
│   ├── cc_mbedtls_ctr_drbg_random_with_add                                                       484   0.78%
│   ├── cc_mbedtls_ctr_drbg_seed                                                                  156   0.25%
│   ├── cc_mbedtls_entropy_free                                                                    56   0.09%
│   ├── cc_mbedtls_entropy_func                                                                   272   0.44%
│   ├── cc_mbedtls_entropy_init                                                                   132   0.21%
│   ├── cc_mbedtls_platform_zeroize                                                                20   0.03%
│   ├── cc_mbedtls_sha256                                                                          80   0.13%
│   ├── cc_mbedtls_sha256_finish                                                                   70   0.11%
│   ├── cc_mbedtls_sha256_free                                                                     10   0.02%
│   ├── cc_mbedtls_sha256_init                                                                     40   0.06%
│   ├── cc_mbedtls_sha256_starts                                                                   38   0.06%
│   ├── cc_mbedtls_sha256_update                                                                   82   0.13%
│   ├── cc_platform_cleanup_chacha_key                                                             60   0.10%
│   ├── cc_platform_load_chacha_key                                                               104   0.17%
│   ├── cc_platform_prepare_chacha_key                                                             74   0.12%
│   ├── cmse_check_address_range                                                                  198   0.32%
│   ├── ctr_drbg_update_internal                                                                  326   0.52%
│   ├── entropy_gather_internal.part.0                                                            134   0.21%
│   ├── entropy_update                                                                            124   0.20%
│   ├── exit                                                                                       40   0.06%
│   ├── getTrngSource                                                                             692   1.11%
│   ├── get_next_cached_crypt_state                                                               176   0.28%
│   ├── get_pkcs_padding                                                                           90   0.14%
│   ├── hash_update                                                                               208   0.33%
│   ├── hmac_finish                                                                               172   0.28%
│   ├── impure_data                                                                                96   0.15%
│   ├── init_cached_crypt_state                                                                   222   0.36%
│   ├── invalid_aes_256_bit_key                                                                     4   0.01%
│   ├── invalid_chacha_256_bit_key                                                                  4   0.01%
│   ├── its_flash_fs_ops_nor                                                                       20   0.03%
│   ├── kdr_pushed_slot                                                                             4   0.01%
│   ├── kmu_derive_cmac                                                                           376   0.60%
│   ├── kmu_load_key_aes                                                                          148   0.24%
│   ├── kmu_load_key_chacha20                                                                     336   0.54%
│   ├── kmu_shadow_key_derive                                                                     124   0.20%
│   ├── kmu_use_kdr_key                                                                            20   0.03%
│   ├── kmu_validate_kdr_slot_and_size                                                             72   0.12%
│   ├── kmu_validate_slot_and_size                                                                 44   0.07%
│   ├── kmu_validate_slot_and_size_no_kdr                                                         128   0.21%
│   ├── kmu_write_key_slot                                                                        276   0.44%
│   ├── mac_setup                                                                                1092   1.75%
│   ├── mbedtls_ctr_drbg_reseed_internal                                                          196   0.31%
│   ├── mbedtls_hardware_poll                                                                     252   0.40%
│   ├── mbedtls_mutex_free                                                                          4   0.01%
│   ├── mbedtls_mutex_init                                                                          4   0.01%
│   ├── mbedtls_mutex_lock                                                                          4   0.01%
│   ├── mbedtls_mutex_unlock                                                                        4   0.01%
│   ├── mbedtls_sha_finish_internal                                                                92   0.15%
│   ├── mbedtls_sha_starts_internal                                                                38   0.06%
│   ├── mbedtls_sha_update_internal                                                               492   0.79%
│   ├── mbedtls_zeroize_internal                                                                   20   0.03%
│   ├── memmove                                                                                    52   0.08%
│   ├── mutex_free                                                                                 64   0.10%
│   ├── mutex_init                                                                                 44   0.07%
│   ├── mutex_lock                                                                                 84   0.13%
│   ├── mutex_unlock                                                                               68   0.11%
│   ├── nrf_cc3xx_platform_abort                                                                   36   0.06%
│   ├── nrf_cc3xx_platform_ctr_drbg_free                                                           44   0.07%
│   ├── nrf_cc3xx_platform_ctr_drbg_get                                                            68   0.11%
│   ├── nrf_cc3xx_platform_ctr_drbg_init                                                           96   0.15%
│   ├── nrf_cc3xx_platform_init                                                                    68   0.11%
│   ├── nrf_cc3xx_platform_kmu_shadow_key_derive                                                    4   0.01%
│   ├── nrf_cc3xx_platform_kmu_write_key_slot                                                       4   0.01%
│   ├── ocrypto_aes_cbc_pkcs_init                                                                  64   0.10%
│   ├── ocrypto_aes_cbc_pkcs_output_size                                                           28   0.04%
│   ├── ocrypto_aes_cbc_pkcs_update                                                               526   0.84%
│   ├── pCCRndCryptoMutex                                                                           4   0.01%
│   ├── platform_abort_apis                                                                         8   0.01%
│   ├── platform_mutex_apis                                                                        16   0.03%
│   ├── platform_mutexes                                                                           20   0.03%
│   ├── power_mutex                                                                                 8   0.01%
│   ├── psa_driver_wrapper_free_random                                                              4   0.01%
│   ├── psa_driver_wrapper_init_random                                                              4   0.01%
│   ├── psa_driver_wrapper_key_agreement                                                           32   0.05%
│   ├── rng_mutex                                                                                   8   0.01%
│   ├── startTrngHW                                                                               320   0.51%
│   ├── sym_mutex                                                                                   8   0.01%
│   ├── target_peripherals.0                                                                       30   0.05%
│   ├── tfm_crypto_asymmetric_encrypt_interface                                                     6   0.01%
│   ├── tfm_psa_call_veneer                                                                         8   0.01%
│   ├── tfm_psa_close_veneer                                                                        8   0.01%
│   ├── tfm_psa_connect_veneer                                                                      8   0.01%
│   ├── tfm_psa_framework_version_veneer                                                            8   0.01%
│   ├── tfm_psa_version_veneer                                                                      8   0.01%
│   ├── write_invalid_chacha20_key                                                                 64   0.10%
│   └── write_invalid_key                                                                          48   0.08%
├── OUTPUT_DIR                                                                                    220   0.35%
│   └── tfm                                                                                       220   0.35%
│       └── generated                                                                             220   0.35%
│           └── secure_fw                                                                         220   0.35%
│               └── partitions                                                                    220   0.35%
│                   ├── crypto                                                                     76   0.12%
│                   │   └── auto_generated                                                         76   0.12%
│                   │       └── load_info_tfm_crypto.c                                             76   0.12%
│                   │           └── tfm_sp_crypto_load                                             76   0.12%
│                   ├── internal_trusted_storage                                                   72   0.12%
│                   │   └── auto_generated                                                         72   0.12%
│                   │       └── load_info_tfm_internal_trusted_storage.c                           72   0.12%
│                   │           └── tfm_sp_its_load                                                72   0.12%
│                   └── platform                                                                   72   0.12%
│                       └── auto_generated                                                         72   0.12%
│                           └── load_info_tfm_platform.c                                           72   0.12%
│                               └── tfm_sp_platform_load                                           72   0.12%
├── WORKSPACE                                                                                   35892  57.55%
│   ├── modules                                                                                 21372  34.27%
│   │   ├── crypto                                                                                726   1.16%
│   │   │   └── mbedtls                                                                           726   1.16%
│   │   │       └── library                                                                       726   1.16%
│   │   │           ├── constant_time.c                                                            26   0.04%
│   │   │           │   └── mbedtls_ct_memcmp                                                      26   0.04%
│   │   │           └── memory_buffer_alloc.c                                                     700   1.12%
│   │   │               ├── buffer_alloc_calloc                                                   244   0.39%
│   │   │               ├── buffer_alloc_free                                                     232   0.37%
│   │   │               ├── mbedtls_memory_buffer_alloc_init                                      100   0.16%
│   │   │               ├── verify_chain                                                           60   0.10%
│   │   │               └── verify_header                                                          64   0.10%
│   │   ├── hal                                                                                   778   1.25%
│   │   │   └── nordic                                                                            778   1.25%
│   │   │       └── nrfx                                                                          778   1.25%
│   │   │           ├── drivers                                                                   188   0.30%
│   │   │           │   ├── include                                                                28   0.04%
│   │   │           │   │   └── nrfx_nvmc.h                                                        28   0.04%
│   │   │           │   │       └── nrfx_nvmc_uicr_word_read                                       28   0.04%
│   │   │           │   └── src                                                                   160   0.26%
│   │   │           │       └── nrfx_nvmc.c                                                       160   0.26%
│   │   │           │           ├── nrfx_nvmc_page_erase                                           60   0.10%
│   │   │           │           ├── nrfx_nvmc_words_write                                          56   0.09%
│   │   │           │           ├── nvmc_readonly_mode_set                                         20   0.03%
│   │   │           │           └── nvmc_word_write                                                24   0.04%
│   │   │           └── mdk                                                                       590   0.95%
│   │   │               ├── nrf91_erratas.h                                                        66   0.11%
│   │   │               │   ├── nrf91_errata_14                                                    36   0.06%
│   │   │               │   └── nrf91_errata_6                                                     30   0.05%
│   │   │               └── system_nrf91.c                                                        524   0.84%
│   │   │                   ├── SystemInit                                                        400   0.64%
│   │   │                   ├── uicr_HFXOCNT_erased                                                64   0.10%
│   │   │                   └── uicr_HFXOSRC_erased                                                60   0.10%
│   │   └── tee                                                                                 19868  31.86%
│   │       └── tf-m                                                                            19868  31.86%
│   │           └── trusted-firmware-m                                                          19868  31.86%
│   │               ├── interface                                                                 298   0.48%
│   │               │   └── src                                                                   298   0.48%
│   │               │       ├── tfm_its_api.c                                                     232   0.37%
│   │               │       │   ├── psa_its_get                                                    76   0.12%
│   │               │       │   ├── psa_its_get_info                                               52   0.08%
│   │               │       │   ├── psa_its_remove                                                 44   0.07%
│   │               │       │   └── psa_its_set                                                    60   0.10%
│   │               │       └── tfm_psa_call.c                                                     66   0.11%
│   │               │           └── psa_call                                                       66   0.11%
│   │               ├── platform                                                                 4500   7.22%
│   │               │   └── ext                                                                  4500   7.22%
│   │               │       ├── common                                                           1870   3.00%
│   │               │       │   ├── exception_info.c                                              168   0.27%
│   │               │       │   │   ├── store_and_dump_context                                    156   0.25%
│   │               │       │   │   └── tfm_exception_info_get_context                             12   0.02%
│   │               │       │   ├── faults.c                                                      144   0.23%
│   │               │       │   │   ├── BusFault_Handler                                           28   0.04%
│   │               │       │   │   ├── C_HardFault_Handler                                         4   0.01%
│   │               │       │   │   ├── HardFault_Handler                                          28   0.04%
│   │               │       │   │   ├── MemManage_Handler                                          28   0.04%
│   │               │       │   │   ├── SecureFault_Handler                                        28   0.04%
│   │               │       │   │   └── UsageFault_Handler                                         28   0.04%
│   │               │       │   ├── template                                                     1530   2.45%
│   │               │       │   │   ├── crypto_nv_seed.c                                          124   0.20%
│   │               │       │   │   │   ├── tfm_plat_crypto_nv_seed_read                           46   0.07%
│   │               │       │   │   │   ├── tfm_plat_crypto_nv_seed_write                          32   0.05%
│   │               │       │   │   │   └── tfm_plat_crypto_provision_entropy_seed                 46   0.07%
│   │               │       │   │   ├── flash_otp_nv_counters_backend.c                          1122   1.80%
│   │               │       │   │   │   ├── copy_flash_region                                     120   0.19%
│   │               │       │   │   │   ├── data_width_byte                                        12   0.02%
│   │               │       │   │   │   ├── erase_flash_region                                     60   0.10%
│   │               │       │   │   │   ├── init_otp_nv_counters_flash                            340   0.55%
│   │               │       │   │   │   ├── make_backup                                            38   0.06%
│   │               │       │   │   │   ├── read_otp_nv_counters_flash                            124   0.20%
│   │               │       │   │   │   └── write_otp_nv_counters_flash                           428   0.69%
│   │               │       │   │   ├── nv_counters.c                                              26   0.04%
│   │               │       │   │   │   ├── tfm_plat_increment_nv_counter                           6   0.01%
│   │               │       │   │   │   ├── tfm_plat_init_nv_counter                                4   0.01%
│   │               │       │   │   │   └── tfm_plat_read_nv_counter                               16   0.03%
│   │               │       │   │   └── otp_flash.c                                               258   0.41%
│   │               │       │   │       ├── tfm_plat_otp_get_size                                  52   0.08%
│   │               │       │   │       ├── tfm_plat_otp_init                                       4   0.01%
│   │               │       │   │       ├── tfm_plat_otp_read                                     158   0.25%
│   │               │       │   │       └── write_to_output                                        44   0.07%
│   │               │       │   └── tfm_hal_its.c                                                  28   0.04%
│   │               │       │       └── tfm_hal_its_fs_info                                        28   0.04%
│   │               │       └── target                                                           2630   4.22%
│   │               │           └── nordic_nrf                                                   2630   4.22%
│   │               │               └── common                                                   2630   4.22%
│   │               │                   └── core                                                 2630   4.22%
│   │               │                       ├── cmsis_drivers                                     192   0.31%
│   │               │                       │   └── Driver_Flash.c                                192   0.31%
│   │               │                       │       ├── ARM_Flash_EraseSector                      24   0.04%
│   │               │                       │       ├── ARM_Flash_GetCapabilities                   4   0.01%
│   │               │                       │       ├── ARM_Flash_GetInfo                           8   0.01%
│   │               │                       │       ├── ARM_Flash_Initialize                        4   0.01%
│   │               │                       │       ├── ARM_Flash_ProgramData                      40   0.06%
│   │               │                       │       ├── ARM_Flash_ReadData                         44   0.07%
│   │               │                       │       ├── Driver_FLASH0                              44   0.07%
│   │               │                       │       └── FlashInfo                                  24   0.04%
│   │               │                       ├── faults.c                                           46   0.07%
│   │               │                       │   ├── SPU_Handler                                    18   0.03%
│   │               │                       │   └── SPU_IRQHandler                                 28   0.04%
│   │               │                       ├── hw_init.c                                         208   0.33%
│   │               │                       │   └── hw_init_reset_on_boot                         208   0.33%
│   │               │                       ├── native_drivers                                    592   0.95%
│   │               │                       │   ├── mpu_armv8m_drv.c                              212   0.34%
│   │               │                       │   │   ├── mpu_armv8m_clean                           34   0.05%
│   │               │                       │   │   ├── mpu_armv8m_enable                          52   0.08%
│   │               │                       │   │   ├── mpu_armv8m_region_disable                  20   0.03%
│   │               │                       │   │   └── mpu_armv8m_region_enable                  106   0.17%
│   │               │                       │   └── spu.c                                         380   0.61%
│   │               │                       │       ├── spu_clear_events                           36   0.06%
│   │               │                       │       ├── spu_enable_interrupts                      16   0.03%
│   │               │                       │       ├── spu_events_get                             40   0.06%
│   │               │                       │       ├── spu_peripheral_config_non_secure           20   0.03%
│   │               │                       │       ├── spu_regions_flash_config                   44   0.07%
│   │               │                       │       ├── spu_regions_flash_config_non_secure_callable 48   0.08%
│   │               │                       │       ├── spu_regions_flash_get_base_address_in_region 4   0.01%
│   │               │                       │       ├── spu_regions_flash_get_last_address_in_region 10   0.02%
│   │               │                       │       ├── spu_regions_flash_get_last_id               4   0.01%
│   │               │                       │       ├── spu_regions_flash_get_region_size           6   0.01%
│   │               │                       │       ├── spu_regions_flash_get_start_id              4   0.01%
│   │               │                       │       ├── spu_regions_reset_unlocked_secure          60   0.10%
│   │               │                       │       ├── spu_regions_sram_config                    52   0.08%
│   │               │                       │       ├── spu_regions_sram_get_base_address_in_region 10   0.02%
│   │               │                       │       ├── spu_regions_sram_get_last_address_in_region 12   0.02%
│   │               │                       │       ├── spu_regions_sram_get_last_id                4   0.01%
│   │               │                       │       ├── spu_regions_sram_get_region_size            6   0.01%
│   │               │                       │       └── spu_regions_sram_get_start_id               4   0.01%
│   │               │                       ├── nrf_exception_info.c                               28   0.04%
│   │               │                       │   ├── nrf_exception_info_get_context                 12   0.02%
│   │               │                       │   └── nrf_exception_info_store_context               16   0.03%
│   │               │                       ├── services                                           96   0.15%
│   │               │                       │   └── src                                            96   0.15%
│   │               │                       │       └── tfm_platform_hal_ioctl.c                   96   0.15%
│   │               │                       │           └── tfm_platform_hal_read_service          96   0.15%
│   │               │                       ├── startup.c                                         216   0.35%
│   │               │                       │   ├── Reset_Handler                                 212   0.34%
│   │               │                       │   └── default_irq_handler                             4   0.01%
│   │               │                       ├── startup_nrf91.c                                    28   0.04%
│   │               │                       │   └── default_tfm_IRQHandler                         28   0.04%
│   │               │                       ├── target_cfg.c                                      384   0.62%
│   │               │                       │   ├── enable_fault_handlers                          20   0.03%
│   │               │                       │   ├── init_debug                                      4   0.01%
│   │               │                       │   ├── memory_regions                                 28   0.04%
│   │               │                       │   ├── nvic_interrupt_enable                          24   0.04%
│   │               │                       │   ├── nvic_interrupt_target_state_cfg                48   0.08%
│   │               │                       │   ├── sau_and_idau_cfg                               32   0.05%
│   │               │                       │   ├── spu_init_cfg                                  128   0.21%
│   │               │                       │   ├── spu_periph_init_cfg                            76   0.12%
│   │               │                       │   └── system_reset_cfg                               24   0.04%
│   │               │                       ├── tfm_hal_isolation.c                               754   1.21%
│   │               │                       │   ├── dev_mpu_s                                       4   0.01%
│   │               │                       │   ├── mpu_init_cfg                                  284   0.46%
│   │               │                       │   ├── tfm_hal_activate_boundary                      28   0.04%
│   │               │                       │   ├── tfm_hal_bind_boundary                          76   0.12%
│   │               │                       │   ├── tfm_hal_boundary_need_switch                   26   0.04%
│   │               │                       │   ├── tfm_hal_memory_check                          294   0.47%
│   │               │                       │   └── tfm_hal_set_up_static_boundaries               42   0.07%
│   │               │                       └── tfm_hal_platform_common.c                          86   0.14%
│   │               │                           ├── tfm_hal_get_ns_MSP                             12   0.02%
│   │               │                           ├── tfm_hal_get_ns_VTOR                            12   0.02%
│   │               │                           ├── tfm_hal_get_ns_entry_point                     12   0.02%
│   │               │                           └── tfm_hal_platform_common_init                   50   0.08%
│   │               └── secure_fw                                                               15070  24.16%
│   │                   ├── partitions                                                          10120  16.23%
│   │                   │   ├── crypto                                                           4070   6.53%
│   │                   │   │   ├── crypto_aead.c                                                   6   0.01%
│   │                   │   │   │   └── tfm_crypto_aead_interface                                   6   0.01%
│   │                   │   │   ├── crypto_alloc.c                                                308   0.49%
│   │                   │   │   │   ├── tfm_crypto_init_alloc                                      24   0.04%
│   │                   │   │   │   ├── tfm_crypto_operation_alloc                                104   0.17%
│   │                   │   │   │   ├── tfm_crypto_operation_lookup                                88   0.14%
│   │                   │   │   │   └── tfm_crypto_operation_release                               92   0.15%
│   │                   │   │   ├── crypto_asymmetric.c                                             6   0.01%
│   │                   │   │   │   └── tfm_crypto_asymmetric_sign_interface                        6   0.01%
│   │                   │   │   ├── crypto_cipher.c                                               408   0.65%
│   │                   │   │   │   └── tfm_crypto_cipher_interface                               408   0.65%
│   │                   │   │   ├── crypto_hash.c                                                 350   0.56%
│   │                   │   │   │   └── tfm_crypto_hash_interface                                 350   0.56%
│   │                   │   │   ├── crypto_init.c                                                 618   0.99%
│   │                   │   │   │   ├── tfm_crypto_api_dispatcher                                 164   0.26%
│   │                   │   │   │   ├── tfm_crypto_clear_scratch                                   32   0.05%
│   │                   │   │   │   ├── tfm_crypto_get_caller_id                                   16   0.03%
│   │                   │   │   │   ├── tfm_crypto_init                                            38   0.06%
│   │                   │   │   │   └── tfm_crypto_sfn                                            368   0.59%
│   │                   │   │   ├── crypto_key_derivation.c                                       404   0.65%
│   │                   │   │   │   └── tfm_crypto_key_derivation_interface                       404   0.65%
│   │                   │   │   ├── crypto_key_management.c                                       454   0.73%
│   │                   │   │   │   └── tfm_crypto_key_management_interface                       454   0.73%
│   │                   │   │   ├── crypto_library.c                                              246   0.39%
│   │                   │   │   │   ├── mbedtls_psa_platform_get_builtin_key                       74   0.12%
│   │                   │   │   │   ├── tfm_crypto_core_library_init                               20   0.03%
│   │                   │   │   │   ├── tfm_crypto_core_library_key_attributes_from_client         82   0.13%
│   │                   │   │   │   ├── tfm_crypto_core_library_key_attributes_to_client           36   0.06%
│   │                   │   │   │   ├── tfm_crypto_library_get_info                                28   0.04%
│   │                   │   │   │   └── tfm_crypto_library_key_id_init                              6   0.01%
│   │                   │   │   ├── crypto_mac.c                                                  390   0.63%
│   │                   │   │   │   └── tfm_crypto_mac_interface                                  390   0.63%
│   │                   │   │   ├── crypto_rng.c                                                    8   0.01%
│   │                   │   │   │   └── tfm_crypto_random_interface                                 8   0.01%
│   │                   │   │   └── psa_driver_api                                                872   1.40%
│   │                   │   │       └── tfm_builtin_key_loader.c                                  872   1.40%
│   │                   │   │           ├── derive_subkey_into_buffer                             272   0.44%
│   │                   │   │           ├── tfm_builtin_key_loader_get_builtin_key                284   0.46%
│   │                   │   │           ├── tfm_builtin_key_loader_get_key_buffer_size             92   0.15%
│   │                   │   │           └── tfm_builtin_key_loader_init                           224   0.36%
│   │                   │   ├── internal_trusted_storage                                         4908   7.87%
│   │                   │   │   ├── flash                                                         350   0.56%
│   │                   │   │   │   └── its_flash_nor.c                                           350   0.56%
│   │                   │   │   │       ├── data_width_byte                                        12   0.02%
│   │                   │   │   │       ├── its_flash_nor_erase                                    46   0.07%
│   │                   │   │   │       ├── its_flash_nor_flush                                     4   0.01%
│   │                   │   │   │       ├── its_flash_nor_init                                     20   0.03%
│   │                   │   │   │       ├── its_flash_nor_read                                    200   0.32%
│   │                   │   │   │       └── its_flash_nor_write                                    68   0.11%
│   │                   │   │   ├── flash_fs                                                     3544   5.68%
│   │                   │   │   │   ├── its_flash_fs.c                                           1024   1.64%
│   │                   │   │   │   │   ├── its_flash_fs_delete_idx                               230   0.37%
│   │                   │   │   │   │   ├── its_flash_fs_file_delete                               32   0.05%
│   │                   │   │   │   │   ├── its_flash_fs_file_get_info                             40   0.06%
│   │                   │   │   │   │   ├── its_flash_fs_file_read                                 66   0.11%
│   │                   │   │   │   │   ├── its_flash_fs_file_write                               502   0.80%
│   │                   │   │   │   │   ├── its_flash_fs_init_ctx                                  98   0.16%
│   │                   │   │   │   │   ├── its_flash_fs_prepare                                   52   0.08%
│   │                   │   │   │   │   └── its_flash_fs_wipe_all                                   4   0.01%
│   │                   │   │   │   ├── its_flash_fs_dblock.c                                     366   0.59%
│   │                   │   │   │   │   ├── its_flash_fs_dblock_compact_block                     170   0.27%
│   │                   │   │   │   │   ├── its_flash_fs_dblock_read_file                          66   0.11%
│   │                   │   │   │   │   └── its_flash_fs_dblock_write_file                        130   0.21%
│   │                   │   │   │   └── its_flash_fs_mblock.c                                    2154   3.45%
│   │                   │   │   │       ├── its_flash_fs_block_to_block_move                       92   0.15%
│   │                   │   │   │       ├── its_flash_fs_mblock_cp_file_meta                       44   0.07%
│   │                   │   │   │       ├── its_flash_fs_mblock_cur_data_scratch_id                10   0.02%
│   │                   │   │   │       ├── its_flash_fs_mblock_get_file_idx_flag                  60   0.10%
│   │                   │   │   │       ├── its_flash_fs_mblock_get_file_idx_meta                  94   0.15%
│   │                   │   │   │       ├── its_flash_fs_mblock_init                              184   0.30%
│   │                   │   │   │       ├── its_flash_fs_mblock_meta_update_finalize               42   0.07%
│   │                   │   │   │       ├── its_flash_fs_mblock_migrate_lb0_data_to_scratch        46   0.07%
│   │                   │   │   │       ├── its_flash_fs_mblock_read_block_metadata                88   0.14%
│   │                   │   │   │       ├── its_flash_fs_mblock_read_block_metadata_comp          100   0.16%
│   │                   │   │   │       ├── its_flash_fs_mblock_read_file_meta                    118   0.19%
│   │                   │   │   │       ├── its_flash_fs_mblock_reserve_file                      188   0.30%
│   │                   │   │   │       ├── its_flash_fs_mblock_reset_metablock                   304   0.49%
│   │                   │   │   │       ├── its_flash_fs_mblock_set_data_scratch                    6   0.01%
│   │                   │   │   │       ├── its_flash_fs_mblock_update_scratch_block_meta         132   0.21%
│   │                   │   │   │       ├── its_flash_fs_mblock_update_scratch_file_meta           32   0.05%
│   │                   │   │   │       ├── its_init_get_active_metablock                         190   0.30%
│   │                   │   │   │       ├── its_mblock_calculate_metadata_xor.part.0              166   0.27%
│   │                   │   │   │       ├── its_mblock_erase_scratch_blocks                        40   0.06%
│   │                   │   │   │       ├── its_mblock_file_meta_offset.isra.0                     20   0.03%
│   │                   │   │   │       ├── its_mblock_update_scratch_block_meta                   26   0.04%
│   │                   │   │   │       ├── its_mblock_validate_header_meta                        92   0.15%
│   │                   │   │   │       ├── its_mblock_write_scratch_meta_header                   68   0.11%
│   │                   │   │   │       └── its_num_dedicated_dblocks.isra.0                       12   0.02%
│   │                   │   │   ├── its_utils.c                                                    50   0.08%
│   │                   │   │   │   ├── its_utils_check_contained_in                               24   0.04%
│   │                   │   │   │   └── its_utils_validate_fid                                     26   0.04%
│   │                   │   │   ├── tfm_internal_trusted_storage.c                                640   1.03%
│   │                   │   │   │   ├── fs_cfg_its                                                 28   0.04%
│   │                   │   │   │   ├── get_file_info                                              80   0.13%
│   │                   │   │   │   ├── tfm_its_get                                               148   0.24%
│   │                   │   │   │   ├── tfm_its_get_info                                           36   0.06%
│   │                   │   │   │   ├── tfm_its_init                                              132   0.21%
│   │                   │   │   │   ├── tfm_its_remove                                             56   0.09%
│   │                   │   │   │   └── tfm_its_set                                               160   0.26%
│   │                   │   │   └── tfm_its_req_mngr.c                                            324   0.52%
│   │                   │   │       ├── its_req_mngr_read                                          20   0.03%
│   │                   │   │       ├── its_req_mngr_write                                         20   0.03%
│   │                   │   │       ├── tfm_internal_trusted_storage_service_sfn                  280   0.45%
│   │                   │   │       └── tfm_its_entry                                               4   0.01%
│   │                   │   ├── lib                                                               336   0.54%
│   │                   │   │   └── runtime                                                       336   0.54%
│   │                   │   │       ├── crt_memcmp.c                                               32   0.05%
│   │                   │   │       │   └── memcmp                                                 32   0.05%
│   │                   │   │       ├── psa_api_ipc.c                                             168   0.27%
│   │                   │   │       │   ├── psa_framework_version                                  16   0.03%
│   │                   │   │       │   ├── psa_get                                                16   0.03%
│   │                   │   │       │   ├── psa_panic                                              16   0.03%
│   │                   │   │       │   ├── psa_read                                               24   0.04%
│   │                   │   │       │   ├── psa_reply                                              16   0.03%
│   │                   │   │       │   ├── psa_version                                            16   0.03%
│   │                   │   │       │   ├── psa_wait                                               16   0.03%
│   │                   │   │       │   ├── psa_write                                              24   0.04%
│   │                   │   │       │   └── tfm_psa_call_pack                                      24   0.04%
│   │                   │   │       └── sfn_common_thread.c                                       136   0.22%
│   │                   │   │           └── common_sfn_thread                                     136   0.22%
│   │                   │   ├── ns_agent_tz                                                       234   0.38%
│   │                   │   │   ├── load_info_ns_agent_tz.c                                        48   0.08%
│   │                   │   │   │   └── tfm_sp_ns_agent_tz_load                                    48   0.08%
│   │                   │   │   ├── ns_agent_tz_v80m.c                                             90   0.14%
│   │                   │   │   │   └── ns_agent_tz_main                                           90   0.14%
│   │                   │   │   └── psa_api_veneers_v80m.c                                         96   0.15%
│   │                   │   │       ├── clear_caller_context                                       92   0.15%
│   │                   │   │       └── ret_err                                                     4   0.01%
│   │                   │   └── platform                                                          572   0.92%
│   │                   │       └── platform_sp.c                                                 572   0.92%
│   │                   │           ├── platform_sp_init                                           18   0.03%
│   │                   │           └── tfm_platform_service_sfn                                  554   0.89%
│   │                   ├── shared                                                                144   0.23%
│   │                   │   ├── crt_memcpy.c                                                       74   0.12%
│   │                   │   │   └── memcpy                                                         74   0.12%
│   │                   │   └── crt_memset.c                                                       70   0.11%
│   │                   │       └── memset                                                         70   0.11%
│   │                   └── spm                                                                  4806   7.71%
│   │                       ├── core                                                             4776   7.66%
│   │                       │   ├── arch                                                          712   1.14%
│   │                       │   │   ├── tfm_arch.c                                                194   0.31%
│   │                       │   │   │   ├── arch_acquire_sched_lock                                12   0.02%
│   │                       │   │   │   ├── arch_attempt_schedule                                  36   0.06%
│   │                       │   │   │   ├── arch_release_sched_lock                                14   0.02%
│   │                       │   │   │   ├── tfm_arch_free_msp_and_exc_ret                          12   0.02%
│   │                       │   │   │   ├── tfm_arch_init_context                                  92   0.15%
│   │                       │   │   │   ├── tfm_arch_refresh_hardware_context                      22   0.04%
│   │                       │   │   │   └── tfm_arch_set_context_ret_code                           6   0.01%
│   │                       │   │   └── tfm_arch_v8m_main.c                                       518   0.83%
│   │                       │   │       ├── PendSV_Handler                                         82   0.13%
│   │                       │   │       ├── SVC_Handler                                           100   0.16%
│   │                       │   │       ├── tfm_arch_clear_fp_data                                138   0.22%
│   │                       │   │       ├── tfm_arch_config_extensions                             76   0.12%
│   │                       │   │       ├── tfm_arch_set_secure_exception_priorities               40   0.06%
│   │                       │   │       └── tfm_arch_thread_fn_call                                82   0.13%
│   │                       │   ├── backend_ipc.c                                                 758   1.22%
│   │                       │   │   ├── backend_abi_entering_spm                                   68   0.11%
│   │                       │   │   ├── backend_abi_leaving_spm                                    30   0.05%
│   │                       │   │   ├── backend_assert_signal                                      44   0.07%
│   │                       │   │   ├── backend_init_comp_assuredly                               180   0.29%
│   │                       │   │   ├── backend_messaging                                          64   0.10%
│   │                       │   │   ├── backend_replying                                           10   0.02%
│   │                       │   │   ├── backend_system_run                                         68   0.11%
│   │                       │   │   ├── backend_wait_signals                                       32   0.05%
│   │                       │   │   ├── comp_init_fns                                               8   0.01%
│   │                       │   │   ├── ipc_schedule                                              128   0.21%
│   │                       │   │   ├── ns_agent_tz_init                                           32   0.05%
│   │                       │   │   ├── partition_init                                             28   0.04%
│   │                       │   │   └── query_state                                                66   0.11%
│   │                       │   ├── main.c                                                         80   0.13%
│   │                       │   │   └── main                                                       80   0.13%
│   │                       │   ├── psa_api.c                                                     430   0.69%
│   │                       │   │   ├── spm_handle_programmer_errors                               24   0.04%
│   │                       │   │   ├── tfm_spm_get_lifecycle_state                                 4   0.01%
│   │                       │   │   ├── tfm_spm_partition_psa_get                                 176   0.28%
│   │                       │   │   ├── tfm_spm_partition_psa_panic                                12   0.02%
│   │                       │   │   ├── tfm_spm_partition_psa_reply                               154   0.25%
│   │                       │   │   └── tfm_spm_partition_psa_wait                                 60   0.10%
│   │                       │   ├── psa_call_api.c                                                446   0.72%
│   │                       │   │   ├── spm_associate_call_params                                 368   0.59%
│   │                       │   │   └── tfm_spm_client_psa_call                                    78   0.13%
│   │                       │   ├── psa_interface_thread_fn_call.c                                176   0.28%
│   │                       │   │   ├── psa_api_thread_fn_call                                     44   0.07%
│   │                       │   │   ├── psa_framework_version_thread_fn_call                       12   0.02%
│   │                       │   │   ├── psa_get_thread_fn_call                                     12   0.02%
│   │                       │   │   ├── psa_panic_thread_fn_call                                   12   0.02%
│   │                       │   │   ├── psa_read_thread_fn_call                                    12   0.02%
│   │                       │   │   ├── psa_reply_thread_fn_call                                   12   0.02%
│   │                       │   │   ├── psa_rot_lifecycle_state_thread_fn_call                     12   0.02%
│   │                       │   │   ├── psa_skip_thread_fn_call                                    12   0.02%
│   │                       │   │   ├── psa_version_thread_fn_call                                 12   0.02%
│   │                       │   │   ├── psa_wait_thread_fn_call                                    12   0.02%
│   │                       │   │   ├── psa_write_thread_fn_call                                   12   0.02%
│   │                       │   │   └── tfm_psa_call_pack_thread_fn_call                           12   0.02%
│   │                       │   ├── psa_read_write_skip_api.c                                     296   0.47%
│   │                       │   │   ├── tfm_spm_partition_psa_read                                116   0.19%
│   │                       │   │   ├── tfm_spm_partition_psa_skip                                 60   0.10%
│   │                       │   │   └── tfm_spm_partition_psa_write                               120   0.19%
│   │                       │   ├── psa_version_api.c                                              50   0.08%
│   │                       │   │   ├── tfm_spm_client_psa_framework_version                        6   0.01%
│   │                       │   │   └── tfm_spm_client_psa_version                                 44   0.07%
│   │                       │   ├── rom_loader.c                                                  430   0.69%
│   │                       │   │   ├── ldinf_ea                                                    4   0.01%
│   │                       │   │   ├── ldinf_sa                                                    4   0.01%
│   │                       │   │   ├── load_a_partition_assuredly                                208   0.33%
│   │                       │   │   ├── load_irqs_assuredly                                         2   0.00%
│   │                       │   │   ├── load_services_assuredly                                   196   0.31%
│   │                       │   │   ├── part_pool_ea                                                4   0.01%
│   │                       │   │   ├── part_pool_sa                                                4   0.01%
│   │                       │   │   ├── serv_pool_ea                                                4   0.01%
│   │                       │   │   └── serv_pool_sa                                                4   0.01%
│   │                       │   ├── spm_connection_pool.c                                         148   0.24%
│   │                       │   │   ├── connection_to_handle                                       32   0.05%
│   │                       │   │   ├── handle_to_connection                                       16   0.03%
│   │                       │   │   ├── spm_allocate_connection                                    12   0.02%
│   │                       │   │   ├── spm_free_connection                                        28   0.04%
│   │                       │   │   ├── spm_init_connection_space                                  32   0.05%
│   │                       │   │   └── spm_validate_connection                                    28   0.04%
│   │                       │   ├── spm_ipc.c                                                     672   1.08%
│   │                       │   │   ├── spm_get_connection                                        120   0.19%
│   │                       │   │   ├── spm_get_handle_by_signal                                   74   0.12%
│   │                       │   │   ├── spm_init_connection                                        52   0.08%
│   │                       │   │   ├── spm_msg_handle_to_connection                               40   0.06%
│   │                       │   │   ├── tfm_spm_check_authorization                                72   0.12%
│   │                       │   │   ├── tfm_spm_check_client_version                               36   0.06%
│   │                       │   │   ├── tfm_spm_get_client_id                                      32   0.05%
│   │                       │   │   ├── tfm_spm_get_service_by_sid                                 44   0.07%
│   │                       │   │   ├── tfm_spm_init                                              100   0.16%
│   │                       │   │   ├── tfm_spm_is_ns_caller                                       40   0.06%
│   │                       │   │   ├── tfm_spm_partition_get_running_partition_id                 32   0.05%
│   │                       │   │   └── update_caller_outvec_len                                   30   0.05%
│   │                       │   ├── tfm_boot_data.c                                                68   0.11%
│   │                       │   │   ├── tfm_core_get_boot_data_handler                             56   0.09%
│   │                       │   │   └── tfm_core_validate_boot_data                                12   0.02%
│   │                       │   ├── tfm_pools.c                                                   166   0.27%
│   │                       │   │   ├── is_valid_chunk_data_in_pool                                40   0.06%
│   │                       │   │   ├── tfm_pool_alloc                                             22   0.04%
│   │                       │   │   ├── tfm_pool_free                                              12   0.02%
│   │                       │   │   └── tfm_pool_init                                              92   0.15%
│   │                       │   ├── tfm_svcalls.c                                                 116   0.19%
│   │                       │   │   ├── spm_svc_handler                                           112   0.18%
│   │                       │   │   └── tfm_core_handler_mode                                       4   0.01%
│   │                       │   ├── thread.c                                                      224   0.36%
│   │                       │   │   ├── thrd_next                                                  76   0.12%
│   │                       │   │   ├── thrd_set_query_callback                                    12   0.02%
│   │                       │   │   ├── thrd_set_state                                             40   0.06%
│   │                       │   │   ├── thrd_start                                                 68   0.11%
│   │                       │   │   └── thrd_start_scheduler                                       28   0.04%
│   │                       │   └── utilities.c                                                     4   0.01%
│   │                       │       └── tfm_core_panic                                              4   0.01%
│   │                       └── ns_client_ext                                                      30   0.05%
│   │                           └── tfm_spm_ns_ctx.c                                               30   0.05%
│   │                               ├── tfm_nspm_ctx_init                                          24   0.04%
│   │                               └── tfm_nspm_get_current_client_id                              6   0.01%
│   └── nrf                                                                                     14520  23.28%
│       ├── ext                                                                                 11782  18.89%
│       │   └── oberon                                                                          11782  18.89%
│       │       └── psa                                                                         11782  18.89%
│       │           ├── core                                                                    10508  16.85%
│       │           │   ├── include                                                                20   0.03%
│       │           │   │   └── psa                                                                20   0.03%
│       │           │   │       └── crypto_struct.h                                                20   0.03%
│       │           │   │           └── psa_set_key_usage_flags                                    20   0.03%
│       │           │   └── library                                                             10488  16.82%
│       │           │       ├── alignment.h                                                        88   0.14%
│       │           │       │   ├── mbedtls_get_unaligned_uint16                                   24   0.04%
│       │           │       │   ├── mbedtls_get_unaligned_uint32                                   22   0.04%
│       │           │       │   ├── mbedtls_put_unaligned_uint16                                   22   0.04%
│       │           │       │   └── mbedtls_put_unaligned_uint32                                   20   0.03%
│       │           │       ├── platform.c                                                         58   0.09%
│       │           │       │   ├── mbedtls_calloc                                                 12   0.02%
│       │           │       │   ├── mbedtls_calloc_func                                             4   0.01%
│       │           │       │   ├── mbedtls_free                                                   12   0.02%
│       │           │       │   ├── mbedtls_free_func                                               4   0.01%
│       │           │       │   ├── mbedtls_platform_set_calloc_free                               20   0.03%
│       │           │       │   ├── platform_calloc_uninit                                          4   0.01%
│       │           │       │   └── platform_free_uninit                                            2   0.00%
│       │           │       ├── platform_util.c                                                    48   0.08%
│       │           │       │   ├── mbedtls_platform_zeroize                                       24   0.04%
│       │           │       │   ├── mbedtls_zeroize_and_free                                       20   0.03%
│       │           │       │   └── memset_func                                                     4   0.01%
│       │           │       ├── psa_crypto.c                                                     8546  13.70%
│       │           │       │   ├── key_type_is_raw_bytes                                          24   0.04%
│       │           │       │   ├── mbedcrypto__psa_cipher_abort                                   28   0.04%
│       │           │       │   ├── mbedcrypto__psa_cipher_decrypt                                336   0.54%
│       │           │       │   ├── mbedcrypto__psa_cipher_decrypt_setup                           24   0.04%
│       │           │       │   ├── mbedcrypto__psa_cipher_encrypt                                352   0.56%
│       │           │       │   ├── mbedcrypto__psa_cipher_encrypt_setup                           24   0.04%
│       │           │       │   ├── mbedcrypto__psa_cipher_finish                                  56   0.09%
│       │           │       │   ├── mbedcrypto__psa_cipher_generate_iv                            116   0.19%
│       │           │       │   ├── mbedcrypto__psa_cipher_set_iv                                  60   0.10%
│       │           │       │   ├── mbedcrypto__psa_cipher_update                                  52   0.08%
│       │           │       │   ├── mbedcrypto__psa_copy_key                                      348   0.56%
│       │           │       │   ├── mbedcrypto__psa_crypto_init                                    56   0.09%
│       │           │       │   ├── mbedcrypto__psa_destroy_key                                    86   0.14%
│       │           │       │   ├── mbedcrypto__psa_export_key                                    106   0.17%
│       │           │       │   ├── mbedcrypto__psa_export_public_key                             124   0.20%
│       │           │       │   ├── mbedcrypto__psa_generate_key                                  416   0.67%
│       │           │       │   ├── mbedcrypto__psa_generate_random                                28   0.04%
│       │           │       │   ├── mbedcrypto__psa_get_key_attributes                             70   0.11%
│       │           │       │   ├── mbedcrypto__psa_hash_abort                                     22   0.04%
│       │           │       │   ├── mbedcrypto__psa_hash_clone                                     36   0.06%
│       │           │       │   ├── mbedcrypto__psa_hash_compare                                   82   0.13%
│       │           │       │   ├── mbedcrypto__psa_hash_compute                                   34   0.05%
│       │           │       │   ├── mbedcrypto__psa_hash_finish                                    34   0.05%
│       │           │       │   ├── mbedcrypto__psa_hash_setup                                     62   0.10%
│       │           │       │   ├── mbedcrypto__psa_hash_update                                    40   0.06%
│       │           │       │   ├── mbedcrypto__psa_hash_verify                                    88   0.14%
│       │           │       │   ├── mbedcrypto__psa_import_key                                    230   0.37%
│       │           │       │   ├── mbedcrypto__psa_key_derivation_abort                           28   0.04%
│       │           │       │   ├── mbedcrypto__psa_key_derivation_get_capacity                    18   0.03%
│       │           │       │   ├── mbedcrypto__psa_key_derivation_input_bytes                     18   0.03%
│       │           │       │   ├── mbedcrypto__psa_key_derivation_input_key                      144   0.23%
│       │           │       │   ├── mbedcrypto__psa_key_derivation_key_agreement                  212   0.34%
│       │           │       │   ├── mbedcrypto__psa_key_derivation_output_bytes                    44   0.07%
│       │           │       │   ├── mbedcrypto__psa_key_derivation_output_key                     332   0.53%
│       │           │       │   ├── mbedcrypto__psa_key_derivation_set_capacity                    38   0.06%
│       │           │       │   ├── mbedcrypto__psa_key_derivation_setup                          240   0.38%
│       │           │       │   ├── mbedcrypto__psa_mac_abort                                      34   0.05%
│       │           │       │   ├── mbedcrypto__psa_mac_compute                                    42   0.07%
│       │           │       │   ├── mbedcrypto__psa_mac_sign_finish                                84   0.13%
│       │           │       │   ├── mbedcrypto__psa_mac_sign_setup                                 24   0.04%
│       │           │       │   ├── mbedcrypto__psa_mac_update                                     40   0.06%
│       │           │       │   ├── mbedcrypto__psa_mac_verify                                     84   0.13%
│       │           │       │   ├── mbedcrypto__psa_mac_verify_finish                              64   0.10%
│       │           │       │   ├── mbedcrypto__psa_mac_verify_setup                               24   0.04%
│       │           │       │   ├── mbedcrypto__psa_raw_key_agreement                             144   0.23%
│       │           │       │   ├── mbedtls_psa_crypto_free                                        36   0.06%
│       │           │       │   ├── psa_allocate_buffer_to_slot                                    38   0.06%
│       │           │       │   ├── psa_cipher_setup                                              332   0.53%
│       │           │       │   ├── psa_copy_key_material_into_slot                                32   0.05%
│       │           │       │   ├── psa_export_key_internal                                        94   0.15%
│       │           │       │   ├── psa_export_public_key_internal                                102   0.16%
│       │           │       │   ├── psa_finish_key_creation.constprop.0                            50   0.08%
│       │           │       │   ├── psa_generate_key_internal                                      30   0.05%
│       │           │       │   ├── psa_get_and_lock_key_slot_with_policy                         232   0.37%
│       │           │       │   ├── psa_get_and_lock_transparent_key_slot_with_policy              64   0.10%
│       │           │       │   ├── psa_import_key_into_slot                                       58   0.09%
│       │           │       │   ├── psa_key_algorithm_permits                                     504   0.81%
│       │           │       │   ├── psa_key_derivation_check_input_type                            96   0.15%
│       │           │       │   ├── psa_key_derivation_check_state                                172   0.28%
│       │           │       │   ├── psa_key_derivation_input_internal                              60   0.10%
│       │           │       │   ├── psa_key_derivation_output_bytes_internal                       66   0.11%
│       │           │       │   ├── psa_key_policy_algorithm_intersection                        1068   1.71%
│       │           │       │   ├── psa_mac_compute_internal                                      174   0.28%
│       │           │       │   ├── psa_mac_finalize_alg_and_key_validation.isra.0                224   0.36%
│       │           │       │   ├── psa_mac_key_can_do                                             64   0.10%
│       │           │       │   ├── psa_mac_setup                                                 168   0.27%
│       │           │       │   ├── psa_remove_key_data_from_memory                                22   0.04%
│       │           │       │   ├── psa_start_key_creation.constprop.0                            164   0.26%
│       │           │       │   ├── psa_validate_unstructured_key_bit_size                         94   0.15%
│       │           │       │   ├── psa_wipe_key_slot                                              34   0.05%
│       │           │       │   └── psa_wipe_tag_output_buffer                                     20   0.03%
│       │           │       ├── psa_crypto_client.c                                                 8   0.01%
│       │           │       │   └── mbedcrypto__psa_reset_key_attributes                            8   0.01%
│       │           │       ├── psa_crypto_slot_management.c                                      992   1.59%
│       │           │       │   ├── mbedcrypto__psa_close_key                                      66   0.11%
│       │           │       │   ├── mbedcrypto__psa_open_key                                       66   0.11%
│       │           │       │   ├── mbedcrypto__psa_purge_key                                      58   0.09%
│       │           │       │   ├── psa_get_and_lock_key_slot                                     408   0.65%
│       │           │       │   ├── psa_get_and_lock_key_slot_in_memory                           132   0.21%
│       │           │       │   ├── psa_get_empty_key_slot                                        128   0.21%
│       │           │       │   ├── psa_initialize_key_slots                                       16   0.03%
│       │           │       │   ├── psa_is_valid_key_id                                            44   0.07%
│       │           │       │   ├── psa_unlock_key_slot                                            20   0.03%
│       │           │       │   ├── psa_validate_key_location                                       4   0.01%
│       │           │       │   ├── psa_validate_key_persistence                                   14   0.02%
│       │           │       │   └── psa_wipe_all_key_slots                                         36   0.06%
│       │           │       └── psa_crypto_storage.c                                              748   1.20%
│       │           │           ├── psa_destroy_persistent_key                                     66   0.11%
│       │           │           ├── psa_format_key_data_for_storage                               120   0.19%
│       │           │           ├── psa_free_persistent_key_data                                    4   0.01%
│       │           │           ├── psa_is_key_present_in_storage                                  30   0.05%
│       │           │           ├── psa_load_persistent_key                                       168   0.27%
│       │           │           ├── psa_parse_key_data_from_storage                               184   0.30%
│       │           │           └── psa_save_persistent_key                                       176   0.28%
│       │           └── drivers                                                                  1274   2.04%
│       │               ├── oberon_cipher.c                                                       554   0.89%
│       │               │   ├── oberon_cipher_abort                                                16   0.03%
│       │               │   ├── oberon_cipher_decrypt                                             112   0.18%
│       │               │   ├── oberon_cipher_decrypt_setup                                        88   0.14%
│       │               │   ├── oberon_cipher_encrypt                                             112   0.18%
│       │               │   ├── oberon_cipher_encrypt_setup                                        88   0.14%
│       │               │   ├── oberon_cipher_finish                                               56   0.09%
│       │               │   ├── oberon_cipher_set_iv                                                6   0.01%
│       │               │   └── oberon_cipher_update                                               76   0.12%
│       │               └── oberon_key_derivation.c                                               720   1.15%
│       │                   ├── oberon_key_derivation_abort                                        18   0.03%
│       │                   ├── oberon_key_derivation_input_bytes                                 180   0.29%
│       │                   ├── oberon_key_derivation_output_bytes                                256   0.41%
│       │                   ├── oberon_key_derivation_set_capacity                                  4   0.01%
│       │                   ├── oberon_key_derivation_setup                                       136   0.22%
│       │                   ├── oberon_setup_mac                                                   94   0.15%
│       │                   └── zero                                                               32   0.05%
│       ├── lib                                                                                   450   0.72%
│       │   └── hw_unique_key                                                                     450   0.72%
│       │       ├── hw_unique_key.c                                                               302   0.48%
│       │       │   ├── hw_unique_key_are_any_written                                              22   0.04%
│       │       │   ├── hw_unique_key_derive_key                                                   68   0.11%
│       │       │   └── hw_unique_key_write_random                                                212   0.34%
│       │       └── hw_unique_key_kmu.c                                                           148   0.24%
│       │           ├── hw_unique_key_is_written                                                  116   0.19%
│       │           └── hw_unique_key_write                                                        32   0.05%
│       ├── modules                                                                               800   1.28%
│       │   └── trusted-firmware-m                                                                800   1.28%
│       │       └── tfm_boards                                                                    800   1.28%
│       │           ├── common                                                                    622   1.00%
│       │           │   ├── crypto_keys.c                                                         196   0.31%
│       │           │   │   ├── g_builtin_keys_desc                                                48   0.08%
│       │           │   │   ├── g_builtin_keys_policy                                              12   0.02%
│       │           │   │   ├── tfm_plat_builtin_key_get_desc_table_ptr                            12   0.02%
│       │           │   │   ├── tfm_plat_builtin_key_get_policy_table_ptr                          12   0.02%
│       │           │   │   └── tfm_plat_get_huk                                                  112   0.18%
│       │           │   ├── dummy_provisioning.c                                                   10   0.02%
│       │           │   │   ├── tfm_plat_provisioning_check_for_dummy_keys                          2   0.00%
│       │           │   │   ├── tfm_plat_provisioning_is_required                                   4   0.01%
│       │           │   │   └── tfm_plat_provisioning_perform                                       4   0.01%
│       │           │   ├── ns_fault_service.c                                                    304   0.49%
│       │           │   │   ├── call_ns_callback                                                  232   0.37%
│       │           │   │   ├── ns_fault_service_call_handler                                      52   0.08%
│       │           │   │   └── ns_fault_service_set_handler                                       20   0.03%
│       │           │   ├── tfm_hal_platform.c                                                     72   0.12%
│       │           │   │   └── tfm_hal_platform_init                                              72   0.12%
│       │           │   └── tfm_hal_reset_halt.c                                                   40   0.06%
│       │           │       └── tfm_hal_system_reset                                               40   0.06%
│       │           ├── services                                                                   32   0.05%
│       │           │   └── include                                                                32   0.05%
│       │           │       └── tfm_read_ranges.h                                                  32   0.05%
│       │           │           └── ranges                                                         32   0.05%
│       │           └── src                                                                       146   0.23%
│       │               └── tfm_platform_system.c                                                 146   0.23%
│       │                   ├── tfm_platform_hal_ioctl                                            110   0.18%
│       │                   └── tfm_platform_hal_system_reset                                      36   0.06%
│       └── subsys                                                                               1488   2.39%
│           └── nrf_security                                                                     1488   2.39%
│               └── src                                                                          1488   2.39%
│                   └── psa_crypto_driver_wrappers.c                                             1488   2.39%
│                       ├── psa_driver_wrapper_cipher_abort                                        58   0.09%
│                       ├── psa_driver_wrapper_cipher_decrypt                                     108   0.17%
│                       ├── psa_driver_wrapper_cipher_decrypt_setup                               104   0.17%
│                       ├── psa_driver_wrapper_cipher_encrypt                                     116   0.19%
│                       ├── psa_driver_wrapper_cipher_encrypt_setup                               104   0.17%
│                       ├── psa_driver_wrapper_cipher_finish                                       42   0.07%
│                       ├── psa_driver_wrapper_cipher_set_iv                                       28   0.04%
│                       ├── psa_driver_wrapper_cipher_update                                       48   0.08%
│                       ├── psa_driver_wrapper_copy_key                                             6   0.01%
│                       ├── psa_driver_wrapper_export_key                                          40   0.06%
│                       ├── psa_driver_wrapper_export_public_key                                   40   0.06%
│                       ├── psa_driver_wrapper_free                                                 2   0.00%
│                       ├── psa_driver_wrapper_generate_key                                        32   0.05%
│                       ├── psa_driver_wrapper_get_builtin_key                                     32   0.05%
│                       ├── psa_driver_wrapper_get_key_buffer_size                                 48   0.08%
│                       ├── psa_driver_wrapper_get_key_buffer_size_from_key_data                   10   0.02%
│                       ├── psa_driver_wrapper_get_random                                          34   0.05%
│                       ├── psa_driver_wrapper_hash_abort                                          16   0.03%
│                       ├── psa_driver_wrapper_hash_clone                                          22   0.04%
│                       ├── psa_driver_wrapper_hash_compute                                        28   0.04%
│                       ├── psa_driver_wrapper_hash_finish                                         28   0.04%
│                       ├── psa_driver_wrapper_hash_setup                                          36   0.06%
│                       ├── psa_driver_wrapper_hash_update                                         18   0.03%
│                       ├── psa_driver_wrapper_import_key                                          48   0.08%
│                       ├── psa_driver_wrapper_init                                                 4   0.01%
│                       ├── psa_driver_wrapper_key_derivation_abort                                16   0.03%
│                       ├── psa_driver_wrapper_key_derivation_input_bytes                          28   0.04%
│                       ├── psa_driver_wrapper_key_derivation_output_bytes                         18   0.03%
│                       ├── psa_driver_wrapper_key_derivation_set_capacity                         18   0.03%
│                       ├── psa_driver_wrapper_key_derivation_setup                                18   0.03%
│                       ├── psa_driver_wrapper_mac_abort                                           16   0.03%
│                       ├── psa_driver_wrapper_mac_compute                                         84   0.13%
│                       ├── psa_driver_wrapper_mac_sign_finish                                     38   0.06%
│                       ├── psa_driver_wrapper_mac_sign_setup                                      72   0.12%
│                       ├── psa_driver_wrapper_mac_update                                          18   0.03%
│                       ├── psa_driver_wrapper_mac_verify_finish                                   38   0.06%
│                       └── psa_driver_wrapper_mac_verify_setup                                    72   0.12%
└── ZEPHYR_BASE                                                                                     0   0.00%
==============================================================================================================
                                                                                                62368



It would be great if i could at least lose 360 bytes since that would make me end up below 64KB flash usage and that would make it easier to create the pm_static.yml file.
Is there any configuration or trick that i could use to do that? 

Parents
  • Hi Marcus,

    It is hard to say or suggest without knowing your use case. Do you save PSA keys persistently? If not you may disable that storage library (CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C=n

    Keep only those backends that you use and disable others. For example if you are using AES+RNG then just keep

    CONFIG_TFM_CRYPTO_RNG_MODULE_ENABLED=y
    CONFIG_TFM_CRYPTO_KEY_MODULE_ENABLED=y
    CONFIG_TFM_CRYPTO_CIPHER_MODULE_ENABLED=y

    Disable other unused modules. 
    CONFIG_TFM_CRYPTO_HASH_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_MAC_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_AEAD_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED=n

    I will ask my colleague who has much deeper knowledge than me in crypto to have a brief look at this and comment if he has any inputs.

Reply
  • Hi Marcus,

    It is hard to say or suggest without knowing your use case. Do you save PSA keys persistently? If not you may disable that storage library (CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C=n

    Keep only those backends that you use and disable others. For example if you are using AES+RNG then just keep

    CONFIG_TFM_CRYPTO_RNG_MODULE_ENABLED=y
    CONFIG_TFM_CRYPTO_KEY_MODULE_ENABLED=y
    CONFIG_TFM_CRYPTO_CIPHER_MODULE_ENABLED=y

    Disable other unused modules. 
    CONFIG_TFM_CRYPTO_HASH_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_MAC_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_AEAD_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED=n

    I will ask my colleague who has much deeper knowledge than me in crypto to have a brief look at this and comment if he has any inputs.

Children
  • config MBEDTLS_PSA_CRYPTO_STORAGE_C
    	bool "PSA storage for persistent keys" if !BUILD_WITH_TFM
    	default y if BUILD_WITH_TFM
    	help
    	  Corresponds to MBEDTLS_PSA_CRYPTO_STORAGE_C setting in mbed TLS config file.

    i got this when trying to disable CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C:
    warning: MBEDTLS_PSA_CRYPTO_STORAGE_C (defined at /home/marcus/ncs/v2.6.1/nrf/modules/trusted-
    firmware-m/Kconfig.mbedtls_minimal.defconfig:68,
    /home/marcus/ncs/v2.6.1/nrf/subsys/nrf_security/Kconfig.psa:53) was assigned the value 'n' but got
    the value 'y'. See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_MBEDTLS_PSA_CRYPTO_STORAGE_C and/or look up
    MBEDTLS_PSA_CRYPTO_STORAGE_C in the menuconfig/guiconfig interface. The Application Development
    Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
    might be helpful too.

    and using these configs:

    CONFIG_TFM_CRYPTO_RNG_MODULE_ENABLED=y
    CONFIG_TFM_CRYPTO_KEY_MODULE_ENABLED=y
    CONFIG_TFM_CRYPTO_CIPHER_MODULE_ENABLED=y
    CONFIG_TFM_CRYPTO_HASH_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_MAC_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_AEAD_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_ASYM_SIGN_MODULE_ENABLED=n
    CONFIG_TFM_CRYPTO_KEY_DERIVATION_MODULE_ENABLED=n


    gave me the same result:
    [190/194] Linking C executable bin/tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       64360 B      97792 B     65.81%
                 RAM:       21684 B        32 KB     66.17%



    Thanks for continuing to assist me with this!

  • Remember 64kB is 65536 bytes so you are below 64kB today but better to have some margin if you need to make fixes to the code later.

  • FMOPV, not only for the TF-M part, a that small amount of free space will come with a high risk. The last NCS updates always increased the sizes of apps (I haven't analyzed it, but from 2.9.2 to 3.1.0 my apps have increased theirs size, so I had to disable functions.)

  • If i change the ram size from:

    tfm:
      address: 0x8200
      end_address: 0x20000
      region: flash_primary
      size: 0x17e00  # 95.5KB for TFM


    to 64KB i get flash overflow when building the tfm image. 

  • Hi mackz,

    So to be on the same page, are you optimizing RAM or Flash footprint?

    Either way, have you looked into custom profile build?
    I see that you have a case where that topic is brought up: Crypto operations to generate key pair when TFM profile is set to minimal. 

    Please refer to this guide and determine which TF-M partitions you need. We first build with only the Partition you need, then we also start taking away unused features from those partition. Please give me an update on what size you have.

    Also, as PaKa and Achim mentioned, having TF-M barely fit is not a good idea. It's better to have plenty of space reserved to it. Do you absolutely needs it to occupy only 64kB? Can you not give it a little more? If so, why, in case we can find alternatives there?

    Hieu

Related