eATM

esp32开发-vs2019/2022环境搭建

安装 esp-idf与tools

https://dl.espressif.cn/dl/esp-idf/

https://dl.espressif.cn/dl/idf-installer/esp-idf-tools-setup-online-2.16.exe

这个安装程序会自动下载github与esp32官网(国内)的文件,最好先设置全局代理,下载国内时可能出错,再取消代理可继续下载,如弹出错误导致安装程序退出可重新运行继续下载安装.

本文相关文件位置

esp-idf: D:\iot_dev\toolchain\esp-idf\v4.4.1

esp tools: D:\iot_dev\toolchain\esp-idf\.espressif

python3:  C:\Program Files\python3.10

git: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd

效果图

CMakeSettings.json - (项目根目录)

				
					{
  "configurations": [
        {
      "name": "esp32_v4.4.2",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "linux_x64" ],
      "buildRoot": "${projectDir}\\build\${name}",
      "installRoot": "${projectDir}\\install\${name}",
      "cmakeCommandArgs": "--warn-uninitialized",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "environments": [
        {
          "IDF_PATH": "D:\\esp_dev\\v4.4.2\\esp-idf",
          "IDF_TOOLS_PATH": "D:\\esp_dev\\v4.4.2",
          "IDF_TOOLS_TOOLS": "${env.IDF_TOOLS_PATH}\\tools",
          "IDF_PYTHON_ENV_PATH": "${env.IDF_TOOLS_PATH}\\python_env\\idf4.4_py3.8_env",
          "IDF_GIT_DIR": "${env.IDF_TOOLS_PATH}\\tools\\idf-git\.30.1\\cmd",
          "IOT_SOLUTION_PATH": "D:\\iot_dev\\toolchain\\esp-iot-solution",
          "OPENOCD_SCRIPTS": "${env.IDF_TOOLS_PATH}\\tools\\openocd-esp32\\v0.11.0-esp32-20211220\\openocd-esp32\\share\\openocd\\scripts",
          "PATH": "${env.IDF_TOOLS_TOOLS}\\ccache\.3\\ccache-4.3-windows-64;${env.IDF_TOOLS_TOOLS}\\cmake\.23.1\\bin;${env.IDF_TOOLS_TOOLS}\\xtensa-esp32-elf\\esp-2021r2-patch3-8.4.0\\xtensa-esp32-elf\\bin;${env.IDF_TOOLS_TOOLS}\\xtensa-esp32s2-elf\\esp-2021r2-patch3-8.4.0\\xtensa-esp32s2-elf\\bin;${env.IDF_TOOLS_TOOLS}\\esp32ulp-elf\.28.51-esp-20191205\\esp32ulp-elf-binutils\\bin;${env.IDF_TOOLS_TOOLS}\\esp32s2ulp-elf\.28.51-esp-20191205\\esp32s2ulp-elf-binutils\\bin;${env.IDF_TOOLS_TOOLS}\\ninja\.10.2\\;${env.IDF_TOOLS_TOOLS}\\idf-exe\.0.3\\;${env.IDF_TOOLS_TOOLS}\\ccache\.3\\;${env.IDF_TOOLS_PATH}\\python_env\\idf4.4_py3.8_env\\Scripts;${env.IDF_PATH}\\tools;${env.IDF_PATH};${env.PATH};",
          "INCLUDE": "${env.IDF_TOOLS_PATH}\\tools\\xtensa-esp32-elf\\esp-2021r2-patch3-8.4.0\\xtensa-esp32-elf\\xtensa-esp32-elf\\include;${env.IDF_PATH}\\components;${env.INCLUDE}",
          "FLASH_COM_PORT": "COM3",
          "FLASH_BAUD": "921600",
          "environment": "linux_x64"
        }
      ],
      "intelliSenseMode": "windows-clang-x64",
      "variables": [
        {
          "name": "IDF_TARGET",
          "value": "esp32",
          "type": "STRING"
        },
        {
          "name": "CMAKE_MAKE_PROGRAM",
          "value": "${env.IDF_TOOLS_PATH}\\tools\\ninja\.10.2\\ninja.exe",
          "type": "FILEPATH"
        },
        {
          "name": "CCACHE_ENABLE",
          "value": "1",
          "type": "STRING"
        },
        {
          "name": "ESP_PLATFORM",
          "value": "1",
          "type": "STRING"
        }
      ],
      "cmakeToolchain": "D:/esp_dev/v4.4.2/esp-idf/tools/cmake/toolchain-esp32.cmake"
    }
  ]
}
				
			

tasks.vs.json - (项目根目录)vs中文件列表右键菜单

				
					{
  "version": "0.2.1",
  "tasks": [
    {
      "taskLabel": "[ESP32 SDK Config]",
      "appliesTo": "*",
      "type": "launch",
      "inheritEnvironments": [
        "linux_x64"
      ],
      "command": "cmd",
      "args": [
        "/Q /K start idf.py menuconfig"
      ]
    },
    {
      "taskLabel": "[写入芯片]",
      "appliesTo": "*",
      "type": "launch",
      "inheritEnvironments": [
        "linux_x64"
      ],
      "command": "idf.py",
      "args": [
        "-p ${env.FLASH_COM_PORT} -b 921600 flash"
      ]
    },
    {
      "taskLabel": "[写入芯片后显示监控]",
      "appliesTo": "*",
      "type": "launch",
      "inheritEnvironments": [
        "linux_x64"
      ],
      "command": "cmd",
      "args": [
        "/Q /K idf.py -p ${env.FLASH_COM_PORT} -b 921600 flash & start idf.py monitor"
      ]
    },
    {
      "taskLabel": "[监控串口窗口]",
      "appliesTo": "*",
      "type": "launch",
      "inheritEnvironments": [
        "linux_x64"
      ],
      "command": "cmd",
      "args": [
        "/Q /K start idf.py monitor"
      ]
    },
    {
      "taskLabel": "[编译]",
      "contextType":"custom",
      "appliesTo": "*",
      "type": "launch",
      "inheritEnvironments": [
        "linux_x64"
      ],
      "command": "idf.py",
      "args": [
        "build"
      ]
    }
  ]
}
				
			

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注