Description
To get the nrf54LM20 runing there are two Kconfig settings you need to add:
CONFIG_MBEDTLS_LEGACY_CRYPTO_C=y
CONFIG_MBEDTLS_HEAP_SIZE=49152 # Should this be larger?
Expected Behavior
The default value for CONFIG_MBEDTLS_HEAP_SIZE is 10240, this is evidently not enough heap space. This will give these unhelpful errors:
<err> net_sock_tls: TLS handshake error: -0x5180
<err> golioth_coap_client_zephyr: Failed to connect to socket: -113
<err> golioth_coap_client_zephyr: Failed to connect: -113
<wrn> golioth_coap_client_zephyr: Failed to connect: -113
(May also get)
<err> golioth_coap_client_zephyr: Failed to connect to socket: -12
<err> golioth_coap_client_zephyr: Failed to connect: -12
<wrn> golioth_coap_client_zephyr: Failed to connect: -12
CONFIG_MBEDTLS_HEAP_SIZE=49152 resolved these errors.
Note: I don’t know how close this is to the edge of not working. It may be prudent to allocate even more. Checking the nrf Kconfigs it it set to 15k if CONFIG_OPENTHREAD_NRF_SECURITYis set.
Actual Behavior
One would hope that MbedTLS would be able to detect heap exhaustion. It will if you try set CONFIG_MBEDTLS_HEAP_SIZE=256. But it’s having issues in this case.
Environment
Linux
Nrf SDK 3.2.1
Toolchain 3.2.0
Golioth: v0.22.0
Logs and Console Output
For more debug info you can enable these settings:
# --- Logging ---
CONFIG_LOG=y
CONFIG_LOG_BLOCK_IN_THREAD=y
CONFIG_LOG_BUFFER_SIZE=65536
CONFIG_NET_LOG=y
CONFIG_NET_PKT_LOG_LEVEL_WRN=y
CONFIG_MBEDTLS_LOG_LEVEL_DBG=y
CONFIG_TLS_CREDENTIALS_LOG_LEVEL_DBG=y
CONFIG_NET_SOCKETS_LOG_LEVEL_INF=y
CONFIG_DNS_RESOLVER_LOG_LEVEL_INF=y
CONFIG_COAP_LOG_LEVEL_INF=y
CONFIG_NET_L2_PPP_LOG_LEVEL_INF=y
CONFIG_NET_BUF_LOG_LEVEL_INF=y
CONFIG_NET_UDP_LOG_LEVEL_INF=y
CONFIG_GOLIOTH_LOG_LEVEL_INF=y
CONFIG_MBEDTLS_DEBUG=y
CONFIG_MBEDTLS_DEBUG_C=y
CONFIG_MBEDTLS_SSL_DEBUG_ALL=y
CONFIG_MBEDTLS_DEBUG_LEVEL=4