安装
根据 https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32s2/get-started/linux-macos-setup.html 里的要求安装一些东西,点插件的首页的“… Package”也能跳转
在 vscode 里安装 ESP-IDF 插件,下载服务器选择 Espressif,自定义位置并安装
工程
工程复制一份再拖放到 vscode 里,比如 esp-idf/examples/get-started/hello_world,点击 vscode 底栏里的图标进行设置串口、芯片系列,然后编译
下载或打开串口监控前需要使用sudo chmod 777 /dev/ttyUSB0
来让 usb 转串能被非 root 用户访问,重启电脑后需再次执行
问题
很可能在最后一步安装 Python 虚拟环境时出现错误,每步错误有对应的方法
错误之后使用 Advance 来装,参考“其他”一节里的链接
错误 1:
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'venv', '--clear', '--upgrade-deps', '/media/xiaguangbo/新加卷/linux/project/esp/.espressif/python_env/idf5.2_py3.11_env']' returned non-zero exit status 1.解决方法:
/usr/bin/python3 -m venv /media/xiaguangbo/新加卷/linux/project/esp/.espressif/python_env/idf5.2_py3.11_env
错误 2:
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
Error: Command '['/media/xiaguangbo/新加卷/linux/project/esp/.espressif/python_env/idf5.2_py3.11_env/bin/python3', '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools']' returned non-zero exit status 2.解决方法:
cd 到 /media/xiaguangbo/新加卷/linux/project/esp/.espressif/python_env/idf5.2_py3.11_env 下
source ./activate
python -m pip install --upgrade pip
deactivate
错误3:
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.解决方法:
科学上网全局代理并重开终端执行,不然就是下载慢
/media/xiaguangbo/新加卷/linux/project/esp/.espressif/python_env/idf5.2_py3.11_env/bin/python -m pip install --upgrade --constraint /home/xiaguangbo/.vscode/extensions/espressif.esp-idf-extension-1.6.4/espidf.constraints.txt --no-warn-script-location -r /home/xiaguangbo/.vscode/extensions/espressif.esp-idf-extension-1.6.4/requirements.txt
其他
https://blog.csdn.net/qq_44018052/article/details/113949078