ESP32 environment setup
Linux
Open the following website: https://docs.espressif.com/projects/esp-idf/zh_CN/stable/esp32/get-started/linux-macos-setup.html
Install dependencies

First, follow the instructions shown on this website. If you are using Ubuntu,
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
If you are Fedora
sudo dnf -y makecache && sudo dnf install git wget flex bison gperf python3 python3-setuptools cmake ninja-build ccache dfu-util libusbx

Get ESP-IDF

Check which version is the latest stable release.

As shown in the image above, this is version 5.5.2.
Next, choose a folder to store the firmware.
For example, I want to place it under the /home/tungchiahui/UserFolder/Applications/ folder (where /home/tungchiahui can be replaced by ~/).
So
cd ~/UserFolder/Applications
mkdir -p ./esp
cd ./esp
# 记得版本号要改成最新稳定版(网络环境一定要好)
git clone -b v5.5.2 --recursive https://github.com/espressif/esp-idf.git

As shown in the image is a success; anything not like the one below means it was not downloaded successfully.

Set up the tool

cd ./esp-idf
# 选择国内服务器
export IDF_GITHUB_ASSETS="dl.espressif.cn/github_assets"
./install.sh all


The image above shows what success looks like. Here, you need to copy what I've circled in red (the path to export.sh), as it will be used in the next environment configuration. For example, the path I copied here is
~/UserFolder/Applications/esp/esp-idf/export.sh
Set environment variables
At this point, the newly installed tools have not yet been added to the PATH environment variable, so they cannot be used from the command window. Therefore, some environment variables must be set. This can be done using another script provided by ESP-IDF.
vim ~/.bashrc
Add the following line (fill in the specific path where you actually store it, which is the path you just copied. Remember to change ~ to $HOME to improve robustness).
alias get_idf='. $HOME/UserFolder/Applications/esp/esp-idf/export.sh'

source ~/.bashrc

Configure VScode
https://docs.espressif.com/projects/vscode-esp-idf-extension/zh_CN/latest/index.html
- Install the ESP-IDF plugin

- Click Express and select the download server:
As shown in the figure below, since we have already configured the environment, do not select a version here. Instead, directly choose to locate ESP-IDF from my computer.

It will automatically help you complete the entire toolchain.

If it displays like this in the bottom-right corner, it means success.


Next, configure OpenOCD:
Copy the line above, open a terminal (any terminal will do, no need to worry about the path), and run it.
sudo cp --update=none /home/tungchiahui/.espressif/tools/openocd-esp32/v0.12.0-esp32-20250707/openocd-esp32/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d

End!
Windows
Open the following website: https://docs.espressif.com/projects/esp-idf/zh_CN/stable/esp32/get-started/windows-setup.html
Download and install the program.
Check the latest version; for example, the latest version here is v5.5.2.

Click to download the tool.

And click to install the latest version. For example, the latest version here is v5.5.2.

Install ESP-IDF
Click on the downloaded esp-idf.



Select the hard drive partition where you want to install. For example, if I want to install it on C:\Espressif, it would look like the image below.
If you want to install it on the D drive, change the first C to D.

Check all the unchecked boxes, then click Install.

Then click Finish.

If the pop-up windows all display like this, then the installation was successful.

Set up the environment
Just open any folder, right-click This PC(此电脑), and click 属性.

Here is an advanced system setting.

Click on Environment Variables

Click New.


Find the directory mentioned in the path where you just installed IDF, then click OK.


Configure VScode
Install the plugin below.

Once installed, click to open the Getting Started wizard.

Click on the first one.

Do it my way, then click Install.

This interface indicates a successful installation.

Download the serial port driver.
Open the website below. https://docs.espressif.com/projects/esp-idf/zh_CN/stable/esp32/get-started/establish-serial-connection.html
- CP210x driver


Extract the compressed archive you just downloaded.

Right-click silabser.inf and click 安装.
Installation complete.

- FTDI driver


Similarly, extract the downloaded archive.

Right-click each of the two below, then click Install.


- CH340 driver Open the website below. https://www.wch.cn/products/ch340.html



