vscdoe+虚拟机开发ESP32

本文最后更新于:5 个月前

说明:

  1. 本文档由DuRuofu撰写,由DuRuofu负责解释及执行。
  2. 本文档主要记载一些vscdoe配合虚拟机远程连接开发ESP32的窍门

vscdoe配合虚拟机远程连接开发

1. 连接虚拟机开发过程

这部分不再赘述,主要依靠Remote -SSH插件,然后编译使用命令行。


网上搜素vscode远程开发即可

2. 一些问题的处理

2.1 头文件跳转的问题

不使用esp-idf插件的原因是多版本切换不方便,使用命令行能随时多版本切换,但是这样导致我们的代码头文件无法跳转,写代码没有代码提示。

无法跳转:

无有效代码提示:

解决办法:
先编译代码:

然后找到build下的compile_commands.json文件:

右键复制绝对路径:

然后打开命令面板:

找到这一项:

将绝对路径复制到编译命令:

然后就能正常跳转到源码了

代码提示也有了:

2.2 手输命令太麻烦的问题

使用Run Terminal Command插件可视化执行命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
"runTerminalCommand.commands": [


//------------------V4-----------------//
// 删除
{
"command": "get_idf_v4 && idf.py fullclean",
"auto": true,
"name": "fullclean",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
// 配置
{
"command": "get_idf_v4 && idf.py menuconfig",
"auto": true,
"name": "menuconfig",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
// 编译
{
"command": "get_idf_v4 && idf.py build",
"auto": true,
"name": "build",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
// 查询串口
{
"command": "ls /dev/ttyUSB*",
"auto": true,
"name": "Query serial port",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
// 烧录
{
"command": "get_idf_v4 && idf.py -p {clipboard} flash",
"auto": true,
"name": "flash",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
//打开监视器
{
"command": "get_idf_v4 && idf.py -p {clipboard} monitor",
"auto": true,
"name": "monitor",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
//一次性编译烧录和打开监视
{
"command": "get_idf_v4 && idf.py -p {clipboard} flash monitor",
"auto": true,
"name": "build&flash&monitor",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
// 擦除
{
"command": "get_idf_v4 && idf.py -p {clipboard} erase_flash",
"auto": true,
"name": "erase_flash",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
//查询内存剩余
{
"command": "get_idf_v4 && idf.py size",
"auto": true,
"name": "size",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
// 设置开发板esp32
{
"command": "get_idf_v4 && idf.py fullclean && idf.py set-target esp32",
"auto": true,
"name": "set-target esp32",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
// 设置开发板esp32c3
{
"command": "get_idf_v4 && idf.py fullclean && idf.py set-target esp32c3",
"auto": true,
"name": "set-target esp32c3",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
// 设置开发板esp32s3
{
"command": "get_idf_v4 && idf.py fullclean && idf.py set-target esp32s3",
"auto": true,
"name": "set-target esp32s3",
"preserve": true,
"group": "ESP-IDF-v4.4.6"
},
//------------------V5-----------------//
// 删除
{
"command": "get_idf_v5 && idf.py fullclean",
"auto": true,
"name": "fullclean",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
// 配置
{
"command": "get_idf_v5 && idf.py menuconfig",
"auto": true,
"name": "menuconfig",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
// 编译
{
"command": "get_idf_v5 && idf.py build",
"auto": true,
"name": "build",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
// 查询串口
{
"command": "ls /dev/tty*",
"auto": true,
"name": "Query serial port",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
// 烧录
{
"command": "get_idf_v5 && idf.py -p {clipboard} flash",
"auto": true,
"name": "flash",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
//打开监视器
{
"command": "get_idf_v5 && idf.py -p {clipboard} monitor",
"auto": true,
"name": "monitor",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
//一次性编译烧录和打开监视
{
"command": "get_idf_v5 && idf.py -p {clipboard} flash monitor",
"auto": true,
"name": "build&flash&monitor",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
// 擦除
{
"command": "get_idf_v5 && idf.py -p {clipboard} erase_flash",
"auto": true,
"name": "erase_flash",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
//查询内存剩余
{
"command": "get_idf_v5 && idf.py size",
"auto": true,
"name": "size",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
// 设置开发板esp32
{
"command": "get_idf_v5 && idf.py fullclean && idf.py set-target esp32",
"auto": true,
"name": "set-target esp32",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
// 设置开发板esp32c3
{
"command": "get_idf_v5 && idf.py fullclean && idf.py set-target esp32c3",
"auto": true,
"name": "set-target esp32c3",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
// 设置开发板esp32s3
{
"command": "get_idf_v5 && idf.py fullclean && idf.py set-target esp32s3",
"auto": true,
"name": "set-target esp32s3",
"preserve": true,
"group": "ESP-IDF-v5.1.2"
},
],

然后就可以使用命令快捷方式来开发ESP32了,效率提示。


vscdoe+虚拟机开发ESP32
https://www.duruofu.xyz/2024/01/30/4.硬件相关/MCU/ESP32/01.环境搭建/vscdoe+虚拟机开发ESP32/
作者
DuRuofu
发布于
2024年1月30日
更新于
2024年1月30日
许可协议