Skip to content

Using GDB for online debugging ESP8266 #2663

Closed
@ghost

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    waiting for feedbackWaiting on additional info. If it's not received, the issue may be closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions