This forces the user to add a debug_port variable to their platformio.ini correct? Is there a way to specify that platformio should automatically choose a port? Right now I have to constantly change that variable depending on which board I’m debugging.
To use gdb from the cmd line, I create a file called gdbcmds, with something similar to following:
set remote hardware-breakpoint-limit 1
set remote hardware-watchpoint-limit 1
mem 0x20000000 0x3fefffff ro cache
mem 0x3ff00000 0x3fffffff rw
mem 0x40000000 0x400fffff ro cache
mem 0x40100000 0x4013ffff rw cache
mem 0x40140000 0x5fffffff ro cache
mem 0x60000000 0x60001fff rw
set remotebaud 115200
target remote /dev/cu.SLAB_USBtoUART
Sure thing. I added a gdb.sh file which runs gdb from the command line and I also added my attempt at a platformio debug configuration to the d1_mini.json in the corresponding platform-espressif8266 fork.
Here’s the repo:
You will need to change the port in the last line of gdbcmds and in the last line of platformio.ini.
pio debug -d /tmp/111 --interface gdb
PlatformIO Plus (https://pioplus.com) v1.1.6
GNU gdb (crosstool-NG 1.20.0) 7.5.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_apple-darwin14.1.0 --target=xtensa-lx106-elf".
For bug reporting instructions, please see:
(gdb) source .pioinit
0x40000f68 in ?? ()
(gdb) i threads
Id Target Id Frame
* 1 Thread <main> 0x40000f68 in ?? ()
(gdb) b setup
Breakpoint 1 at 0x402022d6: file src/main.cpp, line 15.
Note: automatically using hardware breakpoints for read-only addresses.
// Set LED_BUILTIN if it is not defined by Arduino framework
// #define LED_BUILTIN 13
// initialize LED digital pin as an output.
// turn the LED on (HIGH is the voltage level)
// wait for a second
// turn the LED off by making the voltage LOW
// wait for a second