1.Create Project
Open VSCode
Ctrl+Shift+P ESP-IDF: Show Examples Projects
hello_world
Create project using example hello_world
2.Setup
Select port to use (COMx)
set device targete
Build project
Select flash method (JTAG)
edit file: .vscode/settings.json
(注意修改COMx)
1 2 3 4 5 6 7 8 9
| { "C_Cpp.intelliSenseEngine": "Tag Parser", "idf.portWin": "COMx", "idf.openOcdConfigs": [ "interface/esp_usb_bridge.cfg", "target/esp32.cfg" ], "idf.flashType": "JTAG" }
|
Ctrl+Shift+P ESP-IDF: OpenOCD Manager
start openocd
.vscode/settings.json
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
| { "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": "target remote :3333" }, { "text": "set remote hardware-watchpoint-limit 2"}, { "text": "mon reset halt" }, { "text": "thb app_main" }, { "text": "flushregs" } ], "externalConsole": false, "logging": { "engineLogging": true } } ] }
|
3.Flash And Debug
flash
F5
Try more times
Other
https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/tutorial/debugging.md