Reading and Decoding Data From ETB Buffer

Ajay Bharadwaj ajayrbharadwaj at gmail.com
Tue Jan 12 06:17:39 EST 2021


Hi,

I'm working on enabling STM and ETB support on Texas Instruments' platforms.

Currently, I can write directly to the STM device in sysfs and read back 
the encoded data from the ETB's buffer. I am using the Trace Packet 
Lister (trc_pkt_lister) from Linaro's OpenCSD [1] to decode the data 
obtained from the ETB. The decoded data matches what was written to the 
STM (Albeit the data is reversed in some cases, this seems to be 
expected according to the ARM specification).

However, when I use the STM Source Console [2] instead of writing 
directly to the STM device, I can still read back the encoded data from 
the ETB buffer but OpenCSD cannot find any trace data in it.

Is there any other tool that I can use instead of OpenCSD or am I doing
something wrong? Here are the commands I am running (I've tried using
the p_sys-t STP policy as well with the same result):

Enabling CoreSight and STM Source Console:
1. mkdir -p /config
2. mount -t configfs none /config
3. mkdir /config/stp-policy/stm0.policy
4. mkdir /config/stp-policy/stm0.policy/console
5. echo 1 > /sys/bus/coresight/devices/etb0/enable_sink
6. echo stm0 > /sys/class/stm_source/console/stm_source_link

Reading decoded data from ETB buffer:
1. dd if=/dev/etb0 of=test.bin

OpenCSD Output:
Trace Packet Lister: CS Decode library testing
-----------------------------------------------

** Library Version : 0.14.4

Test Command Line:-
./tests/bin/linux64/dbg/trc_pkt_lister   -ss_dir 
tests/snapshots/stm_only/  -src_name  ETB_1

Trace Packet Lister : reading snapshot from path tests/snapshots/stm_only/
Using ETB_1 as trace source
Trace Packet Lister : Protocol printer STM on Trace ID 0x1
ID:1	END OF TRACE DATA
Trace Packet Lister : Trace buffer done, processed 16384 bytes.

[1] 
https://github.com/Linaro/OpenCSD/blob/master/decoder/tests/source/trc_pkt_lister.cpp
[2] Driver: hwtracing/stm/console.c

Any help or guidance would be much appreciated.

Regards,
Ajay Bharadwaj



More information about the linux-arm-kernel mailing list