Using Arduino as a component in Platformio gives errors

dfrenkel
Posts: 12
Joined: Sun Jul 22, 2018 1:52 pm

Using Arduino as a component in Platformio gives errors

Postby dfrenkel » Wed Oct 20, 2021 7:08 pm

I am using the latest version of ESP-IDF in PlatformIO and have managed to set up Arduino as a component, but while compiling, I receive the following errors which makes me think the problem is with the compiler. Any ideas on what I can do?

Code: Select all

Compiling .pio\build\esp32dev\components\arduino\cores\esp32\esp32-hal-tinyusb.o
Compiling .pio\build\esp32dev\components\arduino\cores\esp32\esp32-hal-touch.o
Compiling .pio\build\esp32dev\components\arduino\cores\esp32\esp32-hal-uart.o
Compiling .pio\build\esp32dev\components\arduino\cores\esp32\esp32-hal-rmt.o
Compiling .pio\build\esp32dev\components\arduino\cores\esp32\Esp.o
Compiling .pio\build\esp32dev\components\arduino\cores\esp32\FunctionalInterrupt.o
Compiling .pio\build\esp32dev\components\arduino\cores\esp32\HardwareSerial.o
Compiling .pio\build\esp32dev\components\arduino\cores\esp32\IPAddress.o
Compiling .pio\build\esp32dev\components\arduino\cores\esp32\IPv6Address.o
Compiling .pio\build\esp32dev\components\arduino\cores\esp32\main.o
Compiling .pio\build\esp32dev\components\arduino\cores\esp32\MD5Builder.o
components/arduino/cores/esp32/esp32-hal-i2c.c: In function 'i2cWrite':
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:5: error: variable-sized object may not be initialized
     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 };
             ^~~~~~~~
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]
         i2c_cmd_link_delete_static(cmd);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
         i2c_cmd_link_delete
components/arduino/cores/esp32/esp32-hal-i2c.c: In function 'i2cRead':
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]
         ret = i2c_master_read_from_device((i2c_port_t)i2c_num, address, buff, size, timeOutMillis / portTICK_RATE_MS);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
               i2c_master_read_byte
components/arduino/cores/esp32/esp32-hal-i2c.c: In function 'i2cWriteReadNonStop':
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]    
         ret = i2c_master_write_read_device((i2c_port_t)i2c_num, address, wbuff, wsize, rbuff, rsize, timeOutMillis / portTICK_RATE_MS);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
               i2c_master_write_byte
cc1.exe: some warnings being treated as errors
*** [.pio\build\esp32dev\components\arduino\cores\esp32\esp32-hal-i2c.o] Error 1
========================================================================================= [FAILED] Took 11.64 seconds =========================================================================================

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: Using Arduino as a component in Platformio gives errors

Postby chegewara » Thu Oct 21, 2021 2:07 am

Most likely esp-idf and arduino-esp32 versions do not match.

Who is online

Users browsing this forum: MicroController and 80 guests