Page 1 of 1

Log output over JTAG, esp_apptrace_vprintf kills JTAG

Posted: Mon Apr 17, 2023 4:37 pm
by skanky
I need to use both UARTs for my application on a ESP32S2 so can't use UART0 for the log output.
Working through this page: https://docs.espressif.com/projects/esp ... ic-tracing
I immediately hit a problem. If I include this line in my code:
esp_log_set_vprintf(esp_apptrace_vprintf);
I can no longer debug with JTAG. Instead of F5 starting a new debug session with it breakpointin at the start of main(), instead it doesn't get that far and I get this in the OUTPUT:

Code: Select all

- (Software core reset)
[OpenOCD]
Info : [esp32s2] Target halted, PC=0x40031E92, debug_reason=00000001
[OpenOCD]
Info : Flash mapping 0: 0x10020 -> 0x3f000020, 29 KB
[OpenOCD]
Info : Flash mapping 1: 0x20020 -> 0x40080020, 98 KB
Info : Using flash bank 'esp32s2.irom' size 100 KB
[OpenOCD]
Info : [esp32s2] Target halted, PC=0x40031E92, debug_reason=00000001
[OpenOCD]
Info : Flash mapping 0: 0x10020 -> 0x3f000020, 29 KB
Info : Flash mapping 1: 0x20020 -> 0x4008[OpenOCD]
0020, 98 KB
Info : Using flash bank 'esp32s2.drom' size 32 KB
[OpenOCD]
Info : dropped 'gdb' connection
[OpenOCD]
Info : accepting 'gdb' connection on tcp[OpenOCD]
/3333
[OpenOCD]
❌ Error: FreeRTOS: uxTopUsedPriority is not defined, consult the OpenOCD manual for a wo[OpenOCD]
rk-around!
[OpenOCD]
❌ Error: FreeRTOS: uxTopUsedPriority is not de[OpenOCD]
fined, consult the OpenOCD manual for a work-around!
[Debug Adapter]
2023-04-17 17:33:06,005 - Debug Adapter (main) - ERROR - Failed to wait for target state 1! Current state 2
Traceback (most recent call last):
  File "c:\Users\adam\.vscode\extensions\espressif.esp-idf-extension-1.6.1\esp_debug_adapter\debug_adapter\command_processor.py", line 144, in on_launch_request
    self.da.run(start=(not self.da.state.no_debug))
  File "c:\Users\adam\.vscode\extensions\espressif.esp-idf-extension-1.6.1\esp_debug_adapter\debug_adapter\debug_adapter.py", line 931, in run
    rsn = self._gdb.wait_target_state(dbg.TARGET_STATE_STOPPED, 10)
  File "c:\Users\adam\.vscode\extensions\espressif.esp-idf-extension-1.6.1\esp_debug_adapter\debug_adapter\debug_backend\debug_backend\gdb.py", line 560, in wait_target_state
    raise DebuggerTargetStateTimeoutError("Failed to wait for target state %d! Current state %d" % (state, self._target_state))
debug_adapter.debug_backend.debug_backend.defs.DebuggerTargetStateTimeoutError: Failed to wait for target state 1! Current state 2
[OpenOCD]
Info : dropped 'gdb' connection
[Debug Adapter]
Exception in thread Thread-1:
Traceback (most recent call last):
  File "threading.py", line 932, in _bootstrap_inner
Exception in thread Thread-2:
Traceback (most recent call last):
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "threading.py", line 870, in run
  File "subprocess.py", line 1366, in _readerthread
  File "subprocess.py", line 1366, in _readerthread
OSError: [Errno 22] Invalid argument
[Debug Adapter]
DEBUG_ADAPTER_STOPPED
2023-04-17 17:33:06,041 - Debug Adapter (main) - CRITICAL - Debug adapter -> Extension: DEBUG_ADAPTER_STOPPED
[Debug Adapter]
OSError: [Errno 22] Invalid argument
[Stopped] : ESP-IDF Debug Adapter
I also get a blank VS Code error message inviting me to open launch.json
Can anyone advise what might be going on?

Re: Log output over JTAG, esp_apptrace_vprintf kills JTAG

Posted: Wed Apr 19, 2023 9:19 am
by skanky
Can anyone from Espressif support answer this please???