v4.2 Build Failure when migrating from v4.0.1

Scott.Bonomi
Posts: 73
Joined: Mon Mar 09, 2020 7:36 pm

v4.2 Build Failure when migrating from v4.0.1

Postby Scott.Bonomi » Thu Jan 21, 2021 9:17 pm

I get a build failure on my project which uses Server, SPI, NVS features when moving from 4.0.1 to v4.2 (HEAD).
Specifically there seems to be an issue in including features not needed. What I get is:
=========================================================================================
In file included from ../../components/mbedtls/mbedtls/include/mbedtls/ecp.h:45,
from C:/Users/sbonomi/Desktop/esp-idf43/components/mbedtls/mbedtls/library/ecp.c:81:
C:/Users/sbonomi/Desktop/esp-idf43/components/mbedtls/mbedtls/library/ecp.c: In function 'mbedtls_ecp_muladd_restartable':
C:/Users/sbonomi/Desktop/esp-idf43/components/mbedtls/mbedtls/library/ecp.c:2552:22: error: implicit declaration of function 'ecp_add_mixed' [-Werror=implicit-function-declaration]
MBEDTLS_MPI_CHK( ecp_add_mixed( grp, pR, pmP, pR ) );
^~~~~~~~~~~~~
../../components/mbedtls/mbedtls/include/mbedtls/bignum.h:52:22: note: in definition of macro 'MBEDTLS_MPI_CHK'
if( ( ret = (f) ) != 0 ) \
^
C:/Users/sbonomi/Desktop/esp-idf43/components/mbedtls/mbedtls/library/ecp.c:2560:22: error: implicit declaration of function 'ecp_normalize_jac' [-Werror=implicit-function-declaration]
MBEDTLS_MPI_CHK( ecp_normalize_jac( grp, pR ) );
^~~~~~~~~~~~~~~~~
../../components/mbedtls/mbedtls/include/mbedtls/bignum.h:52:22: note: in definition of macro 'MBEDTLS_MPI_CHK'
if( ( ret = (f) ) != 0 ) \
^
C:/Users/sbonomi/Desktop/esp-idf43/components/mbedtls/mbedtls/library/ecp.c: In function 'mbedtls_ecp_gen_privkey':
C:/Users/sbonomi/Desktop/esp-idf43/components/mbedtls/mbedtls/library/ecp.c:2763:1: error: label 'cleanup' defined but not used [-Werror=unused-label]
cleanup:
^~~~~~~
C:/Users/sbonomi/Desktop/esp-idf43/components/mbedtls/mbedtls/library/ecp.c:2686:12: warning: variable 'n_size' set but not used [-Wunused-but-set-variable]
size_t n_size;
^~~~~~
At top level:
C:/Users/sbonomi/Desktop/esp-idf43/components/mbedtls/mbedtls/library/ecp.c:1002:12: warning: 'ecp_modp' defined but not used [-Wunused-function]
static int ecp_modp( mbedtls_mpi *N, const mbedtls_ecp_group *grp )
^~~~~~~~
cc1.exe: some warnings being treated as errors
[53/941] Performing build step for 'bootloader'
[0/1] Re-running CMake...
================================================================================================================

In order to avoid this, I have had to set the following menuconfig flags:
CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y
CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y
all enabled. With them disabled, I get the error shown above.

I got to this point by comparing the sdkconfig files between an example with builds (softAP) and my existing project which is fine in 4.0.1. There are enough changes in the 4.2 version for wifi initiation, that it could be part of my wifi issues. I am still not getting good communication on my custom U4WDH Boards, but at least the idf.py and compiler patches have been ruled out as being the cause.
I do not know if it is any one of the above will be successful or if all are required. My assumption is that enabling one of these brings in a definition needed by the ecp.c either as an #ifdef or a conditional include. It would help to know more about the cause. as I would prefer to have a smaller image in the long run so I can work on OTA updates.

Who is online

Users browsing this forum: No registered users and 196 guests