ESP32 Libraries Location

Dear Community,

I'm working a little while now with the Arduino IDE. Although programming is not my strong suit, I find the Arduino IDE very comfortable and easy to use.

However, I recently purchased an ESP-WROOM-32 from Adafruit, and I'm having some trouble to find the installed libraries. I installed the library using the Arduino IDE and searched the ESPRIFF ESP32 library. I installed it and its example code's showed up, which I tried and works.

But now I want to write my own code, and I'm searching for the libraries that the ESP32 uses. For example, I want to use a PWM controller on the ESP32, and the examples all say that I can 'ledcAttachPin' and 'ledcWrite' functions, but I want to know what these functions are and how to properly use. So I want to know the location of the source code and what other kinds of functions are available.

Most of the source code are located in the installation folder of the Arduino IDE (C:\Program Files\Arduino\libraries or C:\Program Files\Arduino\hardware\arduino\avr\libraries). But I can't seem to find the libraries for the ESP32. I'm missing a link between the ESP32 and the Arduino IDE. Especially because the example code doesn't have any includes.

Please let me know where I can find the source code of the ESP32 library for the use of Arduino IDE.

The easiest way to find the active hardware package location is as follows:

  • Select a board from the hardware package you want to find from the Tools > Board menu
  • File > Examples > SPI > BarometricPressureSensor (or any other SPI example sketch)
  • Sketch > Show Sketch Folder
  • Move up folder levels until you reach the one that contains boards.txt

In the case of the ESP32 package, you will find the code for the Arduino core API functions like analogWrite under cores/arduino.

You might have had trouble finding these files because they're stored under a hidden folder on your computer.

SrG71:
or C:\Program Files\Arduino\hardware\arduino\avr\libraries).

You probably already know, but just to be sure: the files under C:\Program Files\Arduino\hardware\arduino\avr are only used for the Arduino AVR Boards (e.g., Uno, Mega, Leonardo), and maybe some 3rd party hardware packages that reference Arduino AVR Boards (e.g., damellis/attiny). The other thing that can be confusing is that if you update Arduino AVR Boards via Boards Manager then it is installed to another location on your computer and the version at C:\Program Files\Arduino\hardware\arduino\avr will not be used by the Arduino IDE.

I do not know if i understood correctly, but if i am correctly click this link that have all libraries for Esp with Arduino.

https://www.arduinolibraries.info/architectures/esp32

pert:
The easiest way to find the active hardware package location is as follows:

Thanks That was very useful as I had installed the ESP32 core and could not find where it had put the files.

UNFORTUNATELY it had put them in a folder in my Linux HOME folder. I don't want them there because {A} that is on a drive that has limited capacity and {B} I don't want them on a drive that is a fixed part of the PC.

What I want to do is install the ESP32 core in the "hardware" folder of my sketchbook folder alongside other cores such as for the ESP8266 and Attiny.

After a lot of struggling I think I have beaten it into shape by looking at the errors when it could not find files and massaging the folder structure to get things where it expects to find them.

My question is, isn't there an easy way to do this, just by downloading a zip file, extracting it and copying the contents to the "hardware" folder? That's all I had to do to install the other cores that I have.

Somewhat separately, I believe there is an option to create a "portable" folder in the folder that contains the IDE code and (I believe) the IDE will put cores and the sketchbook in there. But I presume that makes everything specific to one version of the IDE, whereas with my existing system the same sketchbook is used by my different versions of the IDE.

Thanks.

...R

Robin2:
Thanks That was very useful

You're welcome. It's not everyday that I post something Robin2 didn't know about already!

Robin2:
My question is, isn't there an easy way to do this, just by downloading a zip file, extracting it and copying the contents to the "hardware" folder?

It's not quite that simple, but yes you can do that by following the "Using Arduino IDE with the development repository " instructions here:

This installation method is primarily intended for beta testers and developers so it's going to install the beta core from the tip of the master branch. If you prefer to run the core at its release state then you can run the command:

git checkout 1.0.2

at the step of the instructions after the command:

cd esp32 && \

1.0.2 happens to be the latest stable release currently. You can see the releases listed here:

There is a release candidate available 1.0.3-rc1 that is perhaps good for those who want cutting edge, but with a bit more likelihood of stability.

Robin2:
That's all I had to do to install the other cores that I have.

Yes, but likely those were simple AVR cores that were able to share the tools that come installed with the Arduino IDE for Arduino AVR Boards. It's more complicated for ESP32 because it needs a complete toolchain installed along with the hardware definitions and libraries. It's also a bit more complicated because ESP32 developers used some submodules in their repository (actually I think it might be down to only one submodule now). Luckily, the ESP32 developers made the manual installation process super easy by providing excellent instructions and a Python script that handles the installation of the toolchain.

Robin2:
Somewhat separately, I believe there is an option to create a "portable" folder in the folder that contains the IDE code and (I believe) the IDE will put cores and the sketchbook in there. But I presume that makes everything specific to one version of the IDE, whereas with my existing system the same sketchbook is used by my different versions of the IDE.

Yes. When the Arduino IDE is in portable mode the cores you install via Boards Manager are installed to the portable/packages subfolder of the Arduino IDE installation folder. It does configure the sketchbook folder to be inside the portable folder by default, but you can set any sketchbook location you like via File > Preferences > Sketchbook location. So you can easily share the same sketchbook between multiple portable installations of the Arduino IDE if you like. However, the cores installed via Boards Manager are more specific to that particular Arduino IDE installation (though I suppose you could work around that with symlinks).

@pert, thank you for all of that.

I will take some time to digest it and do some experimenting. It will keep me occupied while waiting for my ESP32-cam to arrive and, more importantly, while I wait for a ridiculously overdue small CNC router to arrive. If it had arrived on time I probably would not have discovered the ESP32-cam :slight_smile:

Just as a minor comment, I imagine that the ESP8266 core also needs a complete toolchain and I don't recall having any trouble installing it by my stubborn Luddite manual method :slight_smile:

...R

Robin2:
Just as a minor comment, I imagine that the ESP8266 core also needs a complete toolchain and I don't recall having any trouble installing it by my stubborn Luddite manual method :slight_smile:

Yeah, it's the same system for manual installation of the ESP8266 core as for ESP32. There are a couple of library submodules that you won't get from a git clone or downloading the .zip file so you have to run the git command to update them, then there is a Python script to install the toolchain, and you're good to go!

I do sometimes wish that Arduino provided such an easy and well documented manual installation method for their official cores. Boards Manager is wonderful, but there are a small number of people it doesn't work for. Those people are in for a rough time when it comes to trying to install the official Arduino cores manually.