提前安装git python3
0. 在 gitee 上下载想安装的 idf 版本
git clone -b [tags标签/分支名称] [git地址]
git clone -b release/v4.3 https://gitee.com/EspressifSystems/esp-idf.git
1. bash 终端
cd esp-idf
export IDF_TOOLS_PATH='D:\_software_\esp\esp-idf-v4.3\.espressif'
../../esp-gitee-tools/install.sh
../../esp-gitee-tools/submodule-update.sh
vscode 的 powershell 的 $PROFILE 文件对应修改
---------------------------------------------------------------------------------
$PROFILE
---------------------------------------------------------------------------------
# 允许PowerShell执行脚本:
# 管理员身份运行PowerShell -> 输入命令 Set-ExecutionPolicy RemoteSigned -> 允许
# idf环境初始化函数
function esp_env_init_v4.3{
# 新增环境变量
$env:IDF_TOOLS_PATH='D:\_software_\esp\esp-idf-v4.3\.espressif'
# 执行脚本
. D:\_software_\esp\esp-idf-v4.3\esp-idf\export.ps1
}
# 打开 IDF 配置(手动配置打开的难看的窗口属性,下次会保持)
function idf_menuconfig{
# 打开新的 powershell 窗口并执行命令
Start-Process powershell -ArgumentList "-command &{idf.py menuconfig}"
}
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
c_cpp_properties.json
---------------------------------------------------------------------------------
{
/* 自定义变量 */
"env": {
/**
* esp-idf-v4.1 版本适用于 ESP32
* esp-idf-v4.3 版本适用于 ESP32C3
*/
"espIdfPath": "D:/_software_/esp/esp-idf-v4.3"
},
/* 配置 */
"configurations": [
{
"name": "ESP-IDF",
"cStandard": "c11",
"cppStandard": "c++17",
"includePath": [
"${workspaceFolder}/**",
"${espIdfPath}/esp-idf/components/**"
],
"browse": {
"path": [
"${workspaceFolder}",
"${espIdfPath}/esp-idf/components"
],
"limitSymbolsToIncludedHeaders": false
},
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}