1. 程式人生 > 其它 >ESP Windows10 環境搭建(未完成)

ESP Windows10 環境搭建(未完成)

提前安裝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
}