If you want to use SDK for development, you need the ESP32C3 development kit, which includes the C/C++ compiler and the manufacturer's burning software and other necessary supporting development software. So this issue will test IDF and build the environment. In fact, there are still many things to pay attention to in this process.
1. First, the development environment information https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32c3/get-started/index.html
ESP-IDF (Espressif IoT Development Framework) is a software package. In addition to the supporting software, most of the software is a collection of open source software packages, so you need to install these software before installing these packages. The most troublesome thing is that there are some software already installed on my computer, such as python, cmake, ninja, etc. This may cause conflicts, so these software are upgraded to the latest version. These software can be used without uninstalling. I personally don't like to use the installation method of various plug-ins, which is easy to interfere with other development, so I chose to install the IDF package separately.
安装程序会安装以下组件:
内置的 Python
交叉编译器
OpenOCD
CMake 和 Ninja 编译工具
ESP-IDF
Except for OpenOCD and ESP-IDF, I have installed all the others. (OpenOCD does not seem to be used here, I just removed it from PATH in my PC.) The cross-compilation environment can be installed with ESP-IDF, so I did not install it in advance. It should be noted here that python needs to install pip function.
2. I used the compressed package of esp-idf-v4.4.zip to decompress it directly, without using the integrated installation environment. There is a install.bat file in the decompressed directory, which can be executed in the command line.
Execute install esp32c3
After the execution is completed, the idf environment will be installed, including the risc-v compilation environment.
3. Compile the hello_world project
The helloworld project is at https://github.com/espressif/esp-idf/tree/2761ad4865919693fcd02f4096711ba0fd0f6271 . You can git the project locally and open it.
cd %userprofile%\esp\hello_world
idf.py set-target esp32c3
idf.py menuconfig
According to the preparation work of the project, this process only uses cmake to generate a project. Before executing the command, be sure to execute the export.bat command. This command sets various environment variables for you.
The idf.py menuconfig command is not useful for now, so you can use the default one.
4. Build the project
The above is just cmake generating a project. Use the idf.py build command to actually generate the bin file.
Once the command is successfully executed, you can hear the bin file.
5. Burn the bin file into flash
Use the command idf.py -p <PORT> flash
<PORT> is the serial port number generated by the device on your PC. My device serial port number is COM14, so my command is idf.py -p com14 flash
If the burning fails, it may be that the device has not entered the burning state. At this time, you need to connect the ninth pin PIN9 of the device to GND and power it on again.