I am currently developing a resource-intensive Proof of Concept on the ESP32-P4X-EYE development board using ESP-IDF v5.5.4. The application concurrently handles a MIPI camera, I2S audio, bidirectional WebRTC (video and audio streaming), and an MQTT client.
To profile our heavily loaded FreeRTOS environment, I enabled the Application Level Tracing component in menuconfig, configuring it to output FreeRTOS SystemView Tracing data via the built-in USB-Serial/JTAG controller.
However, shortly after the application starts and begins to generate trace data, the entire system silently freezes. There is no panic log and the task watchdog doesn't seem to trigger.
When I halt the system using GDB via OpenOCD to investigate, I notice that the system seems to be experiencing a severe deadlock or starvation. Most of my active tasks are blocked, and Core 0 is stuck executing the IDLE0 task.
Given our strict timing requirements (WebRTC / I2S audio), I have a few specific questions about how the ESP32-P4 handles AppTrace internally:
1. Host-Side Bottlenecks: If the host PC (OpenOCD) is slow to read the JTAG pipeline and the internal AppTrace buffer fills up, does the underlying esp_app_trace logic introduce hidden spinlocks or infinite timeouts that could block the FreeRTOS scheduler or interrupt handlers?
2. Configuration Tweaks: Are there any recommended menuconfig settings (like specific AppTrace RAM buffer sizes, chunk sizes, or timeout limits) to prevent the USB-JTAG peripheral from starving the RTOS scheduler under heavy concurrent load?
3. Hardware Impact: Does the internal USB-JTAG controller steal significant CPU cycles or stall the memory bus when flushing large SystemView data buffers to the host, or is it handled entirely by dedicated DMA?
Below is the GDB output showing the state of the threads when the freeze happens. Any insights into the low-level behavior of the USB-JTAG peripheral under heavy RTOS loads would be greatly appreciated!
Code: Select all
(gdb) info threads
Id Target Id Frame
2 Thread 1341566828 "main" (Name: main) 0x4ff20000 in _vector_table ()
3 Thread 1341573180 "IDLE1" (Name: IDLE1, State: Running @CPU1) 0x4ff20000 in _vector_table ()
* 4 Thread 1341570004 "IDLE0" (Name: IDLE0, State: Running @CPU0) 0x4ff20000 in _vector_table ()
5 Thread 1341552164 "rpc_tx" (Name: rpc_tx) 0x4ff20000 in _vector_table ()
6 Thread 1341546668 "rpc_rx" (Name: rpc_rx) 0x4ff20000 in _vector_table ()
7 Thread 1341534788 "sdio_process_rx" (Name: sdio_process_rx) vPortClearInterruptMaskFromISR (prev_int_level=31)
at /Users/user/.espressif/v5.5.4/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c:514
8 Thread 1341529292 "sdio_read" (Name: sdio_read) 0x4ff20000 in _vector_table ()
9 Thread 1341540284 "sdio_write" (Name: sdio_write) 0x4ff2acca in vPortExitCriticalMultiCore (mux=mux@entry=0x4ff52dd4)
at /Users/user/.espressif/v5.5.4/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c:569
10 Thread 1341575588 "Tmr Svc" (Name: Tmr Svc) 0x4ff20000 in _vector_table ()
11 Thread 1341426560 "ipc1" (Name: ipc1) 0x4ff20000 in _vector_table ()
12 Thread 1341553256 "esp_timer" (Name: esp_timer) vPortClearInterruptMaskFromISR (prev_int_level=31)
at /Users/user/.espressif/v5.5.4/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c:514
13 Thread 1341523796 "sdio_rx_buf" (Name: sdio_rx_buf) 0x4ff2acca in vPortExitCriticalMultiCore (mux=mux@entry=0x4ff5fb34)
at /Users/user/.espressif/v5.5.4/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c:569
14 Thread 1341424152 "ipc0" (Name: ipc0) 0x4ff20000 in _vector_table ()
15 Thread 1341616348 "mqtt_task" (Name: mqtt_task) 0x4ff678f4 in ?? ()
16 Thread 1341619736 "State Runner" (Name: State Runner) 0x4ff22518 in esp_crosscore_int_send (core_id=core_id@entry=0, reason_mask=reason_mask@entry=1)
at /Users/user/.espressif/v5.5.4/esp-idf/components/hal/esp32p4/include/hal/crosscore_int_ll.h:37
17 Thread 1341619284 "EffectManagerTa" (Name: EffectManagerTa) 0x4ff22518 in esp_crosscore_int_send (core_id=core_id@entry=0, reason_mask=reason_mask@entry=1)
at /Users/user/.espressif/v5.5.4/esp-idf/components/hal/esp32p4/include/hal/crosscore_int_ll.h:37
18 Thread 1341911916 "tiT" (Name: tiT) vPortClearInterruptMaskFromISR (prev_int_level=31)
at /Users/user/.espressif/v5.5.4/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c:514
19 Thread 1341913076 "sys_evt" (Name: sys_evt) 0x4ff20000 in _vector_table ()
20 Thread 1341404332 "mdns" (Name: mdns) 0x4ff2acca in vPortExitCriticalMultiCore (mux=mux@entry=0x4ff70ba0)
at /Users/user/.espressif/v5.5.4/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/port.c:569
21 Thread 1341583684 "Console Daemon" (Name: Console Daemon) 0x4ff20000 in _vector_table ()
22 Thread 1341908096 "nvs_worker" (Name: nvs_worker) 0x4ff20000 in _vector_table ()