zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.49k stars 6.42k forks source link

Can't build WiFi support on esp32, esp32s2, esp32c3 #44250

Closed brentalanmiller closed 2 years ago

brentalanmiller commented 2 years ago

Describe the bug When trying to enable WiFi support on the Espressif line of boards, the build always fails because of mbedtls errors in the espressif hal library.

This seems to be across all supported boards, and versions of Zephyr that have support for these devices. (3.0.0, 2.7.0, etc.)

I'm building on Ubuntu 20.04. While trying to research the error, I found a user on the zephyr-users list who had the same issue back in 2.6.0, so maybe the driver never worked correctly, or that we're both trying to enable the driver incorrectly.

To Reproduce Steps to reproduce the behavior:

  1. cd ~/zephyrproject/zephyr
  2. git checkout v3.0.0
  3. west update
  4. west espressif update
  5. west espressif install
  6. export ZEPHYR_TOOLCHAIN_VARIANT="espressif"
  7. export ESPRESSIF_TOOLCHAIN_PATH="/home/bmiller/.espressif/tools/zephyr"
  8. west build -b esp32c3_devkitm samples/net/wifi/ -- -DCONFIG_WIFI_ESP32=y
  9. The following error occurs:
    
    -- west build: generating a build system
    Including boilerplate (Zephyr base): /home/bmiller/zephyrproject/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/bmiller/zephyrproject/zephyr/samples/net/wifi
    -- Zephyr version: 3.0.0 (/home/bmiller/zephyrproject/zephyr)
    -- Found Python3: /home/bmiller/zephyrproject/.venv/bin/python3.8 (found suitable exact version "3.8.10") found components: Interpreter 
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: esp32c3_devkitm
    -- Cache files will be written to: /home/bmiller/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found BOARD.dts: /home/bmiller/zephyrproject/zephyr/boards/riscv/esp32c3_devkitm/esp32c3_devkitm.dts
    -- Generated zephyr.dts: /home/bmiller/zephyrproject/zephyr/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/bmiller/zephyrproject/zephyr/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/bmiller/zephyrproject/zephyr/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/bmiller/zephyrproject/zephyr/build/zephyr/dts.cmake
    /home/bmiller/zephyrproject/zephyr/build/zephyr/zephyr.dts:82.37-86.8: Warning (unit_address_format): /soc/flash-controller@60002000/flash@0/partitions/partition@0000: unit name should not have leading 0s

warning: TEST_RANDOM_GENERATOR (defined at subsys/random/Kconfig:8) was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: (!ENTROPY_HAS_DRIVER) (=n). See http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_TEST_RANDOM_GENERATOR.html and/or look up TEST_RANDOM_GENERATOR 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.

Parsing /home/bmiller/zephyrproject/zephyr/Kconfig Loaded configuration '/home/bmiller/zephyrproject/zephyr/boards/riscv/esp32c3_devkitm/esp32c3_devkitm_defconfig' Merged configuration '/home/bmiller/zephyrproject/zephyr/samples/net/wifi/prj.conf' Merged configuration '/home/bmiller/zephyrproject/zephyr/build/zephyr/misc/generated/extra_kconfig_options.conf' Configuration saved to '/home/bmiller/zephyrproject/zephyr/build/zephyr/.config' Kconfig header saved to '/home/bmiller/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h' -- Found toolchain: espressif (/home/bmiller/.espressif/tools/zephyr) -- The C compiler identification is GNU 8.4.0 -- The CXX compiler identification is GNU 8.4.0 -- The ASM compiler identification is GNU -- Found assembler: /home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/riscv32-esp-elf-gcc CMake Warning at /home/bmiller/zephyrproject/zephyr/CMakeLists.txt:775 (message): No SOURCES given to Zephyr library: subsysnetpkt_filter

Excluding target from build.

-- Configuring done -- Generating done -- Build files have been written to: /home/bmiller/zephyrproject/zephyr/build -- west build: building application [1/370] Preparing syscall dependency handling

[10/370] Generating include/generated/version.h -- Zephyr version: 3.0.0 (/home/bmiller/zephyrproject/zephyr), build: zephyr-v3.0.0 [174/370] Building C object zephyr/CMakeFiles/zephyr.dir/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c.obj FAILED: zephyr/CMakeFiles/zephyr.dir/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c.obj ccache /home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/riscv32-esp-elf-gcc -DCONFIG_DPP -DCONFIG_ECC -DCONFIG_IEEE80211W -DCONFIG_SHA256 -DCONFIG_WPA3_SAE -DEAP_MSCHAPv2 -DEAP_PEAP -DEAP_PEER_METHOD -DESP32_WORKAROUND -DESPRESSIF_USE -DESP_PLATFORM -DESP_SUPPLICANT -DIEEE8021X_EAPOL -DKERNEL -DMBEDTLS_CONFIG_FILE=\"config-tls-generic.h\" -DUSE_WPA2_TASK -D_FORTIFY_SOURCE=2 -DZEPHYR=1 -Dets -I/home/bmiller/zephyrproject/zephyr/kernel/include -I/home/bmiller/zephyrproject/zephyr/arch/riscv/include -I/home/bmiller/zephyrproject/zephyr/include -I/home/bmiller/zephyrproject/zephyr/build/zephyr/include/generated -I/home/bmiller/zephyrproject/zephyr/soc/riscv/esp32c3 -I/home/bmiller/zephyrproject/zephyr/lib/util/fnmatch/. -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/include/bt -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/include/wifi -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/include/crypto -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../esp_shared/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_common/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_rom/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_rom/include/esp32c3 -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp32c3/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_hw_support/port/esp32c3/private_include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_hw_support/port/esp32c3 -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_hw_support/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/riscv/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/hal/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/hal/esp32c3/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/soc/esp32c3/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/soc/src/esp32c3/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/soc/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/driver/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/efuse/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/efuse/esp32c3/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/efuse/private_include/esp32c3 -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_system/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_event/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_timer/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_timer/private_include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_netif/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/log/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/spi_flash/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/spi_flash/private_include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/bootloader_support/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/bootloader_support/include_bootloader -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_wifi/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_wifi/esp32c3/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/wpa_supplicant/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/wpa_supplicant/port/include -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/wpa_supplicant/src -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/wpa_supplicant/include/esp_supplicant -I/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/wpa_supplicant/src/crypto -I/home/bmiller/zephyrproject/modules/crypto/mbedtls/include -I/home/bmiller/zephyrproject/zephyr/modules/mbedtls/configs -isystem /home/bmiller/zephyrproject/zephyr/lib/libc/minimal/include -Os -imacros /home/bmiller/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mabi=ilp32 -march=rv32ima -imacros /home/bmiller/zephyrproject/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/home/bmiller/zephyrproject/zephyr/samples/net/wifi=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/bmiller/zephyrproject/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/bmiller/zephyrproject=WEST_TOPDIR -ffunction-sections -fdata-sections -Wno-unused-variable -Wno-maybe-uninitialized -std=c99 -MD -MT zephyr/CMakeFiles/zephyr.dir/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c.obj -MF zephyr/CMakeFiles/zephyr.dir/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c.obj -c /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c In file included from /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:21: /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_point_add': /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:266: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/bmiller/zephyrproject/modules/crypto/mbedtls/include/mbedtls/bignum.h:47:22: note: in definition of macro 'MBEDTLS_MPI_CHK' if( ( ret = (f) ) != 0 ) \ ^ /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_set_pubkey_point': /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:576: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:576:39: error: invalid type argument of '->' (have 'int') mbedtls_ecp_copy(&mbedtls_pk_ec(key)->Q, point); ^~ /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:577:45: error: invalid type argument of '->' (have 'int') mbedtls_ecp_group_load(&mbedtls_pk_ec(key)->grp, MBEDTLS_ECP_DP_SECP256R1); ^~ /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_public_key': /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:604:56: error: invalid type argument of '->' (have 'int') return (struct crypto_ec_point )&mbedtls_pk_ec(pkey)->Q; ^~ /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_group_from_key': /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:632:57: error: invalid type argument of '->' (have 'int') return (struct crypto_ec_group )&(mbedtls_pk_ec(pkey)->grp); ^~ /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_private_key': /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:639:56: error: invalid type argument of '->' (have 'int') return ((struct crypto_bignum )&(mbedtls_pk_ec(pkey)->d)); ^~ /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ecdh': /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:759: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:36: /home/bmiller/zephyrproject/modules/crypto/mbedtls/include/mbedtls/ecdh.h:348: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:768: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:36:
/home/bmiller/zephyrproject/modules/crypto/mbedtls/include/mbedtls/ecdh.h:348: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ecdsa_get_sign':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:798: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:803: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:805: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:808: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:808: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:809:8: error: request for member 'd' in something not a structure or union
    &ctx->d, hash, SHA256_MAC_LEN, crypto_rng_wrapper, NULL);
        ^~
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:812: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_edcsa_sign_verify':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:824: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:834: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:834:37: error: request for member 'grp' in something not a structure or union
  if((ret = mbedtls_ecdsa_verify(&ctx->grp, hash, hlen,
                                     ^~
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:835:10: error: request for member 'Q' in something not a structure or union
      &ctx->Q, (mbedtls_mpi *)r, (mbedtls_mpi *)s)) != 0){
          ^~
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_gen_keypair':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:899: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:31:
/home/bmiller/zephyrproject/modules/crypto/mbedtls/include/mbedtls/ecp.h:1202: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'pk_write_ec_param':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:922: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:38:
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'mbedtls_pk_write_pubkey_formatted':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:960: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/bmiller/zephyrproject/modules/crypto/mbedtls/include/mbedtls/asn1write.h:32:22: note: in definition of macro 'MBEDTLS_ASN1_CHK_ADD'
         if( ( ret = (f) ) < 0 )                         \
                      ^
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:931: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/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:38:
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_pk_write_formatted_pubkey_der':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:1004: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/bmiller/zephyrproject/modules/crypto/mbedtls/include/mbedtls/asn1write.h:32:22: note: in definition of macro 'MBEDTLS_ASN1_CHK_ADD'
         if( ( ret = (f) ) < 0 )                         \
                      ^
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:915:24: note: expected 'mbedtls_ecp_keypair *' {aka 'struct mbedtls_ecp_keypair *'} but argument is of type 'int'
   mbedtls_ecp_keypair *ec )
   ~~~~~~~~~~~~~~~~~~~~~^~
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_public_key':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:605:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_group_from_key':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:633:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c: In function 'crypto_ec_get_private_key':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:640:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
[196/370] Performing configure step for 'EspIdfBootloader'
CMake Warning at /home/bmiller/zephyrproject/modules/hal/espressif/tools/cmake/idf.cmake:24 (message):
  IDF_PATH environment variable not found.  Setting IDF_PATH to
  '/home/bmiller/zephyrproject/modules/hal/espressif'.
Call Stack (most recent call first):
  /home/bmiller/zephyrproject/modules/hal/espressif/tools/cmake/project.cmake:7 (include)
  CMakeLists.txt:34 (include)

-- Found Git: /usr/bin/git (found version "2.25.1") 
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/riscv32-esp-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/riscv32-esp-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32c3
-- Project sdkconfig file /home/bmiller/zephyrproject/zephyr/build/esp-idf/build/sdkconfig
-- Adding linker script /home/bmiller/zephyrproject/modules/hal/espressif/components/esp32c3/ld/esp32c3.peripherals.ld
-- Adding linker script /home/bmiller/zephyrproject/modules/hal/espressif/components/esp_rom/esp32c3/ld/esp32c3.rom.ld
-- Adding linker script /home/bmiller/zephyrproject/modules/hal/espressif/components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld
-- Adding linker script /home/bmiller/zephyrproject/modules/hal/espressif/components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld
-- Adding linker script /home/bmiller/zephyrproject/modules/hal/espressif/components/esp_rom/esp32c3/ld/esp32c3.rom.newlib.ld
-- Adding linker script /home/bmiller/zephyrproject/modules/hal/espressif/components/bootloader/subproject/main/ld/esp32c3/bootloader.ld
-- Components: bootloader bootloader_support efuse esp32c3 esp_common esp_hw_support esp_rom esp_system esptool_py hal log main micro-ecc newlib partition_table riscv soc spi_flash
-- Component paths: /home/bmiller/zephyrproject/modules/hal/espressif/components/bootloader /home/bmiller/zephyrproject/modules/hal/espressif/components/bootloader_support /home/bmiller/zephyrproject/modules/hal/espressif/components/efuse /home/bmiller/zephyrproject/modules/hal/espressif/components/esp32c3 /home/bmiller/zephyrproject/modules/hal/espressif/components/esp_common /home/bmiller/zephyrproject/modules/hal/espressif/components/esp_hw_support /home/bmiller/zephyrproject/modules/hal/espressif/components/esp_rom /home/bmiller/zephyrproject/modules/hal/espressif/components/esp_system /home/bmiller/zephyrproject/modules/hal/espressif/components/esptool_py /home/bmiller/zephyrproject/modules/hal/espressif/components/hal /home/bmiller/zephyrproject/modules/hal/espressif/components/log /home/bmiller/zephyrproject/modules/hal/espressif/components/bootloader/subproject/main /home/bmiller/zephyrproject/modules/hal/espressif/components/bootloader/subproject/components/micro-ecc /home/bmiller/zephyrproject/modules/hal/espressif/components/newlib /home/bmiller/zephyrproject/modules/hal/espressif/components/partition_table /home/bmiller/zephyrproject/modules/hal/espressif/components/riscv /home/bmiller/zephyrproject/modules/hal/espressif/components/soc /home/bmiller/zephyrproject/modules/hal/espressif/components/spi_flash
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bmiller/zephyrproject/zephyr/build/esp-idf/build/bootloader
[199/370] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/net_if.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/bmiller/zephyrproject/zephyr/build
```

**Expected behavior**
To be able to build without error, flash, and utilize the wifi shell commands.

**Impact**
Cannot use wifi on the espressif line of modules

**Environment (please complete the following information):**
 - OS: Ubuntu 20.04
 - Toolchain: espressif sdk, as installed by west
 - Zephyr version v3.0.0, but similar errors in previous versions

**Additional context**
The example above shows the esp32c3 dev board, but the error is the same regardless of board used. The same errors occur on earlier versions of Zephyr as well, although some versions require the enabling of ethernet for some reason.
sylvioalves commented 2 years ago

@brentalanmiller This has been fixed already, would you retry? (west update).

jordan-hardy commented 2 years ago

@brentalanmiller there's a couple configs not set in the sample that esp boards need, try adding these to samples/wifi/prj.conf:

# ESP-Specific Configs
CONFIG_WIFI_ESP32=y

CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_ENTROPY_ENABLED=y
CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED=y
CONFIG_MBEDTLS_ECP_ALL_ENABLED=y

CONFIG_NET_L2_ETHERNET=y
brentalanmiller commented 2 years ago

@sylvioalves I tried running west update again, rebuilt, and I got the same error as before. I checked out the main branch of zephyr (at c5b59282d6bcbcc5eedaf29b386c90c77036440b) and the error still occurs.

I even just tried installing zephyr on a new machine also running Ubuntu 20.04 and still get the error.

@jhardyswym Thanks, it looks like those options got me closer, but now I'm getting:

-- west build: generating a build system
-- Application: /home/bmiller/zephyrproject/zephyr/samples/net/wifi
-- Zephyr version: 3.0.0 (/home/bmiller/zephyrproject/zephyr)
-- Found west (found suitable version "0.13.0", minimum required is "0.7.1")
-- Board: esp32c3_devkitm
-- Cache files will be written to: /home/bmiller/.cache/zephyr
-- Found dtc: /usr/bin/dtc (found suitable version "1.5.0", minimum required is "1.4.6")
-- Found BOARD.dts: /home/bmiller/zephyrproject/zephyr/boards/riscv/esp32c3_devkitm/esp32c3_devkitm.dts
-- Generated zephyr.dts: /home/bmiller/zephyrproject/zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /home/bmiller/zephyrproject/zephyr/build/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: /home/bmiller/zephyrproject/zephyr/build/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: /home/bmiller/zephyrproject/zephyr/build/zephyr/dts.cmake
Parsing /home/bmiller/zephyrproject/zephyr/Kconfig
Loaded configuration '/home/bmiller/zephyrproject/zephyr/build/zephyr/.config'
No change to configuration in '/home/bmiller/zephyrproject/zephyr/build/zephyr/.config'
No change to Kconfig header in '/home/bmiller/zephyrproject/zephyr/build/zephyr/include/generated/autoconf.h'
-- Found toolchain: espressif (/home/bmiller/.espressif/tools/zephyr)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bmiller/zephyrproject/zephyr/build
-- west build: building application
[1/79] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
[2/79] Building C object zephyr/CMakeFiles/offsets.dir/arch/riscv/core/offsets/offsets.c.obj
[3/79] Generating include/generated/offsets.h
[4/79] Building ASM object zephyr/arch/arch/riscv/core/CMakeFiles/arch__riscv__core.dir/isr.S.obj
[5/79] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/shell/modules/device_service.c.obj
[6/79] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/shell/modules/devmem_service.c.obj
[7/79] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/shell/modules/kernel_service.c.obj
[8/79] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/shell/shell_utils.c.obj
[9/79] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/shell/backends/shell_uart.c.obj
[10/79] Building C object zephyr/drivers/entropy/CMakeFiles/drivers__entropy.dir/entropy_esp32.c.obj
[11/79] Building C object zephyr/drivers/console/CMakeFiles/drivers__console.dir/uart_console.c.obj
[12/79] Building ASM object zephyr/CMakeFiles/zephyr.dir/soc/riscv/esp32c3/soc_irq.S.obj
[13/79] Building C object zephyr/CMakeFiles/zephyr.dir/drivers/pinmux/pinmux_esp32.c.obj
[14/79] Building ASM object zephyr/arch/arch/riscv/core/CMakeFiles/arch__riscv__core.dir/swap.S.obj
[15/79] Building C object zephyr/lib/libc/minimal/CMakeFiles/lib__libc__minimal.dir/source/stdlib/malloc.c.obj
[16/79] Building C object zephyr/subsys/net/l2/ethernet/CMakeFiles/subsys__net__l2__ethernet.dir/ethernet_stats.c.obj
[17/79] Building C object zephyr/subsys/net/l2/ethernet/CMakeFiles/subsys__net__l2__ethernet.dir/arp.c.obj
[18/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/utils.c.obj
[19/79] Building C object zephyr/subsys/net/l2/ethernet/CMakeFiles/subsys__net__l2__ethernet.dir/ethernet.c.obj
[20/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/net_core.c.obj
[21/79] Building C object zephyr/subsys/net/l2/wifi/CMakeFiles/subsys__net__l2__wifi.dir/wifi_mgmt.c.obj
[22/79] Building C object zephyr/subsys/net/l2/wifi/CMakeFiles/subsys__net__l2__wifi.dir/wifi_shell.c.obj
[23/79] Linking C static library zephyr/drivers/console/libdrivers__console.a
[24/79] Generating linker_zephyr_pre0.cmd
[25/79] Generating linker_zephyr_pre1.cmd
[26/79] Linking C static library zephyr/drivers/entropy/libdrivers__entropy.a
[27/79] Linking C static library zephyr/arch/arch/riscv/core/libarch__riscv__core.a
[28/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/net_if.c.obj
[29/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/connection.c.obj
[30/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/udp.c.obj
[31/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/net_shell.c.obj
[32/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/net_mgmt.c.obj
[33/79] Linking C static library zephyr/subsys/net/l2/ethernet/libsubsys__net__l2__ethernet.a
[34/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/net_context.c.obj
[35/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/net_pkt.c.obj
[36/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/icmpv4.c.obj
[37/79] Linking C static library zephyr/lib/libc/minimal/liblib__libc__minimal.a
[38/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/net_tc.c.obj
[39/79] Linking C static library zephyr/subsys/net/l2/wifi/libsubsys__net__l2__wifi.a
[40/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/ipv4.c.obj
[41/79] Building C object zephyr/subsys/random/CMakeFiles/subsys__random.dir/rand32_entropy_device.c.obj
[42/79] Building C object zephyr/drivers/clock_control/CMakeFiles/drivers__clock_control.dir/clock_control_esp32.c.obj
[43/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/tcp.c.obj
[44/79] Building C object zephyr/drivers/i2c/CMakeFiles/drivers__i2c.dir/i2c_shell.c.obj
[45/79] Building C object zephyr/subsys/net/ip/CMakeFiles/subsys__net__ip.dir/net_stats.c.obj
[46/79] Building C object zephyr/drivers/gpio/CMakeFiles/drivers__gpio.dir/gpio_esp32.c.obj
[47/79] Building C object zephyr/drivers/i2c/CMakeFiles/drivers__i2c.dir/i2c_esp32.c.obj
[48/79] Building C object zephyr/drivers/i2c/CMakeFiles/drivers__i2c.dir/i2c_common.c.obj
[49/79] Building C object zephyr/drivers/wifi/CMakeFiles/drivers__wifi.dir/esp32/src/esp_wifi_drv.c.obj
[50/79] Building C object zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_esp32.c.obj
[51/79] Building C object zephyr/drivers/timer/CMakeFiles/drivers__timer.dir/esp32c3_sys_timer.c.obj
[52/79] Building C object modules/mbedtls/CMakeFiles/modules__mbedtls.dir/zephyr_init.c.obj
[53/79] Building C object zephyr/kernel/CMakeFiles/kernel.dir/banner.c.obj
[54/79] Linking C static library zephyr/subsys/random/libsubsys__random.a
[55/79] Linking C static library zephyr/drivers/clock_control/libdrivers__clock_control.a
[56/79] Building C object zephyr/kernel/CMakeFiles/kernel.dir/device.c.obj
[57/79] Building C object zephyr/kernel/CMakeFiles/kernel.dir/kheap.c.obj
[58/79] Building C object zephyr/kernel/CMakeFiles/kernel.dir/init.c.obj
[59/79] Building C object zephyr/kernel/CMakeFiles/kernel.dir/xip.c.obj
[60/79] Linking C static library zephyr/drivers/wifi/libdrivers__wifi.a
[61/79] Linking C static library zephyr/drivers/gpio/libdrivers__gpio.a
[62/79] Linking C static library zephyr/drivers/timer/libdrivers__timer.a
[63/79] Linking C static library zephyr/drivers/serial/libdrivers__serial.a
[64/79] Linking C static library zephyr/drivers/i2c/libdrivers__i2c.a
[65/79] Linking C static library zephyr/subsys/net/ip/libsubsys__net__ip.a
[66/79] Linking C static library zephyr/libzephyr.a
[67/79] Linking C static library zephyr/kernel/libkernel.a
[68/79] Linking C static library modules/mbedtls/libmodules__mbedtls.a
[69/79] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/bmiller/zephyrproject/zephyr/build/zephyr/zephyr_pre0.map 
: && ccache /home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/riscv32-esp-elf-gcc   zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/riscv/core/offsets/offsets.c.obj  -fuse-ld=bfd  -Wl,-T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/bmiller/zephyrproject/zephyr/build/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/riscv/core/libarch__riscv__core.a  zephyr/lib/libc/minimal/liblib__libc__minimal.a  zephyr/lib/posix/liblib__posix.a  zephyr/subsys/net/libsubsys__net.a  zephyr/subsys/net/l2/ethernet/libsubsys__net__l2__ethernet.a  zephyr/subsys/net/l2/wifi/libsubsys__net__l2__wifi.a  zephyr/subsys/net/ip/libsubsys__net__ip.a  zephyr/subsys/random/libsubsys__random.a  zephyr/drivers/interrupt_controller/libdrivers__interrupt_controller.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/i2c/libdrivers__i2c.a  zephyr/drivers/wifi/libdrivers__wifi.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/entropy/libdrivers__entropy.a  zephyr/drivers/timer/libdrivers__timer.a  modules/mbedtls/libmodules__mbedtls.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L"/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0"  -L/home/bmiller/zephyrproject/zephyr/build/zephyr  -lgcc  zephyr/arch/common/libisr_tables.a  -no-pie  -mabi=ilp32  -march=rv32ima  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -T/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/linker/esp32c3.rom.alias.ld  -T/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_rom/esp32c3/ld/esp32c3.rom.ld  -T/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_rom/esp32c3/ld/esp32c3.rom.api.ld  -T/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_rom/esp32c3/ld/esp32c3.rom.libgcc.ld  -T/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp32c3/ld/esp32c3.peripherals.ld  -lnet80211  -lcore  -lpp  -lcoexist  -lphy  -lmesh  -lgcc  -L/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp32c3  -L/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/../../components/esp_wifi/lib/esp32c3  -Wl,--defsym,phy_printf=printf  -Wl,--defsym,net80211_printf=printf  -Wl,--defsym,coexist_printf=printf  -Wl,--defsym,pp_printf=printf && cd /home/bmiller/zephyrproject/zephyr/build/zephyr && /usr/bin/cmake -E echo
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_timer.c.obj): in function `esp_timer_create':
/home/bmiller/zephyrproject/modules/hal/espressif/components/esp_timer/src/esp_timer.c:138: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj): in function `spin_lock_create_wrapper':
/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:168: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj): in function `wifi_calloc':
/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:98: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj): in function `calloc_internal_wrapper':
/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:474: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj): in function `wifi_calloc':
/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:98: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj): in function `calloc_internal_wrapper':
/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:474: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj): in function `recursive_mutex_create_wrapper':
/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:248: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj): in function `wifi_thread_semphr_get_wrapper':
/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:212: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj): in function `semphr_create_wrapper':
/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:195: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj): in function `wifi_malloc':
/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:78: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj): in function `malloc_internal_wrapper':
/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:455: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wifi_adapter.c.obj):/home/bmiller/zephyrproject/modules/hal/espressif/zephyr/esp32c3/src/wifi/esp_wifi_adapter.c:285: more undefined references to `k_malloc' follow
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(pmksa_cache.c.obj): in function `pmksa_cache_add':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c:118: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(pmksa_cache.c.obj): in function `pmksa_cache_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c:502: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(phy_init.c.obj): in function `phy_digital_regs_store':
/home/bmiller/zephyrproject/modules/hal/espressif/components/esp_wifi/src/phy_init.c:235: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(phy_init.c.obj): in function `esp_phy_load_cal_and_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/esp_wifi/src/phy_init.c:626: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(wpa_auth.c.obj): in function `wpa_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth.c:320: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(wpa_auth.c.obj): in function `wpa_group_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth.c:267: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(wpa_auth.c.obj): in function `wpa_auth_sta_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth.c:358: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(wpa_auth.c.obj): in function `__wpa_send_eapol':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth.c:1007: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth.c:1097: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth.c:1024: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(wpa_auth.c.obj): in function `sm_WPA_PTK_GROUP_REKEYNEGOTIATING_Enter':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth.c:2018: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(wpa_auth.c.obj): in function `sm_WPA_PTK_PTKINITNEGOTIATING_Enter':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth.c:1749: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(wpa_auth.c.obj): in function `wpa_request_new_ptk':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth.c:457: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(sae.c.obj): in function `sae_set_group':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/common/sae.c:35: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(sae.c.obj): in function `sae_parse_commit_element_ecc':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/common/sae.c:1114: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(ap_config.c.obj): in function `hostapd_derive_psk':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/ap_config.c:123: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(wpa_auth_ie.c.obj): in function `wpa_auth_gen_wpa_ie':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth_ie.c:334: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(wpa_auth_ie.c.obj): in function `wpa_validate_wpa_ie':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/ap/wpa_auth_ie.c:572: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(aes-internal-dec.c.obj): in function `aes_decrypt_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/aes-internal-dec.c:74: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(aes-internal-enc.c.obj): in function `aes_encrypt_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/aes-internal-enc.c:110: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(ccmp.c.obj): in function `ccmp_decrypt':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/ccmp.c:149: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(ccmp.c.obj):/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/ccmp.c:195: more undefined references to `k_malloc' follow
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(crypto_mbedtls-bignum.c.obj): in function `crypto_bignum_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-bignum.c:29: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(crypto_mbedtls-bignum.c.obj): in function `crypto_bignum_init_set':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-bignum.c:43: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(crypto_mbedtls-ec.c.obj): in function `crypto_ec_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:88: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(crypto_mbedtls-ec.c.obj): in function `crypto_ec_point_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:122: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(crypto_mbedtls-ec.c.obj): in function `crypto_ec_point_from_bin':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:240: undefined reference to `k_calloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(crypto_mbedtls-ec.c.obj):/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c:384: more undefined references to `k_calloc' follow
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wpa_main.c.obj): in function `esp_supplicant_init':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/esp_supplicant/esp_wpa_main.c:233: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(esp_wpas_glue.c.obj): in function `wpa_sm_alloc_eapol':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.c:32: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(common.c.obj): in function `dup_binstr':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/utils/common.c:355: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(common.c.obj): in function `wpa_config_parse_string':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/utils/common.c:262: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: /home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/utils/common.c:279: undefined reference to `k_malloc'
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(common.c.obj):/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/utils/common.c:287: more undefined references to `k_malloc' follow
/home/bmiller/.espressif/tools/zephyr/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.bfd: zephyr/libzephyr.a(wpabuf.c.obj): in function `wpabuf_alloc':
/home/bmiller/zephyrproject/modules/hal/espressif/components/wpa_supplicant/src/utils/wpabuf.c:127: undefined reference to `k_calloc'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
brentalanmiller commented 2 years ago

I just retried the above configuration options with the esp32 board and they do work there. It seems the above failure where k_malloc can't be found only happens with the esp32c3_devkitm board.

brentalanmiller commented 2 years ago

Would it make sense to open a small PR that makes those modules a dependency of the WIFI_ESP32 driver like this? https://github.com/brentalanmiller/zephyr/commit/66cd6bf57bdedd12034cb7369f8693c552b9e1a8

Also, I just came across the samples/boards/esp32/wifi_station example and I'm able to successfully compile this project across on all of three of the supported Espressif modules. (It has the configuration options that @jhardyswym mentioned, and the C3 builds successfully with that sample project.) The C3 won't actually connect to wifi with that project, but that looks like its being addressed in #43655

cfriedt commented 2 years ago

@sylvioalves - will this require backport for v2.7.2?

sylvioalves commented 2 years ago

I guess no. WiFi support is available only when using the boards/esp32/wifi_station sample as it uses hal_espressifcalls. samples/net/wifi isn't supported yet for ESP family. I mean, you might build it, but wifi scan, connect, disconnect commands won't work. I plan to submit this during next week, which will then make samples/net/wifi to work properly.

sylvioalves commented 2 years ago

@brentalanmiller Regarding your comment about ESP32C3 not connecting to wifi station, check #43655. A few ESP32C3 boards do connect to wifi, others don't. I have been also working on getting this fixed. Is that the same issue you are facing?

brentalanmiller commented 2 years ago

@sylvioalves, yes the c3 issue appears to be the same one in the other ticket.

brentalanmiller commented 2 years ago

Thanks for all the help and clarification everyone, I appreciate it.