These are our OSX Setup instructions. We use an FTDI Debugger, but they should work with others. Note the need to manually flash the device before debug.
Debugger Setup
==============
For debug we use the JTAG, OpenOCD and GDB.
The JTAG Hardware is a C232HM-DDHSL-0 although any FTDI compatible 3.3V USB->Serial converter should work.
I explored the use of the standard OpenOCD/GDB pipe technique, but couldn't get it to work.
There is an Eclipse plugin for ARM which works with the ESP32. So that's what I used.
Note that we run from Flash as this version of doesn't not have the ability to run from RAM. So you'll need to "make flash" before doing a debug run. To do this you'll need to disconnect the debugger from its USB port. Don't ask me why. You just do. The other implication of this is that you can only use Hardware Breakpoints of which the ESP32 has two. SIngle stepping uses these BPs and seems to work fine (if slowly)
Note that application code runs on CPU0. You cannot "see" threads on CPU1 via this setup (They appear on different GDB Ports)
OpenOCD
=======
You will need to build openocd-esp32 from this github repository:
https://github.com/espressif/openocd-esp32
Clone it to your home directory.
I used the readme.OSX instructions and built and installed it using Brew.
You will need two ESP32 config files to make openocd work.
Confusingly, they are both called ESP32.cfg
You will find one of them in the "Docs" directory of ESP-IDF. This is the one that openocd uses as a command-line script. It should be copied to the top level of openocd-esp32.
Check that openocd works by doing this:
($YOUR_HOME)/openocd-esp32/src/openocd -s ($YOUR_HOME)/openocd-esp32/tcl -f ($YOURHOME)/openocd-esp32/esp32.cfg
You should see something like:
Open On-Chip Debugger 0.10.0-dev-g90071eb8 (2017-04-18-10:23)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 200 kHz
force hard breakpoints
Info : clock speed 200 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.cpu0: Target halted, pc=0x400DBFE8
Eclipse
=======
You will want the CDT Build of Eclipse NEON
https://eclipse.org/cdt/
Once you have installed it, you need the GNU ARM toolkit.
However, before you can install it you will need to modify the security settings of your JVM. You will get this error:
http://gnuarmeclipse.github.io/blog/201 ... all-issue/
Download these 3 files:
http://www.oracle.com/technetwork/java/ ... 33166.html
(2 .jars and a readme)
Look for a directory lib/security under your Java Home directory. Depending oin where and how your JVM executes it may appear in a number of different places.
I did this:
find / -name security
Which identified a couple of likely candidates, and I copied the files into each of them in turn until it worked. There is probably a more scientific approach than this.
Update: Try this directory first: /Library/Java/JavaVirtualMachines/**< jdk_version_of_your_pc >**/Contents/Home/jre/lib/security
You can now go to Eclipse Marketplace and download GNU ARM Eclipse toolkit. Strangely, it seems to need reinstalling every now and again. It tells you when.
Eclipse Debugger Setup
======================
Go to the Debug Configuration Tab (Under "Run")
Create a new GDB OpenOCD Debugging Instance.
Main Tab
Application
($YOUR_HOME)/RPK/build/RPK.elf
Debugger Tab
Tick "Start OpenOCD Locally"
OpenOCD Executable is ($YOUR_HOME)/openocd-esp32/src/openocd
GDB Port is 3333 (This is for CPU0/PRO_CPU for CPU1/APP_CPU use 3334)
Config Options "-s ($YOUR_HOME)/openocd-esp32/tcl -f $(YOUR_HOME)/openocd-esp32/esp32.cfg"
Tick "Allocate Console for OpenOCD"
GDB Client:
Executable is "($YOUR_HOME)/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gdb"
Startup Tab
Tick "Initial Reset"
Type: init
Tick "Load Symbols"
Use Project Binary "($YOUR_HOME/RPK/build/rpk.elf"
Tick "Pre Run/Restart reset" (Type = halt)
Tick "Set Breakpoint" (breakpoint = app_main)
MenuConfig
==========
Under Components/ESP32-Specific
Make sure Exception/Panic Handlers are JTAG/OCD Aware
(You don't need to disable watchdogs. GDB handles this)
Under Components/FreeRTOS
Make sure "Stop Program on Scheduler start when JTAG/OCD is detected" is enabled.
It gives you an extra break point to step through but it seems to crash without it
And thats it. Simple eh?
Using Eclipse with OpenOCD to build and debug ESP32
-
- Posts: 131
- Joined: Tue May 17, 2016 8:12 pm
Re: Using Eclipse with OpenOCD to build and debug ESP32
Hi tedwood.
Same environment, OSX 10.11.6, etc.
I did the same with the exception of the java security feature so I just downloaded the plugin and installed it manually. (Thanks for the java tip, it works)
I have a flyswatter2 JTAG debugger.
I can debug manually, i.e.,flash (via Eclipse), start openocd and then gdb. It blinks (I'm using the blink example), it can break (stops blinking), step, examine vars, continue etc.
You are right about disconnecting the JTAG it wont flash if not. Actually you only need to disconnect EN pin, but the same thing.
I did the Eclipse Neon setup the same way but when it starts the debugging I see the openocd loading (or starting if i preload it), a lot of xtensa registers and the program is Halted but not in app_main but elsewhere. Can not get it to continue etc. I can see the threads, i threads, usually thread 3 is where the app_main is, but it wont blink, its in an infinite loop of jump to 0x40000xxxx if one examines the asm code.
Where you able to Continue, Break, see it blinking,etc?
Thanks.
Same environment, OSX 10.11.6, etc.
I did the same with the exception of the java security feature so I just downloaded the plugin and installed it manually. (Thanks for the java tip, it works)
I have a flyswatter2 JTAG debugger.
I can debug manually, i.e.,flash (via Eclipse), start openocd and then gdb. It blinks (I'm using the blink example), it can break (stops blinking), step, examine vars, continue etc.
You are right about disconnecting the JTAG it wont flash if not. Actually you only need to disconnect EN pin, but the same thing.
I did the Eclipse Neon setup the same way but when it starts the debugging I see the openocd loading (or starting if i preload it), a lot of xtensa registers and the program is Halted but not in app_main but elsewhere. Can not get it to continue etc. I can see the threads, i threads, usually thread 3 is where the app_main is, but it wont blink, its in an infinite loop of jump to 0x40000xxxx if one examines the asm code.
Where you able to Continue, Break, see it blinking,etc?
Thanks.
Re: Using Eclipse with OpenOCD to build and debug ESP32
Did you ever find out about boundary scan support? Internal signals could be useful for functional testing, if such a mode is supported (and I am also curious about more typical interconnect testing)ESP_Sprite wrote: ↑Mon Nov 14, 2016 3:06 amI don't think so, from what I remember the JTAG connects directly to the CPU core, not to the GPIO logic. If it does boundary scan, it likely maps to internal signals, not to the GPIOs. I'll ask the hardware engineers, just to be sure.
-
- Posts: 1
- Joined: Thu Jan 21, 2021 3:45 am
Re: Using Eclipse with OpenOCD to build and debug ESP32
Hi,
I am trying to debug using Eclipse. I have done all the debug setup but getting the following error when I try to launch debug.
But I am to flash from Eclipse. I am using WROVER-IE dev kit.
"No ESP launch Target found.
Open On-Chip Debugger v0.10.0-esp32-20200709 (2020-07-09-08:54)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
Warn : Interface already configured, ignoring
Info : Configured 2 cores
Started by GNU MCU Eclipse
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'
Assertion failed!
Program: C:\Users\jshekah\.espressif\tools\openocd-esp32\v0.10.0-esp32-20200709\openocd-esp32\bin\openocd.exe
File: src/jtag/core.c, Line 343
Expression: jtag_trst == 0"
I am trying to debug using Eclipse. I have done all the debug setup but getting the following error when I try to launch debug.
But I am to flash from Eclipse. I am using WROVER-IE dev kit.
"No ESP launch Target found.
Open On-Chip Debugger v0.10.0-esp32-20200709 (2020-07-09-08:54)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
Warn : Interface already configured, ignoring
Info : Configured 2 cores
Started by GNU MCU Eclipse
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'
Assertion failed!
Program: C:\Users\jshekah\.espressif\tools\openocd-esp32\v0.10.0-esp32-20200709\openocd-esp32\bin\openocd.exe
File: src/jtag/core.c, Line 343
Expression: jtag_trst == 0"
Who is online
Users browsing this forum: No registered users and 81 guests