【ESP32-Korvo Review】+ 02 Software Construction
[Copy link]
This post was last edited by yangjiaxu on 2021-1-24 00:59
Hi, today I want to share with you how to build the software environment for ESP32. Building the software for ESP32 is not very troublesome, but it is a lot more troublesome because of the network. There are two ways to build this environment. One is the one-click installation tool provided by the official . The other is to use the script installation. The official has a step-by-step tutorial, which is very detailed and worth referring to .
This time I will talk about the first method.
First, download the ESP-IDF tool installer, https://dl.espressif.com/dl/esp-idf-tools-setup-2.3.exe . This installer will install three software, one is git, python3.7 and ESP-IDF.
Open the software and select "Agree".
Install Git2.21.0. If your computer has it, you can choose the original one and specify the path.
Install python 3.7. If you have it on your computer, you can choose the original one and specify the path.
Download ESP-IDF. Pay attention to this. The next step is to select the version of ESP-IDF. Since the ESP32-Korvo developed this time, the official recommendation is to use 3.3.1. So you must be obedient. Because I was not obedient, I am already familiar with the process of installing IDF. Hahahaha.
You can take a look at the download speed, 0KB/S. Why is it like this? Because you need to download it from GitHub , so it is like this. And basically, it is because of the two softwares git and python that cause the download speed to be extremely slow, so it is recommended to download these two softwares separately.
If you see the above interface, it means that you are lucky and the installation is successful.
Here is a small suggestion, that is, download git and python yourself, otherwise it is very easy to encounter the following situation.
After the installation is successful, you need to test whether the environment can be used normally.
Open the ESP-IDF Command Prompt (cmd.exe), which is usually on the desktop.
Enter cd and add the official demo example, which is in esp-idf\examples\get-started\hello_world.
After entering this folder, enter the following command.
idf.py set-target esp32
(Note: After opening a new project, you should first set the "target" chip)
idf.py menuconfig
(Description: Run the configuration program. This is to explain the functions of the above statements. You do not need to type them into the command line)
idf.py build
(Description: Compile and build. This is to explain the functions of the above statements. You do not need to type them into the command line)
When configuring the program functions, garbled characters may appear for the first time , as shown in the figure below.
The reason is: Python does not support Chinese encoding format.
Solution: You can enter os.system("chcp 437") after starting cmd.exe to switch to English encoding format. You can also modify idf.py to automatically change the encoding. The idf.py file is in esp-idf\tools. (PS. It is worth noting that Python has very strict requirements on the indentation format, and spaces are required here for indentation).
if __name__ == "__main__":
try:
# On MSYS2 we need to run idf.py with "winpty" in order to be able to cancel the subprocesses properly on
# keyboard interrupt (CTRL+C).
# Using an own global variable for indicating that we are running with "winpty" seems to be the most suitable
# option as os.environment['_'] contains "winpty" only when it is run manually from console.
WINPTY_VAR = "WINPTY"
WINPTY_EXE = "winpty"
os.system("chcp 437")
if ("MSYSTEM" in os.environ) and (
not os.environ.get("_", "").endswith(WINPTY_EXE) and WINPTY_VAR not in os.environ
):
The interface after the solution.
Since we are using the hello_world routine this time, there is no need to configure it here, just save and exit.
After exiting, run idf.py build. If there is no problem with the code, a bin file can be generated.
The generated bin file can be burned into the development board. There are many ways to burn it. I use a relatively simple one, which is to use the flash_download_tool_v3.8.5_1 software to burn it.
Just click and start downloading. After downloading, reset the development board, open the serial port, and connect the development board. You can see the interface display hello world! At this point, it means that the software environment has been successfully built, and you can play further.
Chapter Summary:
1. Make sure to choose the officially recommended version of ESP-IDF, otherwise you will suffer a lot.
2 It is best to download and install git and python software first, which will save a lot of time.
3 It is best to have the installation path in English, which will eliminate errors caused by the Chinese path.
|