SWO JLink VScode ESP32

Dear friends,
I have been able to use Jlink as a debugger either in PlatformIO IDE in vscode and also in the Espressif extension for the ESP32 Wroom module. Now it is two days I’m searching to configure And use jlink so that I can use SWO viewer. So I have 3 questions.

  1. Is it possible to use SWO or TDO as in Jtag to view serial wire output messages?
  2. If the question 1 answer is yes, How should I configure my project?
    I have tested the example project app_trace_to_host_example but no success.
  3. How Can I view the SWO messages? Jlink SWO viewer doesn’t support ESP32 at all.
    Your answers are appreciated, preferably soon, and the working one if any exists.

I don’t think ESP32 uses an SWO pin, they do use JTAG, but differently.

If https://github.com/espressif/esp-idf/tree/v5.1.1/examples/system/app_trace_basic is not working for you in Espressif’s native enviornment, please file an issue at that repository.

So how can one fast trace a program other than serial port?

Exactly via this. JTAG should be significantly faster.

First and foremost, App trace to host is now working for me but esp_apptrace_flush. But this is based on ESPidf. is there any equivalent in Platformio?
Second, esp_apptrace_flush is not working, that is I need to make trace stop to view the file. The instruction I use in the series is as follows.

Starting Openocd

telnet localhost 4444

(Telnet host is started)

esp apptrace start file://apptrace.log 0 300 3 0 0

From here I should wait so that all of the 300 bytes are captured, and then I can see the file although I use the following instructions

esp_apptrace_write(ESP_APPTRACE_DEST_JTAG, someBuff, strlen(buf), 1000);
esp_apptrace_flush(ESP_APPTRACE_DEST_JTAG,strlen(buf));

Update those who have same problem, use this one
esp apptrace start file://trace.log 1 -1 -1 0 0

PlatformIO disables by default the Telnet server of the OpenOCD instance, unless you set e.g. debug_port = 127.0.0.1:3333 in the platformio.ini and start OpenOCD on the commandline manually.

However, you should be able to equivalentely trigger the command by just using “monitor <original openocd command>” as an extra GDB command (which GDB will forward to OpenOCD).

https://docs.platformio.org/en/stable/projectconf/sections/env/options/debug/debug_extra_cmds.html

The problem is I had used the Arduino framework in Platformio rather than ESPidf.
Is it possible to include

#include “esp_app_trace.h”
#include “esp_log.h”

in Arduino style programs? And to complete this topic, would you please visit this thread?