如何搭建vscode+platformio+arduino
1354 2022-08-31 08:24
我的电脑本身装有python,我是程序员喜欢win7,所以python版本是3.8 64-bit,默认安装之后,系统path不会变,会在用户path中加入两项python相关。
第二步安装vscode,去官网下载的最新版。
第三步改python为清华源,然后安装platformio
第四步去csdn下载回来403M的离线包PlatformIO_Core,解压后设置环境变量
第五步用文件导入方式安装platformio.platformio-ide-2.4.3.vsix
第六步升级platformid到最新版
最终克服了pio run -t build
pip uninstall platformio
删除D:\Program Files (x86)\PlatformIO_Core下的penv文件夹
删除%userprofile%下的.vscode\extensions\platformio.platformio-ide-x.x.x
pip install platformio 换清华源,而不是用github下载的get-platformio.py来安装。
pio --version
设置用户PLATFORMIO_CORE_DIR变量为D:\Program Files (x86)\PlatformIO_Core
设置系统path变量,添加虚拟环境下的python的script文件夹位置
pio system info
pio run -t build,成功后注意保存package里面变动的两个文件夹,以及文件夹外面的两个json文件
settings.json如下:
{
"workbench.colorTheme": "Default Light+",
"platformio-ide.customPATH": "C:\\Users\\21\\AppData\\Local\\Programs\\Python\\Python38\\Script",
"platformio-ide.useBuiltinPython": false,
"platformio-ide.useBuiltinPIOCore": false,
"extensions.autoUpdate": false,
"idf.gitPathWin": "D:\\Espressif\\tools\\idf-git\\2.30.1\\cmd\\git.exe",
"idf.espIdfPathWin": "d:\\esp\\esp-idf",
"idf.pythonBinPathWin": "D:\\Espressif\\python_env\\idf4.4_py3.8_env\\Scripts\\python.exe",
"idf.toolsPathWin": "D:\\Espressif",
"idf.customExtraPaths": "D:\\Espressif\\tools\\xtensa-esp-elf-gdb\\12.1_20221002\\xtensa-esp-elf-gdb\\bin;D:\\Espressif\\tools\\riscv32-esp-elf-gdb\\12.1_20221002\\riscv32-esp-elf-gdb\\bin;D:\\Espressif\\tools\\xtensa-esp32-elf\\esp-12.2.0_20230208\\xtensa-esp32-elf\\bin;D:\\Espressif\\tools\\xtensa-esp32s2-elf\\esp-12.2.0_20230208\\xtensa-esp32s2-elf\\bin;D:\\Espressif\\tools\\xtensa-esp32s3-elf\\esp-12.2.0_20230208\\xtensa-esp32s3-elf\\bin;D:\\Espressif\\tools\\riscv32-esp-elf\\esp-12.2.0_20230208\\riscv32-esp-elf\\bin;D:\\Espressif\\tools\\esp32ulp-elf\\2.35_20220830\\esp32ulp-elf\\bin;D:\\Espressif\\tools\\cmake\\3.24.0\\bin;D:\\Espressif\\tools\\openocd-esp32\\v0.12.0-esp32-20230313\\openocd-esp32\\bin;D:\\Espressif\\tools\\ninja\\1.10.2;D:\\Espressif\\tools\\idf-exe\\1.0.3;D:\\Espressif\\tools\\ccache\\4.8\\ccache-4.8-windows-x86_64;D:\\Espressif\\tools\\dfu-util\\0.11\\dfu-util-0.11-win64;D:\\Espressif\\tools\\esp-rom-elfs\\20230320",
"idf.customExtraVars": {
"OPENOCD_SCRIPTS": "D:\\Espressif\\tools\\openocd-esp32\\v0.12.0-esp32-20230313/openocd-esp32/share/openocd/scripts",
"IDF_CCACHE_ENABLE": "1",
"ESP_ROM_ELF_DIR": "D:\\Espressif\\tools\\esp-rom-elfs\\20230320/"
},
"idf.adapterTargetName": "esp32s2",
"platformio-ide.toolbar": [
{
"text": "$(home)",
"tooltip": "PlatformIO: Home",
"commands": "platformio-ide.showHome"
},
{
"text": "$(check)",
"tooltip": "PlatformIO: Build",
"commands": "platformio-ide.build"
},
{
"text": "$(arrow-right)",
"tooltip": "PlatformIO: Upload",
"commands": "platformio-ide.upload"
},
{
"text": "$(trashcan)",
"tooltip": "PlatformIO: Clean",
"commands": "platformio-ide.clean"
},
{
"text": "$(beaker)",
"tooltip": "PlatformIO: Test",
"commands": "platformio-ide.test"
},
{
"text": "$(plug)",
"tooltip": "PlatformIO: Serial Monitor",
"commands": "platformio-ide.serialMonitor"
},
{
"text": "$(terminal)",
"tooltip": "PlatformIO: New Terminal",
"commands": "platformio-ide.newTerminal"
}
]
}
全部评论