Debug mode for ESP8266

Hey team,

How on earth do you enable debug for D1 Mini clone (8266)? When I click the play button, it asks me to edit a json file. In the preview video from over a year ago, it just shows starting it and selecting which of the lines you want to view the variable values.

Any tips or walkthroughs, please?

Thank you!
Dax.

Hey there, any news on this, please?

@pert - can you help here ?

1 Like

The reason you are getting this thing about the settings.json file is that the ESP8266 boards platform does not provide the necessary configuration information. If you're the "TL;DR" type, then the answer is "you can't do it". Otherwise, feel free to read on.

I'm sure more will follow over time, but as far as I know, currently the only boards platform that has been configured to provide that information is the "Arduino SAMD Boards" platform of the MKR, Nano 33 IoT, and Zero boards. If you want to use the Arduino IDE 2.x debugger, your best bet is to use one of those boards. The Arduino Zero is the most convenient due to having a built-in debug probe, so it's only a matter of plugging its "Programming" port in to your computer as usual and you're ready to go. The second most convenient is the MKR1000, due to having the standard SWD header you can plug any CMSIS-DAP compliant debug probe into. The other boards are less convenient due to having their SWD header either broken out to a non-standard 2x3 0.1" pitch SMD header footprint on the bottom of the MKR boards, or a series of test pads on the Nano 33 IoT, but you just need to make the appropriate electrical connections between a debug probe and the board and you're set.

There is nothing about the debugger that restricts it to use only for the "Arduino SAMD Boards" platform. The configuration parameters are not fully documented (there is a little piece here), but you can find the necessary minimal changes by checking the platform.txt configuration file of the Arduino SAMD Boards platform:
https://github.com/arduino/ArduinoCore-samd/blob/master/platform.txt
However, it's not sure whether or not it is possible to use it with the ESP8266. Even though the Arduino boards platform configuration system for the debugger is reasonably flexible and the GDB command line tool driving the whole thing can be used with the ESP8266, the IDE's integrated debugger is this VS Code extension:

Note in the description:

Debugging support for ARM Cortex-M Microcontrollers

The ESP8266 does not use an ARM Cortex-M core, so this is not such a promising sign.

Armed with this knowledge, you might be able to learn more with some research and experimentation.

Hey @in0, thank you very much for your reply.

If you're the "TL;DR" type
I'm not. :smiley:
I really appreciate you taking the time to explain the situation. Makes perfect sense. I got really excited when I thought I wouldn't have to add serial print lines in my code to 'peek' at values during runtime.

I might buy a Arduino DUE R3, Wemos SAMD21 M0 or SAMD21 M0-Mini to use for development, then write it to whatever the production board is going to be.

Thanks everyone!
Dax.

Yay! I guess you can tell I'm not either.

FYI, the "Arduino SAM Boards" platform of the Arduino Due is also not configured for the debugger. I suspect this would be very easy to do since the Due's ATSAM3X8E microcontroller does have a Cortex-M core, but this platform is not actively maintained anymore, so it could be a long time before Arduino gets around to it, if ever. But you could probably use the Arduino SAMD Boards platform as a model. It's only a few lines of changes to the configuration files.

Thanks, I'll go for a SAMD21 board, then. No point in making it harder for myself! :slight_smile: