Abstract
his article provides a brief overview of setting up the development environment for the ESP32-S3 chip using the ESP-IDF framework. The ESP32-S3 is a powerful Wi-Fi and Bluetooth Low Energy SoC. The setup involves installing the ESP-IDF toolchain, configuring variables, selecting a development board, and establishing a serial port connection. With this environment, developers can leverage the ESP-IDF’s API and components for application development in IoT and embedded systems.
Referance
1. 安装依赖
1.1安装环境依赖
arch LINUX
sudo pacman -S --needed gcc git make flex bison gperf python cmake ninja ccache dfu-util libusb
1.2安装Python3
python2也可以, 还是推荐Python3
查看Python版本
python3 --version
2.获取 ESP-IDF
mkdir -p ~/esp
cd ~/esp
git clone -b v5.0.2 --recursive https://github.com/espressif/esp-idf.git
3.设置工具
除了 ESP-IDF 本身,您还需要为支持 ESP32-S3 的项目安装 ESP-IDF 使用的各种工具,比如编译器、调试器、Python 包等。
默认安装位置`$HOME/.espressif
cd ~/esp/esp-idf
./install.sh esp32s3
4.设置环境变量
此时,您刚刚安装的工具尚未添加至 PATH 环境变量,无法通过“命令窗口”使用这些工具。因此,必须设置一些环境变量。这可以通过 ESP-IDF 提供的另一个脚本进行设置。
. $HOME/esp/esp-idf/export.sh
需要经常运行 ESP-IDF,您可以为执行 export.sh 创建一个别名, 这样做可以使得每个terminal环境隔离,不需要idf环境的时候开一个新的terminal即可。
如果需要idf环境直接执行get_idf
即可。
alias get_idf='. $HOME/esp/esp-idf/export.sh'
5. 使用IDF
复制项目到自定义目录
cd YOUR_PATH
cp -r $IDF_PATH/examples/get-started/hello_world .
设置目标芯片, 目前支持的芯片esp32|esp32s2|esp32c3|esp32s3|esp32c2|linux|esp32h2
cd hello_world
idf.py set-target esp32s3
idf.py menuconfig
idf.py build
idf.py flash
vscode env
安装esp插件,然后选第三个选项,配置好之后,点击报错信息fix.., 修改c_cpp_properties.json
文件, 解决波浪线。
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/home/dd21/esp/esp-idf/components/driver/include",
"/home/dd21/esp/esp-idf/components/esp_common/include"
],
"defines": [],
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64",
"configurationProvider": "ms-vscode.cmake-tools",
"compilerPath": "/usr/bin/arm-none-eabi-gcc"
}
],
"version": 4
}
修改usb权限
创建文件 sudo nvim /etc/udev/rules.d/10-usb-serial.rules
KERNEL=="ttyUSB[0-9]*", MODE="0666"
重新加载udev规则以使更改生效:
sudo udevadm control --reload-rules && sudo udevadm trigger