we can use the Arduino libraries as an ESP-IDF component ?

mohasrj
Posts: 33
Joined: Mon Jan 20, 2020 9:38 am

we can use the Arduino libraries as an ESP-IDF component ?

Postby mohasrj » Tue Jun 02, 2020 8:30 am

hi everyone, i am using ESP32 KIT with framework ESP-IDF on eclipse and i want to know if i can use any librairies from Arduino framework with ESP-IDF like the ADC MCP3428 ?

i try to add arduino-esp32 in project (clone https://github.com/espressif/arduino-esp32.git) i get error :

Python requirements from C:\Users\mohammed.seridj\esp\esp-idf\requirements.txt are satisfied.
CMake Error at C:/Users/mohammed.seridj/esp/esp-idf/tools/cmake/build.cmake:185 (message):
Failed to resolve component 'ethernet'.
Call Stack (most recent call first):
C:/Users/mohammed.seridj/esp/esp-idf/tools/cmake/build.cmake:211 (__build_resolve_and_add_req)
C:/Users/mohammed.seridj/esp/esp-idf/tools/cmake/build.cmake:425 (__build_expand_requirements)
C:/Users/mohammed.seridj/esp/esp-idf/tools/cmake/project.cmake:337 (idf_build_process)
CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/mohammed.seridj/Desktop/wrkspse/myapp/build/CMakeFiles/CMakeOutput.log".
cmake --build . -- -v
ninja: error: loading 'build.ninja': Le fichier spécifié est introuvable.


Build complete (0 errors, 0 warnings): C:\Users\mohammed.seridj\Desktop\wrkspse\myapp\build


What is the recommended way to add Arduino libraries and ensure that make knows what to do with them?



best regards


mohasrj
Posts: 33
Joined: Mon Jan 20, 2020 9:38 am

Re: we can use the Arduino libraries as an ESP-IDF component ?

Postby mohasrj » Tue Jun 02, 2020 12:02 pm

yes i have still the same error, but u can confirme me if i can use my esp idf template code and i add inside arduino library without using .ccp

void setup(){
Serial.begin(115200);
}

void loop(){
Serial.println("loop");
delay(1000);
}

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

Re: we can use the Arduino libraries as an ESP-IDF component ?

Postby chegewara » Tue Jun 02, 2020 5:32 pm

When you are making arduino as component project you have to remember 2 things:
1) copy sdkconfig to your project before you start building it:
https://github.com/espressif/arduino-es ... /tools/sdk
or
https://github.com/espressif/arduino-es ... /tools/sdk
depending on idf version you want to use
2) this is still idf project, so you will need to learn this:
https://docs.espressif.com/projects/esp ... lists-file

Every component requires CMakeLists.txt, it is included in arduino already:
https://github.com/espressif/arduino-es ... eLists.txt

https://github.com/chegewara/arduino-as ... eLists.txt

If you are using idf components you need to add REQUIRES in cmakelists.
You also need to rename ino file to cpp.

mohasrj
Posts: 33
Joined: Mon Jan 20, 2020 9:38 am

Re: we can use the Arduino libraries as an ESP-IDF component ?

Postby mohasrj » Wed Jun 03, 2020 9:07 am

oky thanks sir,

But as I understand arduino-esp32 is based on IDF 3.3 and I can't use it as a component for idf 4.0. It is then recommended to roll back the idf version to one compatible with the arduino component so 3.3.

is that true ?

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

Re: we can use the Arduino libraries as an ESP-IDF component ?

Postby chegewara » Wed Jun 03, 2020 4:54 pm

You can use esp32s2 branch with idf master, but you have to remember its still WiP and some things may not work.
Most of functionalities has been tested more or less and if you find bug it will be fixed in rather short time, i believe.

akotowski
Posts: 16
Joined: Sat Sep 01, 2018 2:54 pm

Re: we can use the Arduino libraries as an ESP-IDF component ?

Postby akotowski » Wed Jun 24, 2020 10:07 pm

I have this same problem.
I have a program using arduino that compiles and runs in IDF version 3.2.
Trying to compile this in 4.1. I received the same errorL: Failed to resolve component 'ethernet'.
I followed your suggestions below, still same error.
I then edited CmakeFile.txt to refer to "main.cpp" instead of "main.c".
Now I get the error: "Please configure IDF framework to include mbedTLS -> Enable pre-shared-key ciphersuites and activate at least one cipher"
Should I be using esp32s2 branch even though I am using a standard esp32?
Should I add mbedTLS per the above? How?

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

Re: we can use the Arduino libraries as an ESP-IDF component ?

Postby chegewara » Thu Jun 25, 2020 12:13 am

akotowski wrote: Should I be using esp32s2 branch even though I am using a standard esp32?
Branch esp32s2 is based on idf v4.2 afaik. The name of branch is suggesting it is meant to be used with S2, but is just added support for S2 with migrating to idf v4.x.
Like i said, you have to remember it is still work in progress, because in idf v4.x is a lot changes. Some components and/or peripherals may not work or still have bugs. Espressif team is working hard on it to give us working environment when esp-idf v4.2 will become stable release.

jason.a
Posts: 2
Joined: Sun Aug 23, 2020 1:08 pm

Re: we can use the Arduino libraries as an ESP-IDF component ?

Postby jason.a » Sun Aug 23, 2020 1:19 pm

Hi if you're encountering the "Failed to resolve the component ethernet" line, i may have found an easy fix. Go to the project folder in which you have install the arduino-esp32 git to be used for the idf component, then open the CMakeLists.txt file and scroll down until you come across the line which reads set(COMPONENT_REQUIRES spi_flash mbedtls mdns ethernet esp_adc_cal wifi_provisioning) and change ethernet to esp_eth. Really looks like it's working though i havent actually test it for compiling code in esp idf using the arduino library yet

Who is online

Users browsing this forum: Google [Bot] and 124 guests