October 16, 2019 at 14:49 #26178
Is there somebody could tell me where to put arduino third party libraries ?
I try to make a new component, and of course,in the library code there are include, like <Arduino.h> or <SPI.h> etc.
but compiler are not able to find the corresponding Arduino header…
So what is the trick ?
ps: I primary use the ESP*IDF arduino as components tutorial and now I would like to add some libraries and modify the code.October 16, 2019 at 15:22 #26179
ESP-IDF projects do not use automatic library discovery like Arduino ones and require the libraries to be wrapped as ESP-IDF components. You can read more about the components in the ESP-IDF documentation. Once you get an understanding of the component structure you need for your project, simply use VisualGDB’s Add New Item command in the component list to create the necessary components.October 16, 2019 at 22:13 #26186
I take time to read the documentation linked in your message.
But in Visualgdb it stay unclear on how to do.
What I did : on component folder I choose Add a new one, I named it Libraries.
In the Libraries directory I copy a Libray (Adafruit_GFX_Library) and then I Add all source code and header to Libraries (“Add existing files”)
But compiler didnt find Arduino header who are in the arduino component (I made it as in your tutorial Arduino as esp idf component)
I spent many time (and many Visualgdb crash) to find how to make arduino component as dependency of the Librairies component…without any succes.
I am very frustrated now! I know there are a difficult time at the beginning of using a new system but I dont find the exit !
Could you help me a little ?
October 16, 2019 at 22:22 #26188
- This reply was modified 7 months, 2 weeks ago by manuF.
Sorry, if you need help understanding the role of libraries and components in ESP-IDF projects, please contact Espressif for further support.
We can help you locate specific VisualGDB settings that correspond to specific properties of the components, however we are not able to offer help understanding the inner workings of ESP-IDF or other 3rd-party frameworks that are not directly maintained by us.October 16, 2019 at 23:39 #26189
I didn’t ask you to explain how esp-idf work or any third party library.
I add a components which depend from header on an other components.
I just ask you how to add these dependency in a visualgdb project!
I think many peoples use arduino because they dont want to spent time with low level problem adding any value.
VisualGDB could break this.
I am electronic designer, I spent a lot of time to understand this tool, and support ask me to get fucked. (Yes this is!)
What that ?
October 17, 2019 at 05:21 #26192
- This reply was modified 7 months, 2 weeks ago by manuF.
In fact my question is pretty simple:
You made a tutorial to use Arduino as components. Perfect nice tutorial.
So my question is : How to add an Arduino library to this project? Perhaps you don’t know!?
There are one way, but this not clean, is to add the library in the arduino librarie folder and use ‘Add existinf file” the not forget to add a relative pass to the exported include directory in the setting of arduino component!
But this is not clean because the Arduino core must stay independent.
So do you know how to add an Arduino library to your tutorial project ?October 17, 2019 at 17:23 #26204
Arduino libraries use a rather specific sematics (including one header file automatically pulls the entire library) and hence only work out-of-the-box with the Arduino project builder. This is fully supported and works out-of-the-box when using the Arduino Project Subsystem.
The ESP-IDF projects are based on a different framework that is not 100% compatible with the Arduino ecosystem. It is possible to add the Arduino core to ESP-IDF projects because Espressif has specifically designed their ESP32 core to be both a valid Arduino core and a valid ESP-IDF component that can be imported into ESP-IDF projects. This does not mean that any Arduino library can be automatically added to ESP-IDF projects without any adjustments, because the ESP-IDF build system is still different from the Arduino build system.
In order to import an Arduino library to an ESP-IDF project, it needs to be manually converted to an ESP-IDF component. Once you have performed the conversion, you can add the component to the project by selecting Add->Existing Item in Solution Explorer->Project->Components.October 17, 2019 at 21:56 #26208
I found a solution who look to work:
– I create a new components (right click, add new elements) I named it Librairies.
-I copy my Arduino library (MyArduinoLib) to the Librairies components directory.
-Then I add header and source files from MyArduinoLib ( right click on Librairies components, add existing elements)
-I Edit the CMakeLists.txt from Librairies components, and Add reference to Arduino components :C++123456789101112131415161718192021222324252627282930set(COMPONENT_ADD_INCLUDEDIRS../arduino/variants/esp32/../arduino/cores/esp32/../arduino/libraries/ArduinoOTA/src../arduino/libraries/AsyncUDP/src../arduino/libraries/AzureIoT/src../arduino/libraries/BLE/src../arduino/libraries/BluetoothSerial/src../arduino/libraries/DNSServer/src../arduino/libraries/EEPROM/src../arduino/libraries/ESP32/src../arduino/libraries/ESPmDNS/src../arduino/libraries/FFat/src../arduino/libraries/FS/src../arduino/libraries/HTTPClient/src../arduino/libraries/HTTPUpdate/src../arduino/libraries/NetBIOS/src../arduino/libraries/Preferences/src../arduino/libraries/SD_MMC/src../arduino/libraries/SD/src../arduino/libraries/SimpleBLE/src../arduino/libraries/SPIFFS/src../arduino/libraries/SPI/src../arduino/libraries/Ticker/src../arduino/libraries/Update/src../arduino/libraries/WebServer/src../arduino/libraries/WiFiClientSecure/src../arduino/libraries/WiFi/src../arduino/libraries/Wire/src
And after some adjustment it compile just find! (like Add ESP32 in preprocessor definition of Libraries comonent (right click, properties, c/c++ Preprocessor definition)
Hope this could help peoples using usually arduino who want to go further in esp-idf configuration (like for power management who is not well supporting in arduino core) or people who want to use Arduino libraries in esp-idf !
Have fun !October 18, 2019 at 21:58 #26221
Good to know it works. As promised, below are the details on setting this option using the VisualGDB GUI.
- Select the component in Solution Explorer (or the project itself if you are editing the main component).
- Right-click on it and select “Properties”.
- Use the Exported Settings -> Public -> Additional Include Directories property to interactively edit the directory list:
Attachments:You must be logged in to view attached files.October 19, 2019 at 08:35 #26234
Now it could be nice if you could add arduino librairie support to your great tutorial ESP-IDF arduino as component.
Thanks for your support.
Emmanuel.October 19, 2019 at 15:36 #26238
No problem, we have added it to the backlog and will consider making a tutorial on this in the future.
You must be logged in to reply to this topic.