Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using GDB for online debugging ESP8266 #2663

Closed
ghost opened this issue Nov 5, 2016 · 6 comments
Closed

Using GDB for online debugging ESP8266 #2663

ghost opened this issue Nov 5, 2016 · 6 comments
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.

Comments

@ghost
Copy link

ghost commented Nov 5, 2016

Basic Infos

Hardware

Hardware: ESP8266 (NodeMCU)

Description

Problem description

For couple of days I've been struggling to configure debugging for ESP8266 running on Arduino and using PlatformIO.
I managed to build a proper binary file with http://blog.squix.org/2016/04/esp8266-offline-debugging-with.html:

  1. Added build_flags = -Og -ggdb -DDEBUG_ESP_PORT=Serial to platformio.ini
    2.Downloaded full xtensa SDK as this provided for PIO does not include xtensa GDB
    Thanks to these steps I am able to offline debug - see lines numbers etc,but I cannot make it work with online debugging. Here is what i ve done:
  2. Added GDBStub.h include to my mian class
  3. Started GDB with firmware that has debugging symbols included(form step 1) to debug via COM - set baud rate to 115200 (the same as I use for normal state check via serial moniotr - wifi messages etc.) .
  4. I get no response - only timouts etc
  5. In the result I would like to use CLion to insert breakpoints watches etc.

Can someone pint me what I'm mising ? I have 2 suspicions :

  • Is inluding only GDBAtub.h enough or shoul I call gdb_init somewhere (its's not recognized as a function) or do anything more.
  • Baud rate - should I use the same as the one set for serial communication messages (115200) ?

I am using Windows.

After some reading I changed build flags to :

build_flags = -Og -ggdb -DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_CORE -DDEBUG_ESP_SSL -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_TLS_MEM

Module: NODEMCUv2 / ESP12E

Sketch

#include <ESP8266WiFi.h>
#include <ArduinoOTA.h>
#include <pb_encode.h>
#include <pb_decode.h>
#include <ESP8266mDNS.h>
#include <GDBStub.h>

void setup() {
 Serial.begin(115200);
}

void loop() {

}

Debug Messages

messages here
@igrr
Copy link
Member

igrr commented Nov 7, 2016

GDBStub will be invoked when exception happens, as in its current configuration it supports only post-mortem debugging. GDBStub has a feature to break into debugger on Ctrl-C (in uart console, not in GDB), but it has to be activated in GDBStub, and it may conflict with HardwareSerial which also installs its own UART interrupt handler. I once added a "break into debugger on button" hack to GDBStub, it requires replacing UART interrupt with a GPIO interrupt. You can try that if you like.

@tomaszchacuk
Copy link

tomaszchacuk commented Nov 7, 2016

Thanks for reply. I was thinking of kind of debugging that does not happen on some kind of exception but rather possibility investigate live-state of variables. Preferably I would like to achieve an effect like described in this tutorial for Sming( Eclipse/CLion integration etc): https://blog.attachix.com/live-debugging-with-open-source-tools-programming-for-esp8266-part-4/

In what way it's possible yo replace the interrupt ?

@freeck
Copy link

freeck commented Dec 12, 2016

I cannot follow all the details and implications of the discussion above, but I observe that from version 2.0 on, debugging as it worked so far (v1.6) isnt functioning anymore in the latest versions. I.e. Setting breakpoints, inspect variables, stepping....etc...were very nice featues! why has that been changed? Or do I need some configuration tweeking to enable debugging?

May we expect a solution to this issue soon? Or a more detailed documentation on how to configure application level debugging? No is also an answer :)
Thanks

@freeck
Copy link

freeck commented Jun 5, 2017

I solved my issue see: Sloeber/arduino-eclipse-plugin#593
However os_install_putc1() does not seem to work using release 2.3.

@devyte
Copy link
Collaborator

devyte commented Oct 11, 2017

@W2K is this issue still valid? Have you tried latest git?

@devyte devyte added the waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. label Oct 11, 2017
@freeck
Copy link

freeck commented Oct 11, 2017

Same issue using 2.4.0rc1, (is that the latest git?) but as reported earlier in this thread my issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.
Projects
None yet
Development

No branches or pull requests

4 participants