microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.51k stars 1.55k forks source link

Remote Serial Debugging ESP8266 #1447

Open weswitt opened 6 years ago

weswitt commented 6 years ago

I would like to know how to get remote serial debugging working with ESP8266 devices. Seems like there should be a way to make this work, but I haven't found it yet. When I start debugging VSCODE is trying to launch the elf file locally on my PC. What I want is for VSCODE to start the local GDB debugger. Below is my launch.json file. Is there something wrong in my launch file?

{ "version": "0.2.0", "configurations": [ { "name": "Launch", "type": "cppdbg", "request": "launch", "program": "d:/dev/src/homeauto/sonoff/app/bin/esp8266/sonoff.elf", "cwd": "d:/dev/src/homeauto/sonoff/app", "miDebuggerPath": "d:/dev/arduino-1.8.5/hardware/esp8266com/esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gdb.exe", "MIMode": "gdb", "setupCommands": [ { "text": "file d:/dev/src/homeauto/sonoff/app/bin/esp8266/sonoff.elf" }, { "text": "set remotelogfile d:/dev/src/homeauto/sonoff/app/gdblog.txt" }, { "text": "set serial baud 115200" }, { "text": "set remote hardware-breakpoint-limit 1" }, { "text": "set remote hardware-watchpoint-limit 1" }, { "text": "target remote com4" } ], "externalConsole": false, "visualizerFile": "d:/dev/src/homeauto/sonoff/app/.vscode/stl.natvis" } ] }

pieandcakes commented 6 years ago

if you enable logging via "logging": { "engineLogging": true } you can see the commands sent and received to gdb and from there see what is wrong and what order we send the commands. you may also want to look at setting "launchCompleteCommand" to override the -exec-run we send to gdb when debugging setup is complete.

pieandcakes commented 6 years ago

Otherwise, I've never done this scenario so hopefully someone else in the community that has can give you some pointers.

jptechadv commented 6 years ago

@weswitt Hi, did you ever get this to work?

ngrplus commented 5 years ago

Go it working with ESP8266. Main hints came from

launch.json: { "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/EspDebugTest1.ino.elf", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, "MIMode": "gdb", "miDebuggerPath": "C:\Users\xxxx\AppData\Local\Arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9\bin\xtensa-lx106-elf-gdb.exe", "miDebuggerServerAddress": "\\.\COM4", "setupCommands": [ {"text": "set remote hardware-breakpoint-limit 1"}, {"text": "set remote hardware-watchpoint-limit 1"}, {"text": "set remote interrupt-on-connect on"}, {"text": "set remote kill-packet off"}, {"text": "set remote symbol-lookup-packet off"}, {"text": "set remote verbose-resume-packet off"}, {"text": "mem 0x20000000 0x3fefffff ro cache"}, {"text": "mem 0x3ff00000 0x3fffffff rw"}, {"text": "mem 0x40000000 0x400fffff ro cache"}, {"text": "mem 0x40100000 0x4013ffff rw cache"}, {"text": "mem 0x40140000 0x5fffffff ro cache"}, {"text": "mem 0x60000000 0x60001fff rw"}, {"text": "set serial baud 115200"} ] } ] }