ESP32S3在VScode中使用USB口调试
安装USB驱动
在powershell中输入下面指令:
c
Invoke-WebRequest 'https://dl.espressif.com/dl/idf-env/idf-env.exe' -OutFile .\idf-env.exe; .\idf-env.exe driver install --espressif
参考官方网址
安装成功之后连接开发板的USB口(非串口)如下图所示:
修改工程的配置文件
参考文档:
JTAG调试
使用VS code调试
launch.json
修改为如下内容:
json
{
"version": "0.2.0",
"configurations": [
{
"name": "GDB",
"type": "cppdbg",
"request": "launch",
"MIMode": "gdb",
"miDebuggerPath": "${command:espIdf.getXtensaGdb}",
"program": "${workspaceFolder}/build/${command:espIdf.getProjectName}.elf",
"windows": {
"program": "${workspaceFolder}\\build\\${command:espIdf.getProjectName}.elf"
},
"cwd": "${workspaceFolder}",
"environment": [{ "name": "PATH", "value": "${config:idf.customExtraPaths}" }],
"setupCommands": [
{ "text": "set remotetimeout 100" },
{ "text": "target extended-remote :3333" },
{ "text": "set remote hardware-watchpoint-limit 2"},
{ "text": "mon reset halt" },
{ "text": "thb app_main" },
{ "text": "flushregs" }
],
"externalConsole": false,
"logging": {
"engineLogging": true
}
}
]
}
settings.json
修改如下:
json
//"idf.openOcdConfigs": [
// "interface/ftdi/esp32_devkitj_v1.cfg",
// "target/esp32.cfg"
//],
"idf.openOcdConfigs": [
"board/esp32s3-builtin.cfg"
],
启动GDB Server