espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.57k stars 7.4k forks source link

Arduino as Component compile error #7123

Closed joeholdsworth closed 1 year ago

joeholdsworth commented 2 years ago

Board

ESP32c3

Device Description

DevKitC

Hardware Configuration

No

Version

Arduino Core v2.0.4 ESP-idf v 4.4

IDE Name

Visual studio ESP-IDF plugin

Operating System

Windows 10

Flash frequency

40

PSRAM enabled

yes

Upload speed

115200

Description

Compiling my project with arduino as a component fails with this error:

esp-idf/arduino/CMakeFiles/__idf_arduino.dir/cores/esp32/esp32-hal-uart.c.obj -c ../components/arduino/cores/esp32/esp32-hal-uart.c ../components/arduino/cores/esp32/esp32-hal-uart.c: In function 'uartAvailableForWrite': ../components/arduino/cores/esp32/esp32-hal-uart.c:242:19: error: implicit declaration of function 'uart_get_tx_buffer_free_size'; did you mean 'uart_get_buffered_data_len'? [-Werror=implicit-function-declaration] if (ESP_OK == uart_get_tx_buffer_free_size(uart->num, &txRingBufferAvailable)) { ^~~~~~~~ uart_get_buffered_data_len cc1.exe: some warnings being treated as errors [33/164] Building CXX object esp-idf/arduino...f_arduino.dir/cores/esp32/MD5Builder.cpp.obj ninja: build stopped: subcommand failed. ninja failed with exit code 1

Sketch

This occurs on build, it is an error when attempting to compile the arduino as a component which occurs before the main.cpp is compiled. The command run was:

idf.py build flash monitor -p COM3

Debug Message

NA

Other Steps to Reproduce

I followed the instructions in:

https://espressif-docs.readthedocs-hosted.com/projects/arduino-esp32/en/latest/esp-idf_component.html

specifically: mkdir -p components && \ cd components && \ git clone https://github.com/espressif/arduino-esp32.git arduino && \ cd arduino && \ git submodule update --init --recursive && \ cd ../.. && \ idf.py menuconfig

after configuring the arduino component I then attempted a build and got the above error

I have checked existing issues, online documentation and the Troubleshooting Guide

SuGlider commented 2 years ago

@joeholdsworth -

../components/arduino/cores/esp32/esp32-hal-uart.c:242:19: error: implicit declaration of function 'uart_get_tx_buffer_free_size'; did you mean 'uart_get_buffered_data_len'? [-Werror=implicit-function-declaration] if (ESP_OK == uart_get_tx_buffer_free_size(uart->num, &txRingBufferAvailable)) { ^~~~~~~~

The IDF function used in the master branch from Arduino Core Github, uart_get_tx_buffer_free_size(), has been included recently to IDF 4.4.2.

Please update your IDF to the latest master for IDF 4.4.2 from Github and after that it will work fine.

SuGlider commented 1 year ago

This issue is solved in Arduino Core 2.0.5 that uses IDF 4.4.2.