I'm encountering issues while building my project with custom boards. Each board has a corresponding *_defconfig file with specific configuration options, and I also have a prj.conf file in the project directory. Currently, I want to enable crypto operations and Mbed TLS with CryptoCell support on a custom board based on the nRF52840.
Here’s the setup I’m using:
In prj.conf:
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=8192
CONFIG_PSA_WANT_GENERATE_RANDOM=y
CONFIG_PSA_WANT_KEY_TYPE_AES=y
CONFIG_PSA_WANT_ALG_CBC_NO_PADDING=y
CONFIG_PSA_WANT_ALG_ECB_NO_PADDING=y
In the board’s defconfig file:
CONFIG_PSA_CRYPTO_DRIVER_OBERON=n
CONFIG_PSA_CRYPTO_DRIVER_CC3XX=y
CONFIG_NRF_SECURITY=y
Issues Encountered:
-
Compilation Errors: When
CONFIG_NRF_SECURITY=yis in thedefconfigfile, the project fails to compile. The following error appears:ncs/v2.7.0/modules/crypto/mbedtls/library/pk_internal.h:29:67: error: 'psa_to_pk_rsa_errors' undeclared (first use in this function); did you mean 'psa_to_ssl_errors'? 29 | psa_to_pk_rsa_errorsHowever, if I move
CONFIG_NRF_SECURITY=ytoprj.conf, the project compiles, but with a warning:warning: PSA_CRYPTO_DRIVER_CC3XX (defined at /root/ncs/v2.7.0/nrf/subsys/nrf_security/src/drivers/Kconfig:17) was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: MBEDTLS_PSA_CRYPTO_C (=n), NRF_SECURITY (=n). -
Configuration Validation: Despite the warnings, when I check
autoconf.hand.configfiles,PSA_CRYPTO_DRIVER_CC3XXappears to be set up correctly. -
Dependency Warnings: When I move these configurations:
CONFIG_PSA_CRYPTO_DRIVER_OBERON=n CONFIG_PSA_CRYPTO_DRIVER_CC3XX=yto
prj.conf, everything compiles without any warnings. However, I'd like to keep these board-dependent settings in thedefconfigfile rather thanprj.conf. -
Additional Configuration Conflict: Similarly, when I set:
- In
defconfig:CONFIG_ENTROPY_NRF5_BIAS_CORRECTION=y CONFIG_ENTROPY_NRF5_RNG=y - In
prj.conf:CONFIG_ENTROPY_GENERATOR=y
I get warnings that
CONFIG_ENTROPY_NRF5_BIAS_CORRECTIONandCONFIG_ENTROPY_NRF5_RNGrequireCONFIG_ENTROPY_GENERATOR. - In
Question
I assumed defconfig, prj.conf, and the CONFIG_ values from CMake would merge together. Are there specific dependencies or order constraints that prevent these configurations from working as expected? Or might I be misunderstanding the configuration merge process?