Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By jcmvbkbc
#14660 Hi Angus,
I've posted a pull request with a possible workaround for the watchdog, please take a look.
Tested it with firmware that uses WDT, doesn't get reset with these two patches.
Watchdog disabling is a bit rough, zeroing whole word at 0x60000900, haven't managed to read a word and write it back only clearing LSB.
User avatar
By projectgus
#14664 Merged, thank you! Looks good. Did you happen to notice if the value at 0x60000900 goes back to the pre-halt value after the watchdog is fed again? My suspicion, without having looked at the disassembly, is that feeding the watchdog just writes a whole new value there each time.

I made a start on hardware breakpoint support a while ago but have been overloaded with work the last few weeks. I'm hoping to get back to this soon, but if anyone else wants to contribute a breakpoint implementation then I'm OK with that as well. :)
User avatar
By projectgus
#16662 Made some progress, new commits pushed including some fixes and hardware breakpoint support.

openocd usually tells gdb where to use hard vs soft breakpoints based on the flash map. There's no flash driver yet so no flash map, so to use breakpoints first run:
Code: Select allgdb_breakpoint_override hard

... in openocd before setting a breakpoint. Also remember there's only one breakpoint!

***

Found what looks like a bug in gdb when unwinding call0 stack frames. Registers in previous frames aren't read properly. This becomes really obvious if the frame pointer is on (nonsense backtraces), but probably has other effects too. Patch here. Can anyone test this or confirm it looks reasonable before I take it to the gdb maintainers?

For future reference - If you used crosstool for your existing gdb but want to build a new gdb from git, and install it over the old gdb, the steps are:
Code: Select allcd /path/to/gdb/source/
tar --strip-components=1 -xvf /path/to/esp-open-sdk/crosstool-NG/overlays/xtensa_lx106.tar gdb
./configure --target=xtensa-lx106-elf' '--prefix=/path/to/esp-open-sdk/xtensa-lx106-elf' '--with-build-sysroot=/path/to/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot' '--with-sysroot=/path/to/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot
make
make install


(You can possibly also just patch the gdb 7.5.1 in the crosstool-NG/.build directory and rerun ct-ng build. I didn't try that.)

***

Still no luck finding a way to break on reset, for 'reset halt'.
User avatar
By projectgus
#16669 Hmm, backtraces are still a bit flaky especially when being called from SDK code (ie stack will be intact and a0/a1 set correctly, but 'bt' produces nonsense). It could be an openocd bug, but I think maybe the call0 function prologue analysis in gdb is misreading the prologues sometimes.