JTAG debuggers

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: JTAG debuggers

Postby permal » Fri Aug 25, 2017 5:27 pm

Ok, this is what I see.

OpenOCD
sudo ./src/openocd -s ./tcl -f tcl/interface/ftdi/olimex-arm-usb-ocd.cfg -f ./sparkfun-esp32-thing.cfg
[sudo] password for permal:
Open On-Chip Debugger 0.10.0-dev-gcc5b0f7 (2017-08-10-17:21)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
force hard breakpoints
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : accepting 'gdb' connection on tcp/3333
Info : Target halted. PRO_CPU: PC=0x400D0D84 (active) APP_CPU: PC=0x00000000
esp32: target state: halted
Info : Use core0 of target 'esp32'
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 7416 bytes at address 0x40090000
Error: no working area available, can't alloc space for stub code!
Error: Failed to load stub (-308)!
Error: Algorithm run faied (-308)!
Info : Auto-detected flash size 0 KB
Error: Failed to probe flash, size 0 KB
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
esp32: target state: halted
Info : esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
esp32: target state: halted
Info : Target halted. PRO_CPU: PC=0x400D1713 (active) APP_CPU: PC=0x40084083
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAFD8C
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAF6C0
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFB4728
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAF0A4
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFB42C0
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAEAEC
Serial monitor (make app-flash monditor):
➜ blink git:(master) ✗ make app-flash monitor
Flashing app to serial port /dev/ttyUSB0, offset 0x10000...
esptool.py v2.1-beta1
Connecting........_
Chip is ESP32D0WDQ6 (revision 0)
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 120032 bytes to 57751...
Wrote 120032 bytes (57751 compressed) at 0x00010000 in 5.2 seconds (effective 184.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...
MONITOR
--- idf_monitor on /dev/ttyUSB0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0010,len:4
load:0x3fff0014,len:5076
load:0x40078000,len:0
load:0x40078000,len:12652
entry 0x40078f44
I (30) boot: ESP-IDF v3.0-dev-203-gdce7fcb 2nd stage bootloader
I (30) boot: compile time 21:40:43
I (57) boot: Enabling RNG early entropy source...
I (57) boot: SPI Speed : 40MHz
I (59) boot: SPI Mode : DIO
I (72) boot: SPI Flash Size : 4MB
I (84) boot: Partition Table:
I (95) boot: ## Label Usage Type ST Offset Length
I (117) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (141) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (164) boot: 2 factory factory app 00 00 00010000 00100000
I (187) boot: End of partition table
I (200) boot: Disabling RNG early entropy source...
I (217) boot: Loading app partition at offset 00010000
I (235) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0438c ( 17292) map
I (282) esp_image: segment 1: paddr=0x000143b4 vaddr=0x3ffb0000 size=0x01edc ( 7900) load
I (300) esp_image: segment 2: paddr=0x00016298 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _iram_start at ??:?

I (319) esp_image: segment 3: paddr=0x000166a0 vaddr=0x40080400 size=0x07280 ( 29312) load
I (382) esp_image: segment 4: paddr=0x0001d928 vaddr=0x400c0000 size=0x00000 ( 0) load
I (383) esp_image: segment 5: paddr=0x0001d930 vaddr=0x00000000 size=0x026e0 ( 9952)
I (417) esp_image: segment 6: paddr=0x00020018 vaddr=0x400d0018 size=0x0d4a0 ( 54432) map
0x400d0018: _flash_cache_start at ??:?

I (506) cpu_start: Pro cpu up.
I (506) cpu_start: Starting app cpu, entry point is 0x40080e64
0x40080e64: call_start_cpu1 at /home/permal/esp/esp-idf/components/esp32/./cpu_start.c:192

I (0) cpu_start: App cpu up.
I (515) heap_init: Initializing. RAM available for dynamic allocation:
I (536) heap_init: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (555) heap_init: At 3FFB2698 len 0002D968 (182 KiB): DRAM
I (574) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (593) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (613) heap_init: At 40087680 len 00018980 (98 KiB): IRAM
I (632) cpu_start: Pro cpu start user code
I (690) cpu_start: Starting scheduler on PRO CPU.
I (187) cpu_start: Starting scheduler on APP CPU.
ets Jun 8 2016 00:22:57

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0010,len:4
load:0x3fff0014,len:5076
load:0x40078000,len:0
load:0x40078000,len:12652
entry 0x40078f44
I (29) boot: ESP-IDF v3.0-dev-203-gdce7fcb 2nd stage bootloader
I (29) boot: compile time 21:40:43
I (56) boot: Enabling RNG early entropy source...
I (56) boot: SPI Speed : 40MHz
I (59) boot: SPI Mode : DIO
I (71) boot: SPI Flash Size : 4MB
I (83) boot: Partition Table:
I (94) boot: ## Label Usage Type ST Offset Length
I (117) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (140) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (163) boot: 2 factory factory app 00 00 00010000 00100000
I (187) boot: End of partition table
I (200) boot: Disabling RNG early entropy source...
I (217) boot: Loading app partition at offset 00010000
I (235) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0438c ( 17292) map
I (281) esp_image: segment 1: paddr=0x000143b4 vaddr=0x3ffb0000 size=0x01edc ( 7900) load
I (299) esp_image: segment 2: paddr=0x00016298 vaddr=0x40080000 size=0x00400 ( 1024) load
0x40080000: _iram_start at ??:?

I (318) esp_image: segment 3: paddr=0x000166a0 vaddr=0x40080400 size=0x07280 ( 29312) load
I (382) esp_image: segment 4: paddr=0x0001d928 vaddr=0x400c0000 size=0x00000 ( 0) load
I (383) esp_image: segment 5: paddr=0x0001d930 vaddr=0x00000000 size=0x026e0 ( 9952)
I (416) esp_image: segment 6: paddr=0x00020018 vaddr=0x400d0018 size=0x0d4a0 ( 54432) map
0x400d0018: _flash_cache_start at ??:?

I (505) cpu_start: Pro cpu up.
I (505) cpu_start: Starting app cpu, entry point is 0x40080e64
0x40080e64: call_start_cpu1 at /home/permal/esp/esp-idf/components/esp32/./cpu_start.c:192

I (500) cpu_start: App cpu up.
I (515) heap_init: Initializing. RAM available for dynamic allocation:
I (536) heap_init: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (555) heap_init: At 3FFB2698 len 0002D968 (182 KiB): DRAM
I (574) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (593) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (613) heap_init: At 40087680 len 00018980 (98 KiB): IRAM
I (632) cpu_start: Pro cpu start user code
I (690) cpu_start: Starting scheduler on PRO CPU.
I (688) cpu_start: Starting scheduler on APP CPU.
Debugger:
➜ blink git:(master) ✗ xtensa-esp32-elf-gdb -x gdbinit build/blink.elf
GNU gdb (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 7.10
Copyright (C) 2015 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_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from build/blink.elf...done.
warning: while parsing target memory map (at line 2): Required element <memory> is missing
0x00000000 in ?? ()
JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
esp32: target state: halted
esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
esp32: target state: halted
Hardware assisted breakpoint 1 at 0x400d1713: file /home/permal/esp/esp-idf/examples/get-started/blink/main/./blink.c, line 43.
0x0: 0x00000000
Target halted. PRO_CPU: PC=0x400D1713 (active) APP_CPU: PC=0x40084083
[New Thread 1073413516]
[New Thread 1073413160]
[New Thread 1073432360]
[New Thread 1073410212]
[New Thread 1073431232]
[New Thread 1073408748]
[New Thread 1073411340]
[Switching to Thread 1073411776]

Temporary breakpoint 1, app_main ()
at /home/permal/esp/esp-idf/examples/get-started/blink/main/./blink.c:43
---Type <return> to continue, or q <return> to quit---
This is what I got when I followed the tutorial using "blink", at the point where you continue after setting breakpoints. No output in the UART console.
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAEAEC
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
esp32: target state: halted
Info : esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
esp32: target state: halted
Info : Target halted. PRO_CPU: PC=0x400D1713 (active) APP_CPU: PC=0x40084083
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAFD8C
lInfo : Target halted. PRO_CPU: PC=0x400D16F2 (active) APP_CPU: PC=0x40084083
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAF6C0
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFB42C0
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAEAEC
Info : Target halted. PRO_CPU: PC=0x400D16F4 (active) APP_CPU: PC=0x40084083
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAF6C0
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAF0A4
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFB42C0
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAEAEC
Info : Target halted. PRO_CPU: PC=0x400D1700 (active) APP_CPU: PC=0x400D0D84
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAFD8C
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFB42C0
Error: cpu0: xtensa_read_memory (line 588): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 1024 bytes at address 0x3FFAF0A4
gdb output:
Program received signal SIGTRAP, Trace/breakpoint trap.
0x400803c0 in _DoubleExceptionVector ()
(gdb) c
Continuing.
cpu1: esp32_fetch_all_regs (line 163): DSR (80008413) indicates DIR instruction generated an exception!
cpu0: esp32_fetch_all_regs (line 234): DSR (8000CC13) indicates DIR instruction generated an exception!
cpu0: esp32_fetch_all_regs (line 190): DSR (8000CC13) indicates DIR instruction generated an exception!
Exception reading ccompare1!

esp32: xtensa_step: Stepping doesn't seem to change PC!
Target halted. PRO_CPU: PC=0x400803C0 (active) APP_CPU: PC=0x40084083

Program received signal SIGTRAP, Trace/breakpoint trap.
0x400803c0 in _DoubleExceptionVector ()
(gdb) c
Continuing.
cpu0: esp32_fetch_all_regs (line 190): DSR (8000CC13) indicates DIR instruction generated an exception!
Exception reading ccompare1!

cpu0: esp32_fetch_all_regs (line 190): DSR (8000CC13) indicates DIR instruction generated an exception!
Exception reading epc2!

cpu0: esp32_fetch_all_regs (line 190): DSR (8000CC13) indicates DIR instruction generated an exception!
Exception reading epc2!

cpu1: esp32_fetch_all_regs (line 163): DSR (80008413) indicates DIR instruction generated an exception!
cpu0: esp32_fetch_all_regs (line 190): DSR (8000CC13) indicates DIR instruction generated an exception!
Exception reading epc2!

esp32: xtensa_step: Stepping doesn't seem to change PC!
cpu0: esp32_fetch_all_regs (line 190): DSR (8011CC13) indicates DIR instruction generated an exception!
Exception reading epc2!

Target halted. PRO_CPU: PC=0x400803C0 (active) APP_CPU: PC=0x40084083

Program received signal SIGTRAP, Trace/breakpoint trap.

Dig Kleppe
Posts: 24
Joined: Wed Jun 28, 2017 5:03 pm

Re: JTAG debuggers

Postby Dig Kleppe » Fri Aug 25, 2017 6:30 pm

Hi
Maybe my story will help you:
I spend a lot of time getting my JTAG working on a Geekworm Easykit ESP32-B1.
Short history: connected FTDI C233HM, followed instructions from ESP API guide (very clear instruction).
Terrible. A lot of DTR and FreeRTOS maximum used priority is unreasonably big, not proceeding: 1061177276 errors. Even at low speed. And target does not halt stuff.

Tried Segger Jlink Edu. Seemed to work a little better. Must set JTAG clk to 1Mhz, then sometimes still DTR and FreeRTOS errors.
But very slow.
Connected scope: with x1 probe connected to JTAG clk more errors. x10 probe OK. Nothing much to see.
I was not very happy.

Because the ESP guide mentioned working at 20MHz with FTDI I decided to go back to FTDI. It must work.

There must have happened a miracle: It works! set CLK to 5Mhz : Ok 10Mhz : OK 20Mhz: Ok, very fast!
It turned out that connecting a scope to the TCK made this miracle happen. So buy a scope.
Also the Jlink does work better, but is a lot slower than the FTDI.

Or place a small capacitor from JTAG TCK (IO13) to ground. I used a 68pF one. ( just picked one ).
The connections between the board and JTAG connector are very short.

I still have one problem: programming fails:

Code: Select all

Open On-Chip Debugger 0.10.0-dev-g4106faa (2017-08-06-11:27)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
adapter speed: 5000 kHz
none separate
ftdi samples TDO on falling edge of TCK
force hard breakpoints
Info : clock speed 5000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : Target halted. PRO_CPU: PC=0x40081378 (active)    APP_CPU: PC=0x00000000 
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active)    APP_CPU: PC=0x00000000 
esp32: target state: halted
Info : esp32: Core was reset (pwrstat=0x1F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active)    APP_CPU: PC=0x40000400 
esp32: target state: halted
** Programming Started **
auto erase enabled
Info : Use core0 of target 'esp32'
Info : Target halted. PRO_CPU: PC=0x40091D07 (active)    APP_CPU: PC=0x400076E2 
Info : Auto-detected flash size 4096 KB
Info : Using flash size 4096 KB
Info : Use core0 of target 'esp32'
Info : esp32: Debug controller was reset (pwrstat=0x4F, after clear 0x4F).
Info : esp32: Debug controller was reset (pwrstat=0x40, after clear 0x0F).
Info : esp32: Debug controller was reset (pwrstat=0x4F, after clear 0x4F).
Info : Target halted. PRO_CPU: PC=0x40091138 (active)    APP_CPU: PC=0x400076DD 
Error: Failed to erase flash (1073481616)!
Error: failed erasing sectors 16 to 102
embedded:startup.tcl:454: Error: ** Programming Failed **
in procedure 'script' 
at file "embedded:startup.tcl", line 60
Lowering TCK does not help.
I am sure that i have seen this working, it went faster than serial.



Dig

js1234
Posts: 18
Joined: Thu Jan 26, 2017 1:16 pm

Re: JTAG debuggers

Postby js1234 » Mon Aug 28, 2017 7:25 am

ESP_igrr wrote:There was an issue with default LWS config that one of JTAG pins was used as a GPIO. Have you changed that GPIO setting?
Yes I changed the pin to pin 16:

In the file components/bootloader/Kconfig.projbuild
I set the default to pin 16.

config BOOTLOADER_FACTORY_BUTTON_GPIO
int "GPIO for Force Factory Boot"
default 16

Before that the openocd could not connect at all (all zeroes/ all ones...)

js1234
Posts: 18
Joined: Thu Jan 26, 2017 1:16 pm

Re: JTAG debuggers

Postby js1234 » Mon Aug 28, 2017 12:06 pm

The interesting thing is that it still is working to step through with the gdb console.

I could read out a variable, but I am not sure if it has the correct value. The gdb crashed then...

meowsqueak
Posts: 151
Joined: Thu Jun 15, 2017 4:54 am
Location: New Zealand

Re: JTAG debuggers

Postby meowsqueak » Mon Sep 04, 2017 4:14 am

In general, how reliable should debugging via JTAG be on this platform? I'm not sure whether I've got it working as well as to be expected.

I've managed to get my JTAG debugger (BusPirate v2go, v7.0 firmware) talking to the special ESP32 version of OpenOCD, and I've even been able to run GDB remotely and set a hardware breakpoint to stop at the line I asked it to, but it really felt like the wind had to be blowing in the right direction, and the moon's phase "just so"... most of the time it simply doesn't work, but I can't really explain clearly how because each and every time it's different, even with the basic hello world example:
  • Sometimes the ESP32 doesn't actually halt
  • Sometimes it does, but then GDB says "Bogus trace status reply from target: timeout"
  • Or "Reply contains invalid hex digit 116"
  • Or it breaks in weird places like xt_ints_off()
  • Or "invalid selected thread"
  • Or while watching "make monitor" I see it randomly rebooting - or continuing to run even when GDB thinks it's stopped
I've had some experience with GDB on other platforms and I know it's too much to expect everything to work perfectly, but this feels to me like I've got a serious problem somewhere in my set-up, and I'm really not sure where to start looking.

MindReader32
Posts: 25
Joined: Mon May 14, 2018 8:33 am

Re: JTAG debuggers

Postby MindReader32 » Sat Sep 28, 2019 6:52 pm

I was also seeing the Core/Debug reset messages after switching from one type of dev board to another.

I had to alter: MenuConfig -> Components -> ESP-32 Specific -> Main XTAL frequency.

I changed from from "Autodetect" to a specific frequency (in my case is was 40 Mhz)

sdkconfig snippet:

Code: Select all

CONFIG_ESP32_XTAL_FREQ_40=y
CONFIG_ESP32_XTAL_FREQ_26=
CONFIG_ESP32_XTAL_FREQ_AUTO=
CONFIG_ESP32_XTAL_FREQ=40
HTH

Dig Kleppe
Posts: 24
Joined: Wed Jun 28, 2017 5:03 pm

Re: JTAG debuggers

Postby Dig Kleppe » Sat Oct 05, 2019 1:35 pm

HI
I have good results on my Linux PC using Wroom32, a FTDI C232HM JTAG cable and the latest IDF. I had to add "ftdi_tdo_sample_edge falling" in the esp-wroom-32.cfg.
But I still need the capacitor at the IO13 pin, see my previous post.
And 10k resistors to GND at IO13 and 14.
I use Eclipse and a GDB ESP OpenOCD debug configuration.
I can also flash the device with openOCD: ocd configline: "-s ${openocd_path}/share/openocd/scripts -f interface/ftdi/c232hm.cfg -f board/esp-wroom-32.cfg -c "program_esp32 /home/dig/projecten/esp32/lora/build/lora.bin 0x10000 verify"
In the StartupTab Load Executable must be off, this does not work.

JTAG speed is 20Mhz.

OpenOCD tells me this story:

Open On-Chip Debugger v0.10.0-esp32-20190708 (2019-07-08-11:03)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
ftdi samples TDO on falling edge of TCK
Info : Configured 2 cores
esp32 interrupt mask on
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : Target halted. PRO_CPU: PC=0x400E89C2 APP_CPU: PC=0x400D3FC6 (active)
Info : Detected debug stubs @ 3ffb2a58 on core1 of target 'esp32'
Info : Listening on port 3333 for gdb connections
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
Info : esp32: Core 0 was reset (pwrstat=0x1F, after clear 0x0F).
Info : esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
** Programming Started **
auto erase enabled
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x40000400
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 31 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 98 KB
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x40000400
Info : Auto-detected flash size 4096 KB
Info : Using flash size 4096 KB
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x40000400
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x40000400
wrote 188416 bytes from file /home/dig/projecten/esp32/lora/build/lora.bin in 3.216563s (57.204 KiB/s)
** Programming Finished **
** Verify Started **
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x40000400
read 185392 bytes from file /home/dig/projecten/esp32/lora/build/lora.bin and flash bank 0 at offset 0x00010000 in 0.950299s (190.516 KiB/s)
contents match
** Verified OK **
Started by ESP32 Eclipse
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
Error: No symbols for FreeRTOS
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x40000400
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 31 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 98 KB
Info : Using flash size 100 KB
Info : Target halted. PRO_CPU: PC=0x400916EE (active) APP_CPU: PC=0x40000400
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 31 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 98 KB
Info : Using flash size 32 KB
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
Info : esp32: Core 0 was reset (pwrstat=0x1F, after clear 0x0F).
Info : esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
invalid command name "arm"
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
Info : esp32: Core 0 was reset (pwrstat=0x1F, after clear 0x0F).
Info : esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
===== Xtensa registers CPU0
(0) pc (/32): 0x40000400
(1) ar0 (/32): 0x00000000
(2) ar1 (/32): 0x00000000
(3) ar2 (/32): 0x00000000
(4) ar3 (/32): 0x00000000
(5) ar4 (/32): 0x00000000
(6) ar5 (/32): 0x00000000

Who is online

Users browsing this forum: No registered users and 103 guests