Need help with Arduino as component for ESP32

orbitcoms
Posts: 141
Joined: Fri Aug 03, 2018 10:08 pm
Location: Sydney, Australia

Need help with Arduino as component for ESP32

Postby orbitcoms » Sun Oct 24, 2021 10:54 pm

I followed the instructions and cannot get Arduino project to compile.
Using latest version of VSCODE, WROOM32 device, esp-idf extension v1.2.0, esp-idf version 4.3

I made changes to setup
- Autostart Arduino
- Disable Mutex locks for HAL
- Set FreeRTOS tick rate to 1000

I get compile errors related to I2C for some reason?

../components/arduino/cores/esp32/esp32-hal-i2c.c:152:22: error: implicit declaration of function 'I2C_LINK_RECOMMENDED_SIZE' [-Werror=implicit-function-declaration]
uint8_t cmd_buff[I2C_LINK_RECOMMENDED_SIZE(1)] = { 0 };
../components/arduino/cores/esp32/esp32-hal-i2c.c:152:56: warning: excess elements in array initializer
uint8_t cmd_buff[I2C_LINK_RECOMMENDED_SIZE(1)] = { 0 };
^
../components/arduino/cores/esp32/esp32-hal-i2c.c:152:56: note: (near initialization for 'cmd_buff')
../components/arduino/cores/esp32/esp32-hal-i2c.c:153:11: error: implicit declaration of function 'i2c_cmd_link_create_static'; did you mean 'i2c_cmd_link_create'? [-Werror=implicit-function-declaration]
cmd = i2c_cmd_link_create_static(cmd_buff, I2C_LINK_RECOMMENDED_SIZE(1));
^~~~~~~~~~~~~~~~~~~~~~~~~~
i2c_cmd_link_create
../components/arduino/cores/esp32/esp32-hal-i2c.c:153:9: warning: assignment to 'i2c_cmd_handle_t' {aka 'void
*'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
cmd = i2c_cmd_link_create_static(cmd_buff, I2C_LINK_RECOMMENDED_SIZE(1));
^
../components/arduino/cores/esp32/esp32-hal-i2c.c:145:9: error: jump into scope of identifier with variably modified type
goto end;
^~~~
../components/arduino/cores/esp32/esp32-hal-i2c.c:174:1: note: label 'end' defined here
end:
^~~
../components/arduino/cores/esp32/esp32-hal-i2c.c:152:13: note: 'cmd_buff' declared here
uint8_t cmd_buff[I2C_LINK_RECOMMENDED_SIZE(1)] = { 0 };
^~~~~~~~

iotfans
Posts: 1
Joined: Thu Oct 28, 2021 12:15 pm

Re: Need help with Arduino as component for ESP32

Postby iotfans » Thu Oct 28, 2021 12:46 pm

Hi there,

I have got the same problem plus one more build error for ETH.cpp when trying to add a Arduino core component to ESP-IDF in the VS Code ESP-IDF environment.

Here is the build log from ESP-IDF terminal after idf.py build.

It will be super helpful if someone could help looking into this.

Thanks!


- build error for esp32-hal-i2c.c

  1. [2/9] Building C object esp-idf/arduino/CMakeFiles/__idf_arduino.dir/cores/esp32/esp32-hal-i2c.c.obj
  2. FAILED: esp-idf/arduino/CMakeFiles/__idf_arduino.dir/cores/esp32/esp32-hal-i2c.c.obj
  3.  
  4. ... ...
  5. ... ...
  6.  
  7. ../components/arduino/cores/esp32/esp32-hal-i2c.c: In function 'i2cWrite':
  8. ../components/arduino/cores/esp32/esp32-hal-i2c.c:152:22: error: implicit declaration of function 'I2C_LINK_RECOMMENDED_SIZE' [-Werror=implicit-function-declaration]    
  9.      uint8_t cmd_buff[I2C_LINK_RECOMMENDED_SIZE(1)] = { 0 };
  10.                       ^~~~~~~~~~~~~~~~~~~~~~~~~
  11. ../components/arduino/cores/esp32/esp32-hal-i2c.c:152:5: error: variable-sized object may not be initialized
  12.      uint8_t cmd_buff[I2C_LINK_RECOMMENDED_SIZE(1)] = { 0 };
  13.      ^~~~~~~
  14. ../components/arduino/cores/esp32/esp32-hal-i2c.c:152:56: warning: excess elements in array initializer
  15.      uint8_t cmd_buff[I2C_LINK_RECOMMENDED_SIZE(1)] = { 0 };
  16.                                                         ^
  17. ../components/arduino/cores/esp32/esp32-hal-i2c.c:152:56: note: (near initialization for 'cmd_buff')
  18. ../components/arduino/cores/esp32/esp32-hal-i2c.c:153:11: error: implicit declaration of function 'i2c_cmd_link_create_static'; did you mean 'i2c_cmd_link_create'? [-Werror=implicit-function-declaration]
  19.      cmd = i2c_cmd_link_create_static(cmd_buff, I2C_LINK_RECOMMENDED_SIZE(1));
  20.            ^~~~~~~~~~~~~~~~~~~~~~~~~~
  21.            i2c_cmd_link_create
  22. ../components/arduino/cores/esp32/esp32-hal-i2c.c:153:9: warning: assignment to 'i2c_cmd_handle_t' {aka 'void *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
  23.      cmd = i2c_cmd_link_create_static(cmd_buff, I2C_LINK_RECOMMENDED_SIZE(1));
  24.          ^
  25. ../components/arduino/cores/esp32/esp32-hal-i2c.c:145:9: error: jump into scope of identifier with variably modified type
  26.          goto end;
  27.          ^~~~
  28. ../components/arduino/cores/esp32/esp32-hal-i2c.c:174:1: note: label 'end' defined here
  29.  end:
  30.  ^~~
  31. ../components/arduino/cores/esp32/esp32-hal-i2c.c:152:13: note: 'cmd_buff' declared here
  32.      uint8_t cmd_buff[I2C_LINK_RECOMMENDED_SIZE(1)] = { 0 };
  33.              ^~~~~~~~
  34. ../components/arduino/cores/esp32/esp32-hal-i2c.c:176:9: error: implicit declaration of function 'i2c_cmd_link_delete_static'; did you mean 'i2c_cmd_link_delete'? [-Werror=implicit-function-declaration]
  35.          i2c_cmd_link_delete_static(cmd);
  36.          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  37.          i2c_cmd_link_delete
  38. ../components/arduino/cores/esp32/esp32-hal-i2c.c: In function 'i2cRead':
  39. ../components/arduino/cores/esp32/esp32-hal-i2c.c:200:15: error: implicit declaration of function 'i2c_master_read_from_device'; did you mean 'i2c_master_read_byte'? [-Werror=implicit-function-declaration]
  40.          ret = i2c_master_read_from_device((i2c_port_t)i2c_num, address, buff, size, timeOutMillis / portTICK_RATE_MS);
  41.                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  42.                i2c_master_read_byte
  43. ../components/arduino/cores/esp32/esp32-hal-i2c.c: In function 'i2cWriteReadNonStop':
  44. ../components/arduino/cores/esp32/esp32-hal-i2c.c:229:15: error: implicit declaration of function 'i2c_master_write_read_device'; did you mean 'i2c_master_write_byte'? [-Werror=implicit-function-declaration]
  45.          ret = i2c_master_write_read_device((i2c_port_t)i2c_num, address, wbuff, wsize, rbuff, rsize, timeOutMillis / portTICK_RATE_MS);
  46.                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  47.                i2c_master_write_byte
  48. cc1.exe: some warnings being treated as errors

- build error for ETH.cpp

  1. [3/9] Building CXX object esp-idf/arduino/CMakeFiles/__idf_arduino.dir/libraries/WiFi/src/ETH.cpp.obj
  2. FAILED: esp-idf/arduino/CMakeFiles/__idf_arduino.dir/libraries/WiFi/src/ETH.cpp.obj
  3.  
  4. ... ...
  5. ... ...
  6.  
  7. ../components/arduino/libraries/WiFi/src/ETH.cpp
  8. ../components/arduino/libraries/WiFi/src/ETH.cpp: In member function 'bool ETHClass::begin(uint8_t, int, int, int, eth_phy_type_t, eth_clock_mode_t)':
  9. ../components/arduino/libraries/WiFi/src/ETH.cpp:286:23: error: 'esp_eth_phy_new_ksz8081' was not declared in this scope
  10.              eth_phy = esp_eth_phy_new_ksz8081(&phy_config);
  11.                        ^~~~~~~~~~~~~~~~~~~~~~~
  12. ../components/arduino/libraries/WiFi/src/ETH.cpp:286:23: note: suggested alternative: 'esp_eth_phy_new_ksz8041'
  13.              eth_phy = esp_eth_phy_new_ksz8081(&phy_config);
  14.                        ^~~~~~~~~~~~~~~~~~~~~~~
  15.                        esp_eth_phy_new_ksz8041
  16. ninja: build stopped: subcommand failed.
  17. The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command cmake --build ." terminated with exit code: 1.

Who is online

Users browsing this forum: Baidu [Spider] and 55 guests