在 WSL 环境中
c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/home/shino/esp/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++",
"cStandard": "c11",
"cppStandard": "gnu++14",
"intelliSenseMode": "clang-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
zshrc.sh
export IDF_TOOLS_PATH=~/esp/.espressif
export IDF_PATH=~/esp/esp-idf
alias cmd="cmd.exe"
alias open="explorer.exe ."
alias esp="source ~/esp/esp-idf/export.sh"
在 Windows 环境中
c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "D:\\Library\\esp\\.espressif\\tools\\xtensa-esp32-elf\\esp-2019r2-8.2.0\\xtensa-esp32-elf\\bin\\xtensa-esp32-elf-gcc.exe",
"cStandard": "c11",
"cppStandard": "gnu++14",
"intelliSenseMode": "clang-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
C/C++ 插件的compileCommands可以直接使用 build文件里面的compile_commands.json,可以先编译出现compile_commands.json后再把文件里面的编译器复制输入到compilerPath属性中。
环境变量
image.png image.png image.png
添加这个可以类似于Linux中
alias esp="source ~/esp/esp-idf/export.sh"
在终端上输入 esp ,则自动导出编译环境,然后就可以下载调试了。image.png
网友评论