Open Mat-Alm opened 4 years ago
@Mat-Alm thanks for the report and sorry for the trouble you had to go through. For the first issue, it looks like there is some regression in -O0 builds. Will investigate and report back.
For the 2nd issue, have you tried telling OpenOCD about the application binary image offset? It can be done when running OpenOCD:
openocd -f board/esp32-wrover-kit-3.3v.cfg -c "init; halt; esp32 appimage_offset 0x210000"
(replace the cfg file name with the one you use)
You are right that modifying application binary offset and then debugging afterwards is not ergonomic. We will try to improve this workflow in the IDE plugins.
@Mat-Alm thanks for the report and sorry for the trouble you had to go through. For the first issue, it looks like there is some regression in -O0 builds. Will investigate and report back.
For the 2nd issue, have you tried telling OpenOCD about the application binary image offset? It can be done when running OpenOCD:
openocd -f board/esp32-wrover-kit-3.3v.cfg -c "init; halt; esp32 appimage_offset 0x210000"
(replace the cfg file name with the one you use)
You are right that modifying application binary offset and then debugging afterwards is not ergonomic. We will try to improve this workflow in the IDE plugins.
openocd -f board/esp32-wrover-kit-3.3v.cfg -c "init; halt; esp32 appimage_offset 0x20000" Skip the 1 in the 0x210000
Now i get the next error: Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a work-around
Pffff, esp-idf debugging is indeed a nightmare... ;-(
Any solution for this issue. I am also facing a similar issue, see logs below
Debugging worked once and then its just not going in debug mode.
idf version used v4.1-dev-1931-g68be5f6ca and additional eclipse last plugins provided by vendor. debug interface interface jlink openocd version: v0.10.0-esp32-20190313 (the most stable version for me)
1º Problem
Open any idf example project on eclipse. Disable booloader verbose log, set compiler optimization to -O0 (no optimization) and build the project. Load the executable with with serial bootloader. Result -> the device keep restarting! Do the same with -Og optimization and the main application runs fine!
Now comes the odd things. If i start an openocd section (just succesfull connection) with debugger conected to the board it runs the application just ok. But wait you can claim that debug interface is interfering with boot strap right! But not... If I just flash (by serial) other board without any other connection than usb cable it also keep restarting with -O0 optmization!
But here is a good thing you can debug fine the aplication with -O0 settings if you first upload the bootloader and partiton data by serial. (Yes I'am flashing only application section at every new debug section). The previous bug still present by far...
So you will question.. Why you need -O0 optimization? Because with -Og (or any other debug level rather than -O0) you get a really bad debug experience... Single step is simple useless.
2º Problem: Main app offset and debug.
So you want to have booloader verbose turned on to see what is going on right? So you need to increase bootloader section. To do this you need to start the main_app at some address different of 0x10000. So let increase the boot section to 0x10000 and start the main_app at 0x20000.
And here we start another kind of troubles. If you try to debug your project with this settings you can't set any breakpoints at functions that reside in flash region. If the function is in a ram section it's work with the addtion with previous bugs mentioned. The debugger flash upload region main app is adjusted as needed.
Here is the log with default (0x10000) address app_main :
Here is with offset of 0x20000:
If try put put any break point on functions that are in flash section and try to run/step you will get:
Info : Target halted. PRO_CPU: PC=0x400D58FA (active) APP_CPU: PC=0x400EDE58 Error: esp32: Failed to read insn (-4)! Error: esp32: Failed to add SW BP! Error: can't add breakpoint: resource not available Error: esp32: Failed to read insn (-4)! Error: esp32: Failed to add SW BP! Error: can't add breakpoint: resource not available
Should I giveup to ESP32? I waste more than 5 days to see why this is not working.. Should I spend more time on this Soc?