Building ESP32 WiFi sample


Matias N.
 

Hi,
I'm starting to test Zephyr (v2.6) for support of ESP32 features (interested in WiFi and BLE). Right now
I'm looking at trying out wifi. I managed to build and flash the hello world sample successfully and
now I was trying the "wifi" sample (I'm not sure if that is supposed to be work as I understand ESP32 WiFi
is a recent addition).

I enabled ESP32 WIFI SoC support in menuconfig and then it failed to build since it seems ethernet support
needs to be on. After enabling that I got quite a few more errors which I'm not sure how to address:

In file included from /home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:17:
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_point_add':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:246:18: warning: implicit declaration of function 'mbedtls_ecp_muladd'; did you mean 'mbedtls_ecp_mul'? [-Wimplicit-function-declaration]
  MBEDTLS_MPI_CHK(mbedtls_ecp_muladd(&e->group, (mbedtls_ecp_point *) c, &one, (const mbedtls_ecp_point *)a , &one, (const mbedtls_ecp_point *)b));
                  ^~~~~~~~~~~~~~~~~~
/home/v01d/coding/zephyr/modules/crypto/mbedtls/mbedtls/include/mbedtls/bignum.h:50:22: note: in definition of macro 'MBEDTLS_MPI_CHK'
         if( ( ret = (f) ) != 0 ) \
                      ^
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_set_pubkey_point':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:532:20: warning: implicit declaration of function 'mbedtls_pk_ec'; did you mean 'mbedtls_pk_free'? [-Wimplicit-function-declaration]
  mbedtls_ecp_copy(&mbedtls_pk_ec(*key)->Q, point);
                    ^~~~~~~~~~~~~
                    mbedtls_pk_free
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:532:39: error: invalid type argument of '->' (have 'int')
  mbedtls_ecp_copy(&mbedtls_pk_ec(*key)->Q, point);
                                       ^~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:533:45: error: invalid type argument of '->' (have 'int')
  mbedtls_ecp_group_load(&mbedtls_pk_ec(*key)->grp, MBEDTLS_ECP_DP_SECP256R1);
                                             ^~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_public_key':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:560:56: error: invalid type argument of '->' (have 'int')
  return (struct crypto_ec_point *)&mbedtls_pk_ec(*pkey)->Q;
                                                        ^~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_group_from_key':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:588:57: error: invalid type argument of '->' (have 'int')
  return (struct crypto_ec_group *)&(mbedtls_pk_ec(*pkey)->grp);
                                                         ^~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_private_key':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:595:56: error: invalid type argument of '->' (have 'int')
  return ((struct crypto_bignum *)&(mbedtls_pk_ec(*pkey)->d));
                                                        ^~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ecdh':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:715:35: warning: passing argument 2 of 'mbedtls_ecdh_get_params' makes pointer from integer without a cast [-Wint-conversion]
  if (mbedtls_ecdh_get_params(ctx, mbedtls_pk_ec(*own), MBEDTLS_ECDH_OURS) < 0) {
                                   ^~~~~~~~~~~~~~~~~~~
In file included from /home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:32:
/home/v01d/coding/zephyr/modules/crypto/mbedtls/mbedtls/include/mbedtls/ecdh.h:335:57: note: expected 'const mbedtls_ecp_keypair *' {aka 'const struct mbedtls_ecp_keypair *'} but argument is of type 'int'
                              const mbedtls_ecp_keypair *key,
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:724:35: warning: passing argument 2 of 'mbedtls_ecdh_get_params' makes pointer from integer without a cast [-Wint-conversion]
  if (mbedtls_ecdh_get_params(ctx, mbedtls_pk_ec(*peer), MBEDTLS_ECDH_THEIRS) < 0) {
                                   ^~~~~~~~~~~~~~~~~~~~
In file included from /home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:32:
/home/v01d/coding/zephyr/modules/crypto/mbedtls/mbedtls/include/mbedtls/ecdh.h:335:57: note: expected 'const mbedtls_ecp_keypair *' {aka 'const struct mbedtls_ecp_keypair *'} but argument is of type 'int'
                              const mbedtls_ecp_keypair *key,
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ecdsa_get_sign':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:754:2: error: unknown type name 'mbedtls_ecdsa_context'; did you mean 'mbedtls_ecdh_context'?
  mbedtls_ecdsa_context *ctx = os_malloc(sizeof(*ctx));
  ^~~~~~~~~~~~~~~~~~~~~
  mbedtls_ecdh_context
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:759:2: warning: implicit declaration of function 'mbedtls_ecdsa_init'; did you mean 'mbedtls_ecdh_init'? [-Wimplicit-function-declaration]
  mbedtls_ecdsa_init(ctx);
  ^~~~~~~~~~~~~~~~~~
  mbedtls_ecdh_init
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:761:6: warning: implicit declaration of function 'mbedtls_ecdsa_from_keypair'; did you mean 'mbedtls_ecp_gen_keypair'? [-Wimplicit-function-declaration]
  if (mbedtls_ecdsa_from_keypair(ctx, mbedtls_pk_ec(*pkey)) < 0) {
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
      mbedtls_ecp_gen_keypair
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:764:8: warning: implicit declaration of function 'mbedtls_ecdsa_sign'; did you mean 'mbedtls_pk_sign'? [-Wimplicit-function-declaration]
  ret = mbedtls_ecdsa_sign(&ctx->grp, (mbedtls_mpi *)r, (mbedtls_mpi *)s,
        ^~~~~~~~~~~~~~~~~~
        mbedtls_pk_sign
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:764:31: error: request for member 'grp' in something not a structure or union
  ret = mbedtls_ecdsa_sign(&ctx->grp, (mbedtls_mpi *)r, (mbedtls_mpi *)s,
                               ^~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:765:8: error: request for member 'd' in something not a structure or union
    &ctx->d, hash, SHA256_MAC_LEN, crypto_rng_wrapper, NULL);
        ^~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:768:2: warning: implicit declaration of function 'mbedtls_ecdsa_free'; did you mean 'mbedtls_ecdh_free'? [-Wimplicit-function-declaration]
  mbedtls_ecdsa_free(ctx);
  ^~~~~~~~~~~~~~~~~~
  mbedtls_ecdh_free
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_edcsa_sign_verify':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:780:2: error: unknown type name 'mbedtls_ecdsa_context'; did you mean 'mbedtls_ecdh_context'?
  mbedtls_ecdsa_context *ctx = os_malloc(sizeof(*ctx));
  ^~~~~~~~~~~~~~~~~~~~~
  mbedtls_ecdh_context
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:790:12: warning: implicit declaration of function 'mbedtls_ecdsa_verify'; did you mean 'mbedtls_pk_verify'? [-Wimplicit-function-declaration]
  if((ret = mbedtls_ecdsa_verify(&ctx->grp, hash, hlen,
            ^~~~~~~~~~~~~~~~~~~~
            mbedtls_pk_verify
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:790:37: error: request for member 'grp' in something not a structure or union
  if((ret = mbedtls_ecdsa_verify(&ctx->grp, hash, hlen,
                                     ^~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:791:10: error: request for member 'Q' in something not a structure or union
      &ctx->Q, (mbedtls_mpi *)r, (mbedtls_mpi *)s)) != 0){
          ^~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_gen_keypair':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:855:48: warning: passing argument 2 of 'mbedtls_ecp_gen_key' makes pointer from integer without a cast [-Wint-conversion]
  mbedtls_ecp_gen_key(MBEDTLS_ECP_DP_SECP256R1, mbedtls_pk_ec(*kctx), //get this from argument
                                                ^~~~~~~~~~~~~~~~~~~~
In file included from /home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:27:
/home/v01d/coding/zephyr/modules/crypto/mbedtls/mbedtls/include/mbedtls/ecp.h:1174:76: note: expected 'mbedtls_ecp_keypair *' {aka 'struct mbedtls_ecp_keypair *'} but argument is of type 'int'
int mbedtls_ecp_gen_key( mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypair *key,
                                                       ~~~~~~~~~~~~~~~~~~~~~^~~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'pk_write_ec_param':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:878:14: warning: implicit declaration of function 'mbedtls_oid_get_oid_by_ec_grp'; did you mean 'mbedtls_oid_get_oid_by_pk_alg'? [-Wimplicit-function-declaration]
  if( ( ret = mbedtls_oid_get_oid_by_ec_grp( ec->grp.id, &oid, &oid_len ) ) != 0 )
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              mbedtls_oid_get_oid_by_pk_alg
In file included from /home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:34:
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'mbedtls_pk_write_pubkey_formatted':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:916:70: warning: passing argument 3 of 'pk_write_ec_pubkey_formatted' makes pointer from integer without a cast [-Wint-conversion]
   MBEDTLS_ASN1_CHK_ADD( len, pk_write_ec_pubkey_formatted( p, start, mbedtls_pk_ec( *key ), format ) );
                                                                      ^~~~~~~~~~~~~~~~~~~~~
/home/v01d/coding/zephyr/modules/crypto/mbedtls/mbedtls/include/mbedtls/asn1write.h:36:22: note: in definition of macro 'MBEDTLS_ASN1_CHK_ADD'
         if( ( ret = (f) ) < 0 )                         \
                      ^
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:887:24: note: expected 'mbedtls_ecp_keypair *' {aka 'struct mbedtls_ecp_keypair *'} but argument is of type 'int'
   mbedtls_ecp_keypair *ec, int format )
   ~~~~~~~~~~~~~~~~~~~~~^~
In file included from /home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:34:
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_pk_write_formatted_pubkey_der':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:960:62: warning: passing argument 3 of 'pk_write_ec_param' makes pointer from integer without a cast [-Wint-conversion]
   MBEDTLS_ASN1_CHK_ADD( par_len, pk_write_ec_param( &c, buf, mbedtls_pk_ec( *key ) ) );
                                                              ^~~~~~~~~~~~~~~~~~~~~
/home/v01d/coding/zephyr/modules/crypto/mbedtls/mbedtls/include/mbedtls/asn1write.h:36:22: note: in definition of macro 'MBEDTLS_ASN1_CHK_ADD'
         if( ( ret = (f) ) < 0 )                         \
                      ^
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:871:24: note: expected 'mbedtls_ecp_keypair *' {aka 'struct mbedtls_ecp_keypair *'} but argument is of type 'int'
   mbedtls_ecp_keypair *ec )
   ~~~~~~~~~~~~~~~~~~~~~^~
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_public_key':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:561:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_group_from_key':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:589:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_private_key':
/home/v01d/coding/zephyr/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:596:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/v01d/coding/zephyr/zephyr/samples/net/wifi/build

Best,
Matias