新建launch.json
在 .vscode
目录下新建launch.json
文件。
{
"version": "0.2.0",
"configurations": [
{
"name": "ESP32 Cortex-debug",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}/build",
"program": "${workspaceRoot}/build/${workspaceFolderBasename}.elf",
"miDebuggerPath": "${userHome}/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin/xtensa-esp32-elf-gdb",
"setupCommands": [
{ "text": "target remote 127.0.0.1:3333" },
{ "text": "set remote hardware-watchpoint-limit 2" },
{ "text": "monitor reset halt" },
{ "text": "flushregs" },
{ "text": "mon program_esp build/bootloader/bootloader.bin 0x1000 verify" },
{ "text": "mon program_esp build/partition_table/partition-table.bin 0x8000 verify" },
{ "text": "mon program_esp build/${workspaceFolderBasename}.bin 0x10000 verify" },
{ "text": "flushregs" }
]
}
]
}