Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) ESP32 Debugging with JLink (Read 7197 times)
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
ESP32 Debugging with JLink
Jan 21st, 2022 at 6:48pm
Print Post  
Trying to get hardware debugging working with a JLink-Ultra.

The first question has to do with the connection of the 3V3 to the JLink. The wiring notes for the JLink hookup and the ESP32-DevKitC say not to connect the 3V3 to the JLink if the board is plugged into USB. This seems odd since, first, if the board is not connected to USB the sketch cannot be loaded. Second, in my experience with JLink it needs to detect the target power before it will connect. In fact, when using the Segger JLink GDB server if power is not connected the server will not startup. At least this is true of STM32 MCUs and others.

So, the question is, should the 3V3 be connected to the JLink, or is OpenOCD supposed to take care of that.

I have tried to run the debugger without connecting the 3V3 and OpenOCD exits with code "1".

Sid
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #1 - Jan 21st, 2022 at 9:50pm
Print Post  
A little more information:

1. The JLink probe needs to be able to monitor the target voltage. It does this on the VTRef pin (pin1) and it must be connected to 3V3 on the ESP32.
2. My ESP32 board is ESP32 DevKitC-VE. No problems using Arduino IDE or Serial debug with VM.
3. From the Debug window in VS I see one of the parameters for OpenOCD is the config file "esp-wroom-32.cfg." The DevKitC-VE board has an ESP32 WROVER-E fitted. Is this significant? How should it be fixed if required?

Sid
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 Debugging with JLink
Reply #2 - Jan 24th, 2022 at 9:39am
Print Post  
Thanks for the report.

1) That is correct, and we will update the JLink wiring diagram below to show the solid line (currently dashed) for the VREF pin.  The Jlink can also supply power depending on the model, and this is what the note on the generic wiring diagram on the page was referring to, we will try and clarify that further as well.
https://www.visualmicro.com/pics/Debug-Help-ESP32-Jlink-Connections.png

3) Which board are you selecting in vMicro? There is a seperate OpenOCD Config for the Wrover modules, which is automatically selected when using the "ESP32 Wrover Module" from the board list (not the "ESP32 Wrover Kit (all versions)").  This can also be overridden when using a different board by adding the below config to a local board.txt in the project:
Code
Select All
tools.openocd.debug.openocdscript=esp32-wrover.cfg 




On a side note we have been working on an updated OpenOCD integration for the newer C and S modules, however this is not available at present due to issues in integration.
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #3 - Jan 24th, 2022 at 1:53pm
Print Post  
Thank you.

I have now selected the "ESP32 Wrover Kit (all versions)" as my board.

It seems that stepping is either not implemented for this set up or I still have a problem. The debugger stops on a breakpoint in "Setup", however, when I select either "Step In" or "Step Over" the target simply continues.
« Last Edit: Jan 24th, 2022 at 1:53pm by Sid Price »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 Debugging with JLink
Reply #4 - Jan 24th, 2022 at 1:57pm
Print Post  
If you try selecting the other ESP32 Wrover (Not the all versions one), or add the local board.txt entry, does this improve?

(The all versions board currently just uses the esp32-wroom config for OpenOCD, which may make a difference)
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #5 - Jan 24th, 2022 at 2:08pm
Print Post  
Selecting the "ESP32 Wrover" board ... the debugger does not appear to start at all. The breakpoint is not hit, the serial monitor does not appear.
« Last Edit: Jan 24th, 2022 at 2:08pm by Sid Price »  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #6 - Jan 24th, 2022 at 2:13pm
Print Post  
In fact, when I switch back to the previous board, that doesn't work either now Sad
« Last Edit: Jan 24th, 2022 at 2:13pm by Sid Price »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 Debugging with JLink
Reply #7 - Jan 24th, 2022 at 2:15pm
Print Post  
Thanks for the detail, and it may be that the board and probe need resetting, or there could be an orphaned process of "Openocd.exe" or "xtensa-esp32-elf-gdb.exe" which needs terminating.

Can you switch back to the all-versions board, and attach the full build log with verbose and show build properties enabled, along with any output from the Output > Debug window.

Also please attach the OpenOCD log from the build folder:
https://www.visualmicro.com/page/Troubleshooter-for-Debugging-an-Arduino-Sketch-...

« Last Edit: Jan 24th, 2022 at 2:17pm by Simon@Visual Micro »  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #8 - Jan 24th, 2022 at 2:40pm
Print Post  
Attached is build output, there is no "output debug" to be found.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 Debugging with JLink
Reply #9 - Jan 24th, 2022 at 3:14pm
Print Post  
Thanks, have you managed to start the debugging session again after changing the board back and repowering the probe + board?
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #10 - Jan 24th, 2022 at 3:36pm
Print Post  
No, the debugger does not start as far as I can tell with either board selected.
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #11 - Jan 24th, 2022 at 3:37pm
Print Post  
I have power-cycled the board and the JLink and restarted the PC. No change.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 Debugging with JLink
Reply #12 - Jan 24th, 2022 at 3:41pm
Print Post  
Thanks for confirming.

Can you attach the OpenOCD log from the build folder so we can see more detail of what is happening?
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #13 - Jan 24th, 2022 at 3:52pm
Print Post  
That file does not exist.

Folder image attached.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 Debugging with JLink
Reply #14 - Jan 24th, 2022 at 4:04pm
Print Post  
Thanks for the detail, it means OpenOCD isn't fully starting up in this scenario.

If you run the below in the command line, could you attach the output:
Code
Select All
"C:\ProgramData\vmicro\tools\openocd-espressif-esp32-10.0.1\bin/openocd.exe" -d2 -s s/" -f s/interface/jlink.cfg" -c "set ESP32_RTOS none" -f s/board/esp-wroom-32.cfg" -c "init" 

  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #15 - Jan 24th, 2022 at 4:08pm
Print Post  
Errors:

Code
Select All
PS C:\Users\sidpr> "C:\ProgramData\vmicro\tools\openocd-espressif-esp32-10.0.1\bin/openocd.exe" -d2 -s s/" -f s/interface/jlink.cfg" -c "set ESP32_RTOS none" -f s/board/esp-wroom-32.cfg" -c "init"
At line:1 char:78
+ ... icro\tools\openocd-espressif-esp32-10.0.1\bin/openocd.exe" -d2 -s "C: ...
+                                                                ~~
Unexpected token '-d' in expression or statement.
At line:1 char:80
+ ... cro\tools\openocd-espressif-esp32-10.0.1\bin/openocd.exe" -d2 -s "C:\ ...
+                                                                 ~
Unexpected token '2' in expression or statement.
At line:1 char:82
+ ... \tools\openocd-espressif-esp32-10.0.1\bin/openocd.exe" -d2 -s "C:\Pro ...
+                                                                ~~
Unexpected token '-s' in expression or statement.
At line:1 char:85
+ ... exe" -d2 -s "C:\ProgramData\vmicro\tools\openocd-espressif-esp32-10.0 ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token ts/"' in expression
or statement.
At line:1 char:275
+ ... if-esp32-10.0.1/share/openocd/scripts/interface/jlink.cfg" -c "set ES ...
+                                                                ~~
Unexpected token '-c' in expression or statement.
At line:1 char:278
+ ... openocd/scripts/interface/jlink.cfg" -c "set ESP32_RTOS none" -f "C:\ ...
+                                             ~~~~~~~~~~~~~~~~~~~~~
Unexpected token '"set ESP32_RTOS none"' in expression or statement.
At line:1 char:409
+ ... -esp32-10.0.1/share/openocd/scripts/board/esp-wroom-32.cfg" -c "init"
+                                                                 ~~
Unexpected token '-c' in expression or statement.
At line:1 char:412
+ ... -esp32-10.0.1/share/openocd/scripts/board/esp-wroom-32.cfg" -c "init"
+                                                                    ~~~~~~
Unexpected token '"init"' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
 

  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 Debugging with JLink
Reply #16 - Jan 24th, 2022 at 4:10pm
Print Post  
Sorry, can you run it in the normal CMD.exe shell, that looks to be from a Powershell Prompt with the PS at the start.
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #17 - Jan 24th, 2022 at 4:15pm
Print Post  
Access denied.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 Debugging with JLink
Reply #18 - Jan 24th, 2022 at 4:23pm
Print Post  
This seems odd as the debugging started earlier for you in VS.

Is this the same if you run cmd.exe as an Administrator?
  
Back to top
 
IP Logged
 
Sid Price
Junior Member
**
Offline


Posts: 54
Location: Tijeras
Joined: Jun 28th, 2021
Re: ESP32 Debugging with JLink
Reply #19 - Jan 24th, 2022 at 4:24pm
Print Post  
Yes, I just tried that.

And yes, it obviously ran earlier.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint