The documentation says, that without the connection of a host, the apptrace module will operate in post-mortem mode. As soon as a host is connected, it will switch into streaming mode.
Here is my sdkconfig:
Code: Select all
CONFIG_APPTRACE_ENABLE=y
CONFIG_APPTRACE_DEST_JTAG=y
CONFIG_APPTRACE_TRAX_ENABLE=y
CONFIG_APPTRACE_LOCK_ENABLE=y
CONFIG_APPTRACE_ONPANIC_HOST_FLUSH_TMO=0
CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH=0
CONFIG_APPTRACE_SV_ENABLE=y
CONFIG_APPTRACE_SV_TS_SOURCE_ESP_TIMER=y
CONFIG_APPTRACE_SV_MAX_TASKS=16
CONFIG_APPTRACE_SV_BUF_WAIT_TMO=0
CONFIG_APPTRACE_SV_EVT_OVERFLOW_ENABLE=y
CONFIG_APPTRACE_SV_EVT_ISR_ENTER_ENABLE=y
CONFIG_APPTRACE_SV_EVT_ISR_EXIT_ENABLE=y
CONFIG_APPTRACE_SV_EVT_ISR_TO_SCHED_ENABLE=y
CONFIG_APPTRACE_SV_EVT_TASK_START_EXEC_ENABLE=y
CONFIG_APPTRACE_SV_EVT_TASK_STOP_EXEC_ENABLE=y
CONFIG_APPTRACE_SV_EVT_TASK_START_READY_ENABLE=y
CONFIG_APPTRACE_SV_EVT_TASK_STOP_READY_ENABLE=y
CONFIG_APPTRACE_SV_EVT_IDLE_ENABLE=y
First of all, I wanted to test if my JTAG connection actually works. I used the streaming mode for this. I ran the newest version of openocd (07-07-2025) with the right target configuration:
Code: Select all
openocd -f .\esp32s3-builtin.cfg -c "adapter speed 20000"
Code: Select all
telnet localhost 4444
Code: Select all
esp sysview start file://core0.bin file://core1.bin 0 -1 -1
Code: Select all
esp_sysview_flush(0);
For my use case, I just want to flush data to the host when things go wrong or errors occur. This is why I wanted to try if the post-mortem mode works better for me.
I used the following command from openOCD to dump the current trace buffer to the host (for core 0):
Code: Select all
esp apptrace dump file://core0.bin 0
Code: Select all
Info : Total trace memory: 16384 bytes
Info : Open file core.bin
App trace params: from 2 cores, size -1 bytes, stop_tmo -1 s, poll period 0 ms, wait_rst 0, skip 0 bytes
Warn : [esp32s3.cpu0] apptrace connection is lost. Re-connect.
Warn : [esp32s3.cpu1] apptrace connection is lost. Re-connect.
Error: Data timeout!
Error: Failed to poll target for trace data (-4)!
Tracing is STOPPED. Size is 0 of -1 @ nan (nan) KiB/s
Data: blocks incomplete 0, lost bytes: 0
Block read time [1000000000.000000..0.000000] ms
Block proc time [1000000000.000000..0.000000] ms
Update: flush is not necessary, event data is forwarded to the hardware buffer automatically if enough data got buffered. However, manually flushed small amounts of data (for example one printf) are not recognized by the host on dump.
What could go wrong? Does "esp apptrace dump" only work for actual apptrace events and no sysview events? An alternative like "esp sysview dump" doesn't exist yet.
Update: Dump is only supported for apptrace and not sysview at the moment. Is there an alternative approach to read out sysview data in a post-mortem way?
Feel free to ask for any additional information. Thanks in advance for your help!